Avatar of SAbboushi
SAbboushi
Flag 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
Apache Web ServerPHPWindows 7

Avatar of undefined
Last Comment
Dave Baldwin

8/22/2022 - Mon
Dave Baldwin

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.
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
Dave Baldwin

Try creating a new folder like D:\wampdata and put it there.  See if Apache will find it there.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
SAbboushi

ASKER
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
Dave Baldwin

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SAbboushi

ASKER
k thanks for your help.
with regards-
Sam
SAbboushi

ASKER
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...
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Dave Baldwin

Good for you.