1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

Strange PHP Warnings when Code Runs at root of site in 7.5.2

Discussion in 'Plesk for Windows - 8.x and Older' started by RCorbet, Aug 12, 2005.

  1. RCorbet

    RCorbet Guest

    0
     
    We are currently running Plesk 7.5.2 on our Windows 2003 server.

    We use the Fusebox methodology to develop PHP web applications.

    When trying to deploy one of our fusebox applications at the root of a site on our Plesk box, we receive warnings similar to this:

    Warning: chdir(): No such file or directory (errno 2) in <drive>:\Plesk\vhosts\<domain>\httpdocs\fbx_Fusebox3.0_PHP4.1.x.php on line 255

    We have tested this with fusebox applications that work fine on non-Plesk Windows 2003 machines, and the error only occurs when run at the root of a Plesk site.

    The strange thing is that if we move the fusebox code into a directory below the root of the site it executes as normal and does not show the errors and warnings.

    e.g.
    Code located at root/index.php fails but code located at root/folder/index.php runs fine.

    Has anyone else seen this behaviour (not necessarily with Fusebox, but with particular PHP commands running at the root of the site)? If so, what can we do to resolve this issue?

    Thank you for your help.

    Kind regards,

    Roland
     
  2. robtbs

    robtbs Guest

    0
     
    what are you trying to change the dir to?
    you may need to use absolute locations...

    eg...
    chdir('<drive>:\inetpub\vhosts\<domain>\httpdocs\directory');

    just thinking ahead but if your using ISAPI this may solve the issue as its borked in plesk, relative paths dont work...

    So...
    chdir('directory');


    wont work with ISAPI... try using CGI instead.
    (i havnt tried.. but i have issue with include() using ISAPI - i would imagine is the same thing)
     
  3. RCorbet

    RCorbet Guest

    0
     
    Hi,

    We are currently running PHP in CGI and not ISAPI mode.

    The section of code that seems to be giving us the problems is part of the fusebox "core" files - i.e. files that make the fusebox methodology "work".

    We have not changed anything in these files from when they were working on the non-plesk machine.

    The lines of code that seem to be causing the problem are:

    $FB_["SC"] = new SaveContent();
    $FB_["appRootPath"] = getcwd()."/";
    chdir($FB_["appRootPath"].$FB_["fuseboxPath"]);
    include($FB_["appRootPath"].$FB_["fuseboxPath"]."fbx_Switch.php");

    chdir($FB_["appRootPath"]);
    $Fusebox["layout"] = $FB_["SC"]->close();

    Outputting $FB_["appRootPath"] reveals that the value returned is: <DRIVE>:\Plesk\vhosts\<domain>\httpdocs/

    At the time the chdir command is run, it appears that $FB_["fuseboxPath"] doesn't contain a value. So the path that it's trying to change to is:

    <DRIVE>:\Plesk\vhosts\<domain>\httpdocs/

    If we perform the same debug and print the value that is used when the whole site code is included one directory down, the path that the code is trying to change to is:

    <drive>:\Plesk\vhosts\<domain>\httpdocs\indir/

    Which enables the code to work OK.

    It appears that PHP has a problem when trying to change to the directory when it's at the root of the site.

    Regards,

    Roland
     
  4. RCorbet

    RCorbet Guest

    0
     
    Hi,

    We finally found a resolution to this.

    If we grant IUSR_<siteuser> read permissions on the directory above the httpdocs folder (i.e. <drive>:\plesk\vhosts\<domain>) then the Fusebox core code works fine.

    We have had to grant these permissions "manually" through Windows. Is there a more "legitimate" way to make Plesk aware of these changes so that it won't overwrite or attempt to change them, and then break the site?

    We've run the Plesk permission checker and it didn't detect any problems or attempt to change the directory permissions.

    Regards,

    Roland
     
  5. robtbs

    robtbs Guest

    0
     
    plesk will probably only overright permissions those folders if you restore a backup of that domain or it may also reset the permissions if you change the access password for the domain.

    Cheers
    Rob
     
Loading...