Link to home
Start Free TrialLog in
Avatar of SAbboushi
SAbboushiFlag for United States of America

asked on

PHPINIDIR ignored in W7 Apache (WampServer)

I want Apache to load my php.ini file from a folder on my d: drive.

C:\wamp\bin\apache\Apache2.2.21\conf\httpd.conf
...
ServerRoot "c:/wamp/bin/apache/apache2.2.21"

PHPIniDir "d:\documents\Application Data\PHP\"
...

Open in new window


Restarting all services with the WampServer system tray icon displays a Green "W" with the above PHPIniDir statement.  But http://localhost/?phpinfo=1 shows:

Configuration File (php.ini) Path: C:\Windows

Loaded Configuration File: C:\wamp\bin\apache\Apache2.2.21\bin\php.ini


Tried other options, but didn't work either:

PHPIniDir "d:\documents\Application Data\PHP"

Open in new window

(no final "\") results in an orange "W" and http://localhost/?phpinfo=1 shows "Internet Explorer cannot display the webpage"

Same with:
PHPIniDir "d:/documents/Application Data/PHP/"

Open in new window

and
PHPIniDir "d:/documents/Application Data/PHP"

Open in new window


How can I get Apache to use d:\documents\Application Data\PHP\php.ini?

Thanks-
Sam

W7 64, IE9
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Make sure that your permissions in that directory allow Apache to access it.  "Everyone" might work but you can look at the permissions in the original location to see how they are set.  "d:\documents\Application Data\" sounds like it would be for a specific user and you might not be able to set permissions to allow it.  Another issue is that the path has a space in it in "Application Data" and quite a number of programs that have come from Unix or Linux do not like that.

I am wondering why you want to do this when it works fine where it is originally located.
Avatar of SAbboushi

ASKER

Thanks for your response--

>>you might not be able to set permissions to allow it.  
Permissions are the same for both folders

>>Another issue is that the path has a space in it
Good idea - but eliminating the space had no effect

>>I am wondering why you want to do this when it works fine where it is originally located.
Backup/restore and system partition imaging
Try creating a new folder like D:\wampdata and put it there.  See if Apache will find it there.
Copied the bin folder containing the php.ini from the original location and changed php.ini to:

 PHPIniDir "d:\bin\"

Restarted services.  No effect...

I went through this same problem with IIS and it took over a year before I figured out I also had to make a change to an internal environment variable for php-cgi.exe...

Hoping to figure this out a little sooner this time!
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
k thanks for your help.
with regards-
Sam
Success!!

Create a System Environment variable "PHPRC" with the value "D:\Documents\Application Data\PHP", restart all services, and phpinfo() shows:

Configuration File (php.ini) Path: C:\Windows

Loaded Configuration File: D:\Documents\Application Data\PHP\php.ini

This didn't work with IIS so I didn't bother to try it until now on Apache...
Good for you.