Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

php.ini not getting applied

Status
Not open for further replies.

TheDust

Programmer
Aug 12, 2002
217
US
Can someone explain to me the steps to get a php.ini file to apply to an entire sie? I've been looking for the rules but haven't had luck so far. Does a php.ini apply to all files in subdirectories as well?

I know it's not being applied because I'm trying to change the max_execution_time. It's not happening. I have my php.ini file in the root of my site, but a file in a subdirectory isn't getting the settings applied.

Any ideas? Help would be much appreciated... thanks!!
 
What operating system and web server are you using ?

--------------------------------------------------------------------------
I never set a goal because u never know whats going to happen tommorow.
 
The Operating system is Linux and the webserver is Apache.
 
Question:
How do you know that the max execution time doesn't get applied?

Don't be fooled - it could be the web server who doesn't keep the connection alive long enough.
 
Every runtime configuration directive in php.ini applies to every script running on that server. However, it is possible to locally override the global settings. If you are running PHP as an Apache module you can use the php_value, php_flag, php_admin_value and php_admin_flag settings (link) within an Apache "<Directory>" tag in httpd.conf or .htaccess to make a different setting apply to a particular directory tree. You can also override settings in the run of a single script with ini_set().

If you want to see the values as they are set, run a script which consists of:

<?php
phpinfo();
?>


But to ask the dumb question, if you are running PHP as an Apache module, did you restart Apache after making the change to php.ini?



Want the best answers? Ask the best questions!

TANSTAAFL!!
 
DRJ478 - I know the max execution time isn't getting applied because I continue to get the following PHP error: "Fatal error: Maximum execution time of 30 seconds exceeded" (I'm trying to set it higher than 30)

sleipnir214 - I am working with a remote server and I don't have the option to restart it... is that necessary to get customized php.ini values applied? I've looked at other settings I thought I changed long ago, but when I run phpinfo() I am not seeing any of these settings applied at all...
 
I have noticed one thing: I have my php.ini file in the root of my site, but a file in a subdirectory isn't getting the settings applied.

I'm 99% sure that php doesn't use this file (in the root of the site).

To see what file is used, do a small script:
Code:
<?php
phpinfo();
?>

This will generatte a page which shows you the right path to php.ini file.
Also here you can see the value of "max_execution_time", just do a search.

One more thing: after modifying php.ini, do a apache restart: "apachectl restart" .

Good luck!



___
____
 
Thanks for the responses everyone...

I got the web server restarted but max_execution_time is still showing up as the default value (30)... I'm trying to set it to 300. The following is the line in my php.ini file:

max_execution_time = 300

The php.ini file is located in my web root and in the same location as the file with the phpinfo() call inside of it. It is still showing the default values.

Does anyone know what could be going wrong? Do I need to start using php_ini() on every page as an alternative? If you're interested in the default server settings, you can check this out:
Any help would be appreciated... thanks in advance!!
 
Just to ask the dumb question, your phpinfo() output says that the php.ini file PHP is using is at /usr/local/Zend/etc/php.ini. Is that the file you're editing?

I once fought a similar problem for several hours until I realized I was editing the wrong copy of php.ini.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
The php.ini file used by apache is /usr/local/Zend/etc/php.ini , you shoud edit this one.
Not /home/kbamllc/public_html/php.ini , where I see that you have set:
...
max_execution_time = 300 ; Maximum execution time of each script, in seconds
max_input_time = 60 ; Maximum amount of time each script may spend parsing request data
memory_limit = 8M ; Maximum amount of memory a script may consume (8MB)
...


So, esit /usr/local/Zend/etc/php.ini , and restart apache.


___
____
 
BTW: if you can not edit /usr/local/Zend/etc/php.ini (You are not root on the machine), you can use set_time_limit() .

You have to keep in mind that set_time_limit() has no effect when PHP is running in safe mode.
Lucky you I saw that in php.ini the safe_mod is Off, so you can use this function.



___
____
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top