Php_value include_path in .htaccess

software development

#1

I’m new at dreamhost and testing my site, and it almost works except for one thing: I’m having trouble resetting the include_path from inside the .htaccess file.

I’m using PHP include to include the header, footer, etc. The included files are in a folder named ‘/includes/’, located in the main directory. The site has several levels of folders. For this to work, I need to define the include_path in the .htaccess file. It worked before at my previous host. Based on what worked previously, the .htaccess file should contain this line:

php_value include_path “.:/usr/local/php5/lib/php:/usr/local/lib/php:/home/username/example.net”

That does not seem to work. The webpages return this error:

Warning: require(includes/config.php) [function.require]: failed to open stream: No such file or directory in /home/.eric/username/example.net/directory/index.php on line 3

Fatal error: require() [function.require]: Failed opening required ‘includes/config.php’ (include_path=’.:/usr/local/php5/lib/php:/usr/local/lib/php’) in /home/.eric/username/example.net/directory/index.php on line 3

The error message doesn’t acknowledge that I reset the path. Does ‘Extra Web Security’ need to be turned off?

Can someone please tell me what I’m doing wrong? I spent several hours searching the wiki but did not find anything regarding this.

Thanks.


#2

Apache won’t understand those directives as PHP is running as a CGI module.

Two quick solutions I think would be:

(1) Set the full path in the require() within the script, or

(2) Customise your PHP and edit the required paths in your php.ini

Maximum Cash Discount on any plan with MAXCASH


#3

Yep! There is also a “third option”:

  1. You can change the include_path setting in your script “on the fly” with the ini_set function.

–rlparker


#4

Im having a similar issue. What exactly do you need to do?