Sign in to follow this  
theOcelot

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

Recommended Posts

theOcelot    498
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 this post


Link to post
Share on other sites
theOcelot    498
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 this post


Link to post
Share on other sites
theOcelot    498
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this