# [web] Set location of php.ini in httpd.conf

## Recommended Posts

I'm ready to tear my hair out. I'm on Slackware 13, trying to set up a local Apache server for trying out different web technologies and configurations. I've got PHP running, but to avoid running as root all the time, I need to specify a php.ini file owned by my regular user. But I can't figure out how to tell Apache to tell PHP to look for php.ini in my personal site directory. If this is possible (and it seems crazy to think that it isn't), how do you do it?

##### Share on other sites
Of course now I find it... You have to set the PHPRC environment variable, where PHP looks for php.ini, in your httpd.conf using the SetEnv directive.
SetEnv PHPRC /path/to/config_file

Also, it seems running httpd ... -k restart doesn't clear all environment variables, so I had to completely stop it to see the effect.

##### Share on other sites
You can use the PHPIniDir "/home/theocelot/php.ini" directive in your httpd.conf.

##### Share on other sites
Thanks, that works too, and is clearer. [smile]

But even knowing what it's called, it's difficult to find clear documentation on it, and almost every time it's mentioned, it's in the context of a Windows installation. When you google just "phpinidir", the first thing to come up is a mostly incoherent thread on bytes.com. It would be easy to believe it was only for Windows.

## Create an account

Register a new account

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627657
• Total Posts
2978471

• 10
• 12
• 22
• 13
• 33