HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   General (http://www.howtoforge.com/forums/forumdisplay.php?f=25)
-   -   Cannot use chdir (http://www.howtoforge.com/forums/showthread.php?t=60263)

markshorter 18th January 2013 22:37

Cannot use chdir
 
If I run this simple script:

Code:

<?php

// starting directory
echo getcwd() . "<br />";
chdir('/var/');
// new directory
echo getcwd() . "<br />";

?>

The same directory is printed twice. In other words "chdir" isn't changing directory as intended. Have I missed something when installing ISPConfig3 on Debian Squeeze?

till 21st January 2013 11:18

Wre do you execute this script, in a website? The /var/ directory is outside of the allowed paths of a website, so you can not change to that directory. If you want to allow access to /var, then add /var to the open basedir path settin on the options tab of this website.

markshorter 22nd January 2013 06:02

The /var directory was only part of my testing what was possible, but thank you for your comments. This was an interesting challenge, and more by luck than good judgement I found the settings you mentioned a few hours before your post.

If any other reader doesn't know (and I didn't at first), go to Sites and select the domain of interest. On its Options tab you will find a page on which you can enter a few of your own custom settings,
one of which is the open_basedir declaration. This field starts life with an ISPConfig default and it was this default upsetting my trial. After some experimenting, here's some things I discovered:

1. The default includes 10 directory paths. When I changed it to just the 3 I wanted everything I tested worked fine on a medium sized Drupal site with lots of symlinks - so I don't know why the default has so many paths. Legacy thing that hasn't been reviewed lately perhaps?

2. If you delete all the defaults, maybe as part of your own testing, be aware that ISPConfig will reinstate all 10 default paths again. I don't like any software being that dictatorial, but the key here is that it will only reinstate the defaults if you leave the field empty, so put something in there to suppress this unwelcome feature.

And the reason I described it as a challenge to find is because of an odd thing. Whatever appears in this field does not seem to be written to any standard apache conf file that I could find - hence my original post. The odd thing is that this Options page includes a panel for you to enter your own Apache Directives. Anything you add here is written out to the vhost configuration file for this domain.

Yes, it's odd that one of your custom fields finds its way into a standard config file but another doesn't - not just odd, but confusingly inconsistent. Perhaps it might be good if all the user changeable fields on this Options page could be treated in a consistent manner - preferrably all written out to config files.

till 22nd January 2013 09:59

Quote:

1. The default includes 10 directory paths. When I changed it to just the 3 I wanted everything I tested worked fine on a medium sized Drupal site with lots of symlinks - so I don't know why the default has so many paths. Legacy thing that hasn't been reviewed lately perhaps?
The paths are required. Maybe not on your system but on others. Btw, drupal runs fine out of the box with the default paths, installed it for a client a few weeks ago ;)

Quote:

2. If you delete all the defaults, maybe as part of your own testing, be aware that ISPConfig will reinstate all 10 default paths again. I don't like any software being that dictatorial, but the key here is that it will only reinstate the defaults if you leave the field empty, so put something in there to suppress this unwelcome feature.
Naming ispconfig dictatorial is just funny. Your post shows just that you dont know much about hosting or ispconfig.

1) If you want to change the default of the open_basedir paths, then edit it underSystem > Server config
2) The open_basedir path is never empty, to disable it, insert the word "none" like it is decribed in the php documentation.

Quote:

And the reason I described it as a challenge to find is because of an odd thing. Whatever appears in this field does not seem to be written to any standard apache conf file that I could find - hence my original post. The odd thing is that this Options page includes a panel for you to enter your own Apache Directives. Anything you add here is written out to the vhost configuration file for this domain.
Are you aware how php is configred in apache in different modes? php settings are only in apache file if mod_php is used. If you use php-fcgi, cgi or suphp, then values are stored either in a custom php.ini or they are set in the fcgi starter script.

Quote:

Yes, it's odd that one of your custom fields finds its way into a standard config file but another doesn't - not just odd, but confusingly inconsistent. Perhaps it might be good if all the user changeable fields on this Options page could be treated in a consistent manner - preferrably all written out to config files.
Its absolutely consistent when you know that different php mpdes ahve different ways of configuration.

So before you blame a software that it does something wrong,you might want to ask or read the php and apache documentation in details ;)

markshorter 22nd January 2013 17:41

Well, didn't I display my ignorance in my previous post. But your sentence saying "Your post shows just that you dont know much about hosting or ispconfig" was apparent enough to all without the unkindness of bluntly saying it. Your post would have been just as useful and informative without underlining my shortcomings.

That said, I did start it with unfounded observations of my own, which, based on learning from your brief explanations, I withdraw unreservedly. ISPConfig is evidently clever, well thought through software in ways that I am only beginning to learn and understand. I'm working on it.

My sites were set up to use the default of fastcgi and now that you've guided me in the right direction it is plainly obvious where the open_basedir settings are written - in a hidden fcgi scripts file just above the site's document root.


All times are GMT +2. The time now is 10:45.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.