Re: Why PHP reads local php.ini?
| From: | Joel Rees | Date: | Fri, 04 Apr 2003 10:56:40 +0000 |
| Subject: | Re: Why PHP reads local php.ini? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-142801@lists.php.net to get a copy of this message | ||
Relevant links:
http://www.php.net/manual/en/configuration.php
http://www.php.net/manual/en/faq.installation.php#faq.installation.phpini
http://www.php.net/manual/en/features.commandline.php
> I mean than when you run PHP in CGI mode, PHP doesnエt read default php.ini
> location. It first to look php in your actual path. An example...
>
> ecazfe04:/home3/www# php -v
> PHP 4.3.1 (cgi), Copyright (c) 1997-2002 The PHP Group
> Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend Technologies
>
>
> ecazfe04:/home3/www# export REQUEST_METHOD="POST"
> // Now we are in CGI mode as if it was called from Apache.
>
> ecazfe04:/home3/www# export REDIRECT_STATUS="200"
> // To avoid force-cgi-redirect
>
> ecazfe04:/home3/www# php -v
> Content-type: text/html
> X-Powered-By: PHP/4.3.1
>
> No input file specified.
> // Ok, we are in CGI mode and it looks for a file.
>
> /home3/www# cd <path_to_file>
> /home3/www# php index.php
> Everithings gos OK, except that if exists php.ini in <path_to_file> PHP
> uses it. That overrides default compilation option. You can see it if you
> use phpinfo() in 'index.php'.
The faq listed above says that apache will look first in its own
installation directory, so you can have a different php.ini for each
apache you have running.
It also says you can specify the location with a command-line switch, -c.
> I think this shouldnエt be the correct way of reading php.ini, but maybe
> Iエm wrong. Can anybody help me? I run a webserver (Apache+PHP) that hosts
> some virtualhosts and I donエt wonエt that my customers could use an alternate
> php.ini.
Well, if they can install their own apache, you're going to have a hard
time keeping them from using an alternate php.ini.
I suggest that you configure apache to serve your customers from
directories somewhere outside the path to apache. That would be safer.
Look at these directives in httpd.conf:
Alias
Directory
and maybe
UserDir
For instance
Alias /user1 "/home/user1/www"
and
<Directory "/home/user1/www">
Options Indexes
AllowOverride None
Order allow,deny
Allow from all
DefaultLanguage es
</Directory>
You probably don't want to use those, but that might give you the idea.
Of course, if you're talking about letting your customers serve the web
from the shell, apache settings won't do you much good, and I think
you'll have more to worry about than whether or not they are using you
php.ini.
> PS: Sorry, Iエm Spanish and I donエt know if my explanation is clear
> enough.
Apologies if I misunderstood your question.
--
Joel Rees <joel@alpsgiken.gr.jp>