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

PHP.INI ...

P: n/a
How do you tell Apache or PHP of what php.ini file to use, specifically? I
manage to tell Apache/PHP where to find php.ini by defining an environment
variable PHPRC to a specified directory where there is a php.ini file.

How do I tell Apache/PHP to use e.g c:\php\php4.ini or c:\php\php5.ini?

Thanks
Jul 17 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
On Thu, 25 Mar 2004 13:59:46 -0500, "Ruby Tuesdays"
<No**********************@yahoo.com> wrote:
How do you tell Apache or PHP of what php.ini file to use, specifically? I
manage to tell Apache/PHP where to find php.ini by defining an environment
variable PHPRC to a specified directory where there is a php.ini file.

How do I tell Apache/PHP to use e.g c:\php\php4.ini or c:\php\php5.ini?

Thanks

Setting up the environment variable PHPRC should do it.

Steve
Jul 17 '05 #2

P: n/a
I did but it's just the directory you're setting. The filename has to be
php.ini. Suppose that you have 2 php instace running on the same server e.g
one with Apache(running php5) and the other with IIS(running php4). Thanks
Jul 17 '05 #3

P: n/a
Uzytkownik "Ruby Tuesdays" <No**********************@yahoo.com> napisal w
wiadomosci news:c3*************@ID-205437.news.uni-berlin.de...
How do you tell Apache or PHP of what php.ini file to use, specifically? I
manage to tell Apache/PHP where to find php.ini by defining an environment
variable PHPRC to a specified directory where there is a php.ini file.

How do I tell Apache/PHP to use e.g c:\php\php4.ini or c:\php\php5.ini?


Rename the php.ini for Apache to php-apache.ini and the one for IIS to
php-isapi.ini.
Jul 17 '05 #4

P: n/a
Where do you tell PHP(Apache) and PHP(IIS) of what php.ini to use?
I can't use PHPRC since it looks for php.ini file in a specified directory.

Thanks
Jul 17 '05 #5

P: n/a
Uzytkownik "Ruby Tuesdays" <No**********************@yahoo.com> napisal w
wiadomosci news:c4*************@ID-205437.news.uni-berlin.de...
Where do you tell PHP(Apache) and PHP(IIS) of what php.ini to use?
I can't use PHPRC since it looks for php.ini file in a specified

directory.

You don't have to. PHP looks for the SAPI specific ini file before it loads
the generic one. In php_ini.c (in the PHP source), you find the following:

/* Search php-%sapi-module-name%.ini file in search path */
if (!fh.handle.fp) {
const char *fmt = "php-%s.ini";
char *ini_fname = emalloc(strlen(fmt) + strlen(sapi_module.name));
sprintf(ini_fname, fmt, sapi_module.name);
fh.handle.fp = php_fopen_with_path(ini_fname, "r", php_ini_search_path,
&php_ini_opened_path TSRMLS_CC);
efree(ini_fname);
if (fh.handle.fp) {
fh.filename = php_ini_opened_path;
}
}
/* Search php.ini file in search path */
if (!fh.handle.fp) {
fh.handle.fp = php_fopen_with_path("php.ini", "r", php_ini_search_path,
&php_ini_opened_path TSRMLS_CC);
if (fh.handle.fp) {
fh.filename = php_ini_opened_path;
}
}

Jul 17 '05 #6

P: n/a
Sorry Chung, I renamed php.ini to php-apache.ini and start the apache and it
executed the one in c:\windows directory instead of the one set by PHPRC
environement variable.

When I used the php.ini in that directory, Apache/PHP found that ini file
and enable all the PHP modules I set in that file. Well, to test your
method, I renamed the php.ini file to php-apache.ini and it did not work. So
I assume, the IIS/PHP version with php-isapi.ini would not work as well.

Any advise? Do I have to put the php-apache.ini and php-isapi.ini into
C:\Windows directory? Thanks
Jul 17 '05 #7

P: n/a
On Fri, 26 Mar 2004 11:42:41 -0500, "Ruby Tuesdays"
<No**********************@yahoo.com> wrote:
Uzytkownik "Ruby Tuesdays" <No**********************@yahoo.com> napisal w
wiadomosci news:c4*************@ID-205437.news.uni-berlin.de...
Where do you tell PHP(Apache) and PHP(IIS) of what php.ini to use?
I can't use PHPRC since it looks for php.ini file in a specified

directory.

You don't have to. PHP looks for the SAPI specific ini file before it loads
the generic one. In php_ini.c (in the PHP source), you find the following:

/* Search php-%sapi-module-name%.ini file in search path */


Sorry Chung, I renamed php.ini to php-apache.ini and start the apache and it
executed the one in c:\windows directory instead of the one set by PHPRC
environement variable.

When I used the php.ini in that directory, Apache/PHP found that ini file
and enable all the PHP modules I set in that file. Well, to test your
method, I renamed the php.ini file to php-apache.ini and it did not work. So
I assume, the IIS/PHP version with php-isapi.ini would not work as well.

Any advise? Do I have to put the php-apache.ini and php-isapi.ini into
C:\Windows directory? Thanks


What SAPI handler are you using? I've just tried it here with PHP 5.0.0RC1 on
Apache2 - so I copied my php.ini to php-apache2handler.ini, and put it in the
same directory as php5apache2.dll.

phpinfo then shows:

Configuration File (php.ini) Path
d:\php-5.0.0RC1-Win32\php-apache2handler.ini

Run phpinfo(), scroll down to the section under 'Configuration'. It'll have
the name of your SAPI module as a heading. It may simply be that your SAPI
module is not named 'apache'.

--
Andy Hassall <an**@andyh.co.uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space
Jul 17 '05 #8

P: n/a
Andy, it worked by renaming it to php-apache2handler.ini. But, where did
you get the "apache2handler" name from?

I search PHP and Apache2 win32 binary directory structure and can't find
any file name similar like that. Do you have to read the source code?

Thanks

PS: Perhaps for IIS, all I have to do is rename it to php-isapi.ini? Is is
correct?
Thanks again.
Jul 17 '05 #9

P: n/a
You did mentioned in your posting about php-%sapi-module-name%.ini. It
should hinted me but I've got no idea(I'm to slow to grasp it)... thanks for
your help.
Jul 17 '05 #10

P: n/a
I got it. Thanks Chung Leong and Andy Hassall. I got it both worh for
Apache2 and IIS5.1.

Apache2 php-apache2handler.ini
IIS php-isapi.ini

I check it using phpinfo() and yes, they are correct. By the way, I found
out that the handler name is stated in phpinfo() under "Server API".

Thanks again to Andy and Chung
Jul 17 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.