Forum Moderators: coopster

Message Too Old, No Replies

Setting path to override php.ini

on a Windows/Apache system

         

Winnetou

1:06 pm on Jul 30, 2008 (gmt 0)

10+ Year Member



I've searched this site and the web for a solution to the following:

I'm using Win XP with Apache 2 and PHP 5.1.4 and want to emulate what I've already configured successfully for my live site.

Since the environment is different (I use Apache as a module, my provider as a CGI) I struggle with configuring how to override php.ini for one directory and the ones below.

I've added either of these to .htaccess:
SetEnv PHPRC "C:\webserver\htdocs\www.xyz.com"
php_value include_path ".;C:\webserver\htdocs\www.xyz.com"

and in that directory there's a php.ini with just

include_path = ".;C:\webserver\htdocs\www.xyz.com\include"

However, I only get the dreaded

"Warning: ...failed to open stream: No such file or directory in..."

What am I missing?

Thanks!

eelixduppy

2:37 pm on Jul 30, 2008 (gmt 0)



SetEnv PHPR
only works when you are running PHP as a CGI. Therefore the error you are getting is because it cannot find the file you are including in the directory you specified because you never actually set the include path correctly.

Winnetou

12:35 pm on Jul 31, 2008 (gmt 0)

10+ Year Member



Hi eelixduppy,

yes, I put in both when I wasn't sure which one was for the module version of Apache.

I just figured out my mistake - I thought I had to go down the same path as for the live server, ie. put path to php.ini into .htaccess and then the PHP include path into php.ini.

But the setting

php_value include_path ".;C:\webserver\htdocs\www.xyz.com"

already gives you the include path [slap forehead] and I just had to add the last bit to the directory where the includes actually were,

php_value include_path ".;C:\webserver\htdocs\www.xyz.com\include"

Thanks for your help!