Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi for PHP/Library/PHP    [ Add a report in this area ]  
Report #:  79558   Status: Need Feedback
Path to vcl directory not handed correctly for files in sub directories
Project:  HTML5 Builder Build #:  2.1.0.1098
Version:    2.0 Submitted By:   John Mackerras
Report Type:  Basic functionality failure Date Reported:  11/16/2009 12:22:07 PM
Severity:    Serious / Highly visible problem Last Updated: 11/16/2009 5:20:53 PM
Platform:    All platforms Internal Tracking #:  
Resolution: Need More Info (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
When a PHP file is created it includes a directive to include the VCL directory through the command require_once("vcl/vcl.inc.php"). This is consitent irrespective of the position of the file, i.e. whether the file is in the website root directory or whether it is in any given sub-directory of the site.

When the website is deployed to an active environment, the VCL driectory will not be visible to any file located in a sub-directory unless the include is adjusted. Typically this may require the include to be changed from "vcl/vcl.inc.php" to "../vcl/vcl.inc.php" to ensure visibility.

However, this adjustment, which is made to allow the web page to work on a live site will also render the webpage unuseable in the development environment.


Because D4PHP utilises a windows PATH envronment variable the VCL directory will always be available to any given page irrespective of that pages location.

If, for example, a given structure has a page in the website root directory (called root.php) and another page in a sub-directory (called subdir/page.php) then when developing we encounter the following phenomena.

- When run, root.php appears, correctly, as being in the root of the test website. In this instance, page.php is correctly accessible by settint the path of the browser to '/subdir/page.php'. All components in both pages will run correctly.

- When run, page.php, appears, incorrectly, as being in the root of the test website. In this instance, references back to root.php will fail as the file will not be visible to the test environment. All components in page.php will work correctly.


However when deployed we would normally deploy to a structure such as

/vcl
/subdir/page.php
root.php

This would then require the include within the page.php file to be adjusted to require_once("../vcl/vcl.inc.php") to ensure that the VCL file is located correctly. while this adjustment may work for a live site, the same edit disables functionality within the development environment as the VCL directory is not locatable by the IDE when it is given the location "../vcl/".

Further, data components do not operate correctly.



Effectively this means that php files located within sub directories of any given project are NOT likely to work in a live environment, but DO work in the development environment, lulling the developer into a false sense of security.



Given this, D4PHP could resemble more closely an actual deployment environment than it currently does. This would enable a more accurate refelction of the operability of deployed code. One improvement which comes to mind is that the root directory for a project should be defineable, but defaulted to the location of the project file. Where a PHP page is condsidered by the project to be in a sub-directory then running of the page should use the correct relative paths, including full relative paths to the VCL directory.
Steps to Reproduce:
See descriiton
Workarounds
None
Attachment
None
Comments

Tomohiro Takahashi at 11/16/2009 6:32:05 PM -
Is your issue about deployment of VCL(PHP) application?
Where are the files of VCL for PHP library copied in the deployment environment?
How do you set 'include_path' parameter of 'php.ini'?

So, is this documentation helpful?
[Deploying Applications]
http://www.qadram.com/vcl4php/docwiki/index.php/Deploying_Applications
[Where is the vcl-bin subdirectory?]
http://support.codegear.com/article/36392

Server Response from: ETNACODE01