php.ini does not get reloaded when i restart apache. WHY???

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

ivj
Forum Commoner
Posts: 31
Joined: Sat Mar 05, 2005 3:07 am

php.ini does not get reloaded when i restart apache. WHY???

Post by ivj »

This is the first time ever I'm dealing with PHP (I'm a Java guy), and this has not been a pleasant experience (on top of php problems I have a fever, so stick with me...)

I'm running Fedora 5, Apache 2.2.0 (I think), PHP 5.1.6. All compiled, freshly installed. All seems to run fine. I even installed a SugarCRM thingy (a giant php prog) and it worked just fine.

The other day I was reading php.ini and I realized I don't have a a log file specified (error_log). So I put in "/var/log/php", do /etc/init.d/httpd restart. I check my logs folder - no php in there. I play some more with php.ini, and no matter what I do - the changes don't get reflected, php is still working, and I don't get any errors in apache logs (or /var/log/messages).

I even tried setting engine = Off in php.ini - PHP still works.

I check my phpinfo() - I AM editing the correct file.

So, feeling desparate, I delete that file just to see what happens. I restart apache - WTF, php still works, everything works, no errors. ARGGHHHHH.

I remember reading somewhere that if your php.ini is faulty, PHP will use some other default php.ini which's stored in some secret folder or something like that. So I move php-recommended.ini into php.ini. Restart the server - same old crap, everything works, no errors, php.ini changes aren't reflected.

I'm getting pretty desparate not being able to figure this out. Any help is greatly appreciated.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

According to http://distrowatch.com/table.php?distribution=fedora fc5 ships with php 5.1.2.
So exactly how did you install apache and php?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Have you searched your system for php.ini files? There is a chance that you are editing one (that you think is correct) and that PHP is using a different one.

PS On my FC5 the ini file is in /etc/php.ini.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Moved to Apache, IIS, and Web Servers.

Pay Attention Everah. :wink:
Last edited by John Cartwright on Wed Nov 15, 2006 9:48 pm, edited 1 time in total.
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post by neophyte »

Yeah run phpinfo(). At the top somewhere will be the path to your ini. Check it to make sure you are editing the proper file. If you are editing the proper file do you have any .htaccess commands that may be interfering?
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post by nickvd »

This might of been said before (or i may be wrong), but did you turn on LogErrors in your php.ini file (obviously run phpinfo to ensure you're editting the right file)
ivj
Forum Commoner
Posts: 31
Joined: Sat Mar 05, 2005 3:07 am

Post by ivj »

Please, please, PLEASE

read my post before posting.
I check my phpinfo() - I AM editing the correct file.
I searched my system and it is the only php.ini file (except for php.ini-dist and php.ini-recommended which are located in the source folder).

My fedora 5 (I didn't install it myself) didn't come with php, it only came with apache.
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post by nickvd »

Did you turn "log_errors" on?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

ivj wrote:I searched my system and it is the only php.ini file (except for php.ini-dist and php.ini-recommended which are located in the source folder).

My fedora 5 (I didn't install it myself) didn't come with php, it only came with apache.
Is this a personal computer or a server? If it is a personal computer you can install PHP from the GUI interface so that it works as an Apache Module on your system. If you compiled PHP then you are going to have more than one php.ini file on your system (one in the location where PHP was built and one in the location that make install creates).
ivj
Forum Commoner
Posts: 31
Joined: Sat Mar 05, 2005 3:07 am

Post by ivj »

nickvd: It doesn't matter if I turn it on or off - my logfile doesn't get reloaded. If I turn it on in the code - there are no errors regarding the php.ini or anything.

Everah: It's a server, no GUIs here. I did compile PHP but there are no php.inis (except for the -recommended and -dist ones (like I've mentioned earlier)), and phpinfo() points to the file I'm editing.

If I delete that file, I can still run apache and PHP will work. What conf file does it use? phpinfo() gives me a path that doesn't exist, so wtf?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

php.ini isn't required to run PHP. If not found, PHP will use the defaults for everything, including where its reading php.ini from. Misleading, but that's how it works.
ivj
Forum Commoner
Posts: 31
Joined: Sat Mar 05, 2005 3:07 am

Post by ivj »

Ok... but if I have a file in there and it's syntax is bad.. does it use all the defaults too? Shouldn't it write out the errors somewhere or something?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

feyd wrote:php.ini isn't required to run PHP. If not found, PHP will use the defaults for everything, including where its reading php.ini from. Misleading, but that's how it works.
You learn something new everyday. Thanks feyd.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

ivj wrote:Ok... but if I have a file in there and it's syntax is bad.. does it use all the defaults too? Shouldn't it write out the errors somewhere or something?
Many startup errors will fail the loading of PHP. When used as a module, this means the web server will likely fail to load too. Every time I've had something error the startup, it was always output to the console (or desktop.)
ivj
Forum Commoner
Posts: 31
Joined: Sat Mar 05, 2005 3:07 am

Post by ivj »

Um both apache and php work, even though I obviously put errors into php.ini or remove it. So what the hell?

You're PHP pros here, tell me something, how can I "turn off" php without httpd.conf by messing up php.ini?
Post Reply