Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 10th February 2012, 02:42
holykim holykim is offline
Member
 
Join Date: Jan 2009
Posts: 53
Thanks: 15
Thanked 3 Times in 2 Posts
Default Infinite loop caused by a crappy code in PHP

Hi

Due to crappy code by one of my users, PHP entered an infinite loop generating an error, causing very high load on the server and gigantic log files.

Unfortunately the fail2ban gets taking 100% CPU too with the log files which increasing more and more.

I did set ignore_repeated_errors to On, as well as ignore_repeated_source in php.ini. I checked that the settings is effective in phpinfo() but it doesn't help.

Is there anyone can help me to be able to keep the server resources from this kind of crappy code?

I am running ISPConfig 3 on CentOS

Thanks
Reply With Quote
Sponsored Links
  #2  
Old 10th February 2012, 08:19
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 36,034
Thanks: 826
Thanked 5,383 Times in 4,230 Posts
Default

You can e.g. reduce the max execution time in php.ini.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #3  
Old 10th February 2012, 09:12
holykim holykim is offline
Member
 
Join Date: Jan 2009
Posts: 53
Thanks: 15
Thanked 3 Times in 2 Posts
Default

Hi Till

Thank you for your reply.

A log file is being increased as several hundreds megabyte in 10~20 seconds. Also the error won't be stopped by max_execution_time.

For example, the zip.db file doesn't exist in the code below, PHP will generate gigantic log files and won't be stopped itself. Just imagine that people open the webpage at the same time.... Please advise.

PHP Code:
$fp fopen("./zip.db""r");
while(!
feof($fp)) {
    
$zipfile[] = fgets($fp4096);

Reply With Quote
  #4  
Old 10th February 2012, 09:48
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 36,034
Thanks: 826
Thanked 5,383 Times in 4,230 Posts
Default

There are severaloptions, if the errors are no fatal errors, then you might change the error_reporting level to include only fatal errors and not e.g. warnings in the log. Another option can be to turn of php error logging and display errors only in the webpage or you define a separate error_log for php in php.ini which is not monitored by fail2ban.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
Reply

Bookmarks

Tags
fail2ban, php

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Only Problems since Updating from 3.0.3.3 to 3.0.4.1 mbay General 4 17th May 2012 12:56
ubuntu and nginx delgado2061 Installation/Configuration 0 27th November 2011 23:36
Problem with services!! banzaiwebstudio.com Installation/Configuration 7 19th May 2010 21:13
Unable to install ISPConfig bdonecker Installation/Configuration 21 26th May 2009 08:20
Apache2 Freezes celtic Server Operation 31 28th May 2007 17:18


All times are GMT +2. The time now is 08:44.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.