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

User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Does anything here sound like it could be to blame?
ivj
Forum Commoner
Posts: 31
Joined: Sat Mar 05, 2005 3:07 am

Post by ivj »

No, since phpinfo() displays the path to the file I'm editing, which's the ONLY php.ini file on my filesystem.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

ivj wrote:You're PHP pros here, tell me something, how can I "turn off" php without httpd.conf by messing up php.ini?
If you want to turn PHP 'off', remove the line in your httpd.conf file that tells apache to parse .php files through the PHP parser. Otherwise you will always get php files getting sent to the PHP engine.

Can you post a link to your PHP info page and specify again what exactly it is you are trying to accomplish?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Note: there is an engine off directive that can be set in .htaccess files, if memory serves.
ivj
Forum Commoner
Posts: 31
Joined: Sat Mar 05, 2005 3:07 am

Post by ivj »

Everah wrote:
ivj wrote:You're PHP pros here, tell me something, how can I "turn off" php without httpd.conf by messing up php.ini?
If you want to turn PHP 'off', remove the line in your httpd.conf file that tells apache to parse .php files through the PHP parser. Otherwise you will always get php files getting sent to the PHP engine.
Even if I set Engine=Off in php.ini? I tried that, but like I said, php.ini isn't being read.

"Can you post a link to your PHP info page and specify again what exactly it is you are trying to accomplish?"

There ya go:

http://thailandhaven.com/test.php

And Like I said before, no matter what I do with

Configuration File (php.ini) Path /usr/local/apache2/conf/extra/php.ini

(delete/ modify it with bad syntax, change things in it with right syntax), it's as if that file wasn't read/reloaded whatsoever.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

One last test... try enabling another extension... for example, mysqli. Restart apache and reload the php.ini page to see if that change took effect.

PS | Again, what is it you are trying to accomplish by way of editing your php.ini file?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

What does

Code: Select all

<?php
$inipath = '/usr/local/apache2/conf/extra/php.ini';


echo "<pre>\n";
$path = '';
foreach( explode('/', substr($inipath,1)) as $p ) {
	$path .= '/'.$p;
	if (!file_exists($path)) {
		echo "no such file: $path\n";
	}
	else {
		echo is_dir($path)  ? 'd' :'-',
			is_readable($path)  ? 'r' :'-',
			is_writable($path)  ? 'w' :'-',
			is_executable($path)  ? 'x' :'-',
			" $path\n";
	}
}
$ini = parse_ini_file($inipath, false);
echo "\nentries parsed: ", count($ini), "\n";
foreach( array('engine', 'log_errors', 'error_log', 'error_reporting') as $e) {
	echo $e, ': ', (isset($ini[$e])) ? $ini[$e] : '-undefined-', "\n";
}
echo "</pre>\n";
?>
print?
ivj
Forum Commoner
Posts: 31
Joined: Sat Mar 05, 2005 3:07 am

Post by ivj »

http://thailandhaven.com/test.php

That's what it prints.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

dr-x /usr
dr-x /usr/local
dr-x /usr/local/apache2
dr-x /usr/local/apache2/conf
dr-x /usr/local/apache2/conf/extra
-r-- /usr/local/apache2/conf/extra/php.ini

entries parsed: 149
engine: 1
log_errors: 1
error_log: -undefined-
error_reporting: 2047
Looks good to me.
Now set a value for error_log in /usr/local/apache2/conf/extra/php.ini
e.g.

Code: Select all

error_log=/usr/local/apache2/php.err
restart the apache and run the script again.
ivj
Forum Commoner
Posts: 31
Joined: Sat Mar 05, 2005 3:07 am

Post by ivj »

Hmmm. I get the file does get parsed, look here now: http://thailandhaven.com/test.php

However, I don't see no php.err in that directory...

The reason I'm doing this whole thing was because I was trying to use the PHPMailer library and it was bitching about my timezone not being set, and no matter what I tried, it remained America/New_York, and If I tried setting it in that file, it still wouldn't change....

But still, why don't I see the error log file? It says I Have errors...
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

PHP errors show up in your apache error logs.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

It still says
Configuration
PHP Core
[...]
error_log no value no value
You did restart the apache service?

Probably something like

Code: Select all

/etc/init.d/apache stop
/etc/init.d/apache start
?

edit: ah FC4 ->

Code: Select all

/sbin/service httpd stop
/sbin/chkconfig httpd on
/sbin/service httpd start
ivj
Forum Commoner
Posts: 31
Joined: Sat Mar 05, 2005 3:07 am

Post by ivj »

Actually my apache/logs/error_log is very clean. Ok I don't get this, in my php.ini I have

[Date]
date.timezone = "America/Vancouver"


However, when I check the timezone, I get America_NewYork: http://thailandhaven.com/test.php

The code is:

Code: Select all

echo "<br>Timezone (set as \"America/Vancouver\" in php.ini: <b>".date("e")."</b><br>";
Any idea?
ivj
Forum Commoner
Posts: 31
Joined: Sat Mar 05, 2005 3:07 am

Post by ivj »

volka wrote:It still says
Configuration
PHP Core
[...]
error_log no value no value
You did restart the apache service?

Probably something like

Code: Select all

/etc/init.d/apache stop
/etc/init.d/apache start
?

edit: ah FC4 ->

Code: Select all

/sbin/service httpd stop
/sbin/chkconfig httpd on
/sbin/service httpd start
Huh? Refresh the file, here's what I'm seeing:

entries parsed: 150
engine: 1
log_errors: 1
error_log: /usr/local/apache2/logs/php.err
error_reporting: 2047
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

That's what parse_ini_file returns.
Scroll down to the phpinfo() section - that's what php is bothering about, not some call to parse_ini_file ;)
Post Reply