Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
May 24, 2012, 12:07:36 PM

Pages: [1]   Go Down
  Print  
Author Topic: PHP script limit time  (Read 2136 times)
misterf
Trekkie
**
Offline Offline

Posts: 10


WWW
« on: September 07, 2011, 10:49:08 AM »

Hello,

I have a static MySQL database that I use a PHP script to search. On rare occasions, the script runs away, starts hogging resources and making Lunarpages support very, very unhappy campers.

I want to restrict the time limit that the script runs (and add anything else that would help alleviate this problem). I've created the following .htaccess and php.ini files, but it doesn't seem to work!

Any help, comments, and direction would be appreciated. Thanks!


# AddHandler application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml
AddType application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml
suPHP_ConfigPath /home/sf/public_html/archives/php.ini

[PHP]

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

max_execution_time = 5     ; Maximum execution time of each script, in seconds
max_input_time = 5         ; Maximum amount of time each script may spend parsing request data
memory_limit = 1M          ; Maximum amount of memory a script may consume

Logged
MrPhil
Senior Moderator
Berserker Poster
*****
Offline Offline

Posts: 5215



« Reply #1 on: September 07, 2011, 05:31:50 PM »

Your suPHP_ConfigPath is wrong. Omit the /php.ini:
Code:
suPHP_ConfigPath /home/sf/public_html/archives
Logged

Visit My Site

E-mail Me
  
-= From the ashes shall rise a sooty tern =-
misterf
Trekkie
**
Offline Offline

Posts: 10


WWW
« Reply #2 on: September 08, 2011, 09:48:18 AM »

Ah, okay, I fixed the ConfigPath. Still doesn't seem to work though.  I've even adjusted the max execution time to 1 second to practically force a script shut down, but to no avail.

(Note that I have the .htaccess and php.ini file in that ConfigPath directory. I have presumed that's where they should be.)

Also, would fiddling with MySQL persistent connections solve my overall problem?
Logged
MrPhil
Senior Moderator
Berserker Poster
*****
Offline Offline

Posts: 5215



« Reply #3 on: September 08, 2011, 03:43:59 PM »

(Note that I have the .htaccess and php.ini file in that ConfigPath directory. I have presumed that's where they should be.)
Assuming that the code (pages) you're running are in /archives, the .htaccess should be read and processed. You might confirm that .htaccess and php.ini are being read, by running the following script:
Code:
<?php phpinfo(); ?>
and see if changes you make to PHP settings show up. If they don't, something's wrong. Of course, this script must be in /archives, along with the PHP code you're trying to run.

Quote
Also, would fiddling with MySQL persistent connections solve my overall problem?
I doubt it, but that's not my area of expertise. Usually I think you would get an inability to connect or maybe a 500 error.
« Last Edit: September 08, 2011, 03:46:41 PM by MrPhil » Logged

Visit My Site

E-mail Me
  
-= From the ashes shall rise a sooty tern =-
Pages: [1]   Go Up
  Print  
 
Jump to: