Forum Moderators: phranque

Message Too Old, No Replies

Multiple PHP Value Include Path information in one .htaccess file.

Same File Is Used on both Live and Dev Server.

         

g1smd

11:11 pm on Feb 8, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



For a site I am working on at the moment, I use the same .htaccess file on both the live and the development server.

All of the statements within work perfectly, though some had to be duplicated and edited, and prefaced with a RewriteCond directive to segregate which one was acted upon.

However there is one thing that I haven't worked out how to do. PHP includes worked fine on the development server from the very beginning, but not on the live server unless a line was added to the .htaccess file to specify where the 'PHP includes' folder was located:

php_value include_path /vhost/host4/e/x/1/example.co.uk/www/includes

However, that line has to be deleted before uploading the .htaccess file to the development server, and then added back before uploading to the live server.

How do I make that line conditional, so it knows "where it is", and then just works when it needs to?

There is no access to the php.ini PHP configuration file on the live server, as otherwise I would have edited that instead.

Without the line included, the live server looks at .:/usr/share/pear for include files, but I don't have access to that:

Warning: main(): Failed opening 'navigation.inc' for inclusion (include_path='.:/usr/share/pear') in /vhost/host4/e/x/1/example.co.uk/www/index.php on line 44.

phranque

2:53 am on Feb 9, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



you could try specifying a relative path in the .htaccess and provide an equivalent relative path on the dev server with a soft link.

g1smd

5:39 pm on Feb 10, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hmm, I am not understanding what that means.

phranque

1:51 pm on Feb 11, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



php_value include_path /vhost/host4/e/x/1/example.co.uk/www/includes

your live server root directory is /vhost/host4/e/x/1/example.co.uk/www/ so you could therefore use the following relative path definition:
php_value include_path includes

on your development server, do the following:
cd /path/to/server/root/
ln -s /usr/share/pear includes

this will create a soft link named includes in your server root that will essentially make it look like /path/to/server/root/includes/ contains the includes directory.
and the relative-to-server-root path definition still works in this case...