473,401 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

PHP.INI ...

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
10 6222
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
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
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: William C. White | last post by:
Does anyone know of a way to use PHP /w Authorize.net AIM without using cURL? Our website is hosted on a shared drive and the webhost company doesn't installed additional software (such as cURL)...
2
by: Albert Ahtenberg | last post by:
Hello, I don't know if it is only me but I was sure that header("Location:url") redirects the browser instantly to URL, or at least stops the execution of the code. But appearantely it continues...
3
by: James | last post by:
Hi, I have a form with 2 fields. 'A' 'B' The user completes one of the fields and the form is submitted. On the results page I want to run a query, but this will change subject to which...
0
by: Ollivier Robert | last post by:
Hello, I'm trying to link PHP with Oracle 9.2.0/OCI8 with gcc 3.2.3 on a Solaris9 system. The link succeeds but everytime I try to run php, I get a SEGV from inside the libcnltsh.so library. ...
1
by: Richard Galli | last post by:
I want viewers to compare state laws on a single subject. Imagine a three-column table with a drop-down box on the top. A viewer selects a state from the list, and that state's text fills the...
4
by: Albert Ahtenberg | last post by:
Hello, I have two questions. 1. When the user presses the back button and returns to a form he filled the form is reseted. How do I leave there the values he inserted? 2. When the...
1
by: inderjit S Gabrie | last post by:
Hi all Here is the scenerio ...is it possibly to do this... i am getting valid course dates output on to a web which i have designed ....all is okay so far , look at the following web url ...
2
by: Jack | last post by:
Hi All, What is the PHP equivilent of Oracle bind variables in a SQL statement, e.g. select x from y where z=:parameter Which in asp/jsp would be followed by some statements to bind a value...
3
by: Sandwick | last post by:
I am trying to change the size of a drawing so they are all 3x3. the script below is what i was trying to use to cut it in half ... I get errors. I can display the normal picture but not the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.