By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,709 Members | 2,155 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,709 IT Pros & Developers. It's quick & easy.

Using local php.ini files

P: n/a
My Web Host (Linux - Apache) recently upgraded to Php5. One thing lost
in the upgrade was a global configuration that allowed me to place
php.ini files in any directory and they would be read and used (I don't
know if that was in addition to a global php.ini file or not).

Prior to that (a couple of years ago) php directives were placed in the
htaccess file in the site's root directory, but after an even earlier
upgrade the htaccess directives gave a 500 Server Error. That is when I
was started using local php.ini files instead.

Now I can do neither. The local php.ini files are no longer used and
adding php directives to htaccess causes a 500 Server error.

The directive I am most concerned with is include_path, so I can keep
include files outside of the web site.

I have communicated with my web host a few times about this and they
seem to have no idea what needs to be done. I know, this is pretty
shoddy on their part, but in all other things this host has been very
good, so I'd rather stick with them.

Does anyone have any idea what kind of configuration they used that
allowed the local php ini files to be used?

Is there an Apache configuration directive needed to allow php
directives in the htaccess file?

Thanks for any pointers.

--
*****************************
Chuck Anderson • Boulder, CO
*****************************
Jul 25 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Chuck Anderson <we************@seemy.sigwrote:
Does anyone have any idea what kind of configuration they used that
allowed the local php ini files to be used?

Is there an Apache configuration directive needed to allow php
directives in the htaccess file?
Chuck,

If PHP is running as a CGI, you could use the special environment
variable PHPRC (see <http://www.php.net/manual/en/configuration.php>)

In your htaccess file, you would then have:

SetEnv PHPRC /path/to/your/php.ini

hih,

JJS.
Jul 26 '06 #2

P: n/a
J.J.SOLARI wrote:
Chuck Anderson <we************@seemy.sigwrote:

>Does anyone have any idea what kind of configuration they used that
allowed the local php ini files to be used?

Is there an Apache configuration directive needed to allow php
directives in the htaccess file?

Chuck,

If PHP is running as a CGI, you could use the special environment
variable PHPRC (see <http://www.php.net/manual/en/configuration.php>)

In your htaccess file, you would then have:

SetEnv PHPRC /path/to/your/php.ini

hih,

JJS.
Thanks. Php is running as a cgi at my web host, so I tried what you
said, ... but no luck. I cannot set the Environment variable PHPRC.

I wonder if permission has to be granted in httpd.conf.

(Note: while researching this I found that you should specify the path
to the directory php.ini is in, not to the file itself. i.e.,
/path/to/your/phpinidirectory)

--
*****************************
Chuck Anderson Boulder, CO
http://www.CycleTourist.com
Everyone's journey should be different,
so that we all are enriched
in new and endless ways
*****************************
Jul 27 '06 #3

P: n/a
Chuck Anderson <we************@seemy.sigwrote:

In your htaccess file, you would then have:

SetEnv PHPRC /path/to/your/php.ini

hih,

JJS.

Thanks. Php is running as a cgi at my web host, so I tried what you
said, ... but no luck. I cannot set the Environment variable PHPRC.

I wonder if permission has to be granted in httpd.conf.

(Note: while researching this I found that you should specify the path
to the directory php.ini is in, not to the file itself. i.e.,
/path/to/your/phpinidirectory)
Chuck,

Indeed, my mistake :(

Also, I forgot to put quotes around ; so, it should read:

SetEnv PHPRC "/path/to/your_php.ini/directory/"

Note that this path is not taken from the server root, but from the
filesystem root (check with phpinfo).

hope it will work this time,

JJS.
Jul 27 '06 #4

P: n/a
J.J.SOLARI wrote:
Chuck Anderson <we************@seemy.sigwrote:
>>In your htaccess file, you would then have:

SetEnv PHPRC /path/to/your/php.ini

hih,

JJS.

Thanks. Php is running as a cgi at my web host, so I tried what you
said, ... but no luck. I cannot set the Environment variable PHPRC.

I wonder if permission has to be granted in httpd.conf.

(Note: while researching this I found that you should specify the path
to the directory php.ini is in, not to the file itself. i.e.,
/path/to/your/phpinidirectory)

Chuck,

Indeed, my mistake :(

Also, I forgot to put quotes around ; so, it should read:

SetEnv PHPRC "/path/to/your_php.ini/directory/"

Note that this path is not taken from the server root, but from the
filesystem root (check with phpinfo).

hope it will work this time,

JJS.
Thanks again, but I already tried several formats (quotes, no quotes,
trailing slash, no trailing slash, ...). I think something is not
allowing me to set that (or Php was compiled to ignore it?).

--
*****************************
Chuck Anderson Boulder, CO
http://www.CycleTourist.com
Everyone's journey should be different,
so that we all are enriched
in new and endless ways
*****************************
Jul 27 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.