I have such a problem with one site, I go to the site and start clicking on the links - sometimes the page is displayed normally, and sometimes just a white page opens (empty), if you press Ctrl + U to see the HTML code, then it’s just empty. And sometimes you have to press F5 several times to display the page. I look at the Apache server logs - but it's empty, this error is not displayed in the logs. And the server where the site is very powerful (Top percent Core i7 + 32GB RAM DDR3 2400Mhz) What should I do? How to get rid of such a glitch?

UPD: Error reporting is enabled in the php.ini file. But what is most interesting is that even when the server issues a blank page, the HTTP server response is this:

Request URL: http://travianx5.ru/dorf2.php Request Method:GET Status Code:200 OK Request Headersview source Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Accept-Encoding:gzip,deflate,sdch Accept-Language:ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4 Connection:keep-alive Cookie:t3l=1; PHPSESSID=66m7fqbmi75kvaadtm2v8mhn17; COOKUSR=spoilt Host:travianx5.ru Referer: http://travianx5.ru/spieler.php?uid=6 User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.76 Safari/537.36 Response Headersview source Connection:Keep-Alive Content-Length:0 Content-Type:text/html Date:Wed, 29 Jan 2014 14:14:37 GMT Keep-Alive:timeout=5, max=100 Server:Apache/2.4.6 (Ubuntu) X-Powered-By:PHP/5.5.3-1ubuntu2.1 

That is, the type is all OK, but how can this be? There is silence in the logs too, there is no 500th error, only Warning'i ...

Here is the Apache server error log for today's date:

  PHP Warning: include(): Failed opening '22_0.tpl' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/Templates/Build/22.tpl on line 9, referer: http://travianx5.ru/dorf2.php [Wed Jan 29 04:16:34.137593 2014] [:error] [pid 3276] [client 192.168.1.1:54750] PHP Warning: unlink(GameEngine/Prevention/market.txt): No such file or directory in /var/www/GameEngine/Automation.php on line 991, referer: http://travianx5.ru/dorf2.php [Wed Jan 29 09:28:04.700181 2014] [:error] [pid 4225] [client 188.235.65.219:53207] PHP Warning: unlink(GameEngine/Prevention/cleardeleting.txt): No such file or directory in /var/www/GameEngine/Automation.php on line 457, referer: http://travianx5.ru/dorf1.php [Wed Jan 29 11:38:05.420588 2014] [core:error] [pid 4500] [client 86.57.255.92:20043] AH00126: Invalid URI in request \xa3{(i\xc0\xb2hy\xa4\x84\xba\bq/\b7\x0c\xfcV\xbe 

Here is the file .htaccess, which lies in the root of the site:

 <Files "*.tpl"> Order Deny,Allow Deny from all </Files> 

Most likely, yes, everything goes through this file:

 if(isset($_POST)){ if(!isset($_POST['ft'])){ $_POST = @array_map(array($database->connection, 'real_escape_string'), $_POST); $_POST = array_map('htmlspecialchars', $_POST); } } $rsargs=$_GET['rsargs']; $_GET = array_map(array($database->connection, 'real_escape_string'), $_GET); $_GET = array_map('htmlspecialchars', $_GET); $_GET['rsargs']=$rsargs; $_COOKIE = array_map(array($database->connection, 'real_escape_string'), $_COOKIE); $_COOKIE = array_map('htmlspecialchars', $_COOKIE); ?> 
  • 3
    Content-Length: 0 - well, as if it hints that the output does not start, try to include the output of all errors in the browser (but it’s better to log, of course, if the site is visited) And you write about Warning, you can, suddenly what interesting people will see - MDJHD
  • Updated question, added server logs Apache ... - spoilt
  • Strange, but your ban does not work: <Files "* .tpl"> Order Deny, Allow Deny from all </ Files> Files are accessible from the outside On my site, when I try to access files with the .inc extension that are prohibited in this way, I get 403 errors, you have the source code - MDJHD
  • one
    travianx5.ru/Templates click on the link, I think this is not something that everyone should see. Corrects, as I wrote below in the line with the line -Indexes in .htaccess, try it! - MDJHD
  • Yes, it is necessary to forbid going there directly from the browser :) - zb '

3 answers 3

Those. everyone read the log and did not notice anything?

 [Wed Jan 29 04:16:34.137593 2014] [:error] [pid 3276] [client 192.168.1.1:54750] PHP Warning: unlink(GameEngine/Prevention/market.txt): No such file or directory in /var/www/GameEngine/Automation.php on line 991, referer: http://travianx5.ru/dorf2.php 
  • So you think this is the whole reason? - spoilt
  • PHP Warning: include (): Failed opening '22_0.tpl' for inclusion (include_path = '.: / Usr / share / php: / usr / share / pear') in /var/www/Templates/Build/22.tpl on line 9, referer: travianx5.ru/dorf2.php and here it shows that it cannot connect the template. Check for files. - terantul
  • I have the file "22_0.tpl" in the project, now I'll check the ways ... - spoilt
  • 2
    [ unlink ] [1] - Deletes file [1]: php.net/manual/ru/function.unlink.php - VenZell
  • Templates / Build / 22_0.tpl and GameEngine / Prevention / market.txt do not exist at the moment. If they are automatically created and deleted, then look for the problem in the scripts, but since this game script is not yours, then this bug to the developer is possible (unless of course you screwed it up or evil "hackers" :)) - MDJHD

Add logging to the site engine itself. To track in what places the system falls.

  • More specifically, can you advise something? How can you solve such a problem? - spoilt
  • 2
    Try to see for a start the code that should start on the page that you got out empty. Most likely the code crashes with an error before html output and you have disabled error output. Enable error display with the error_reporting (E_ALL) command; at the very top of index.php, but below (if present) the lines session_start () ;. If there is an error in the code, you will see all the information why the page is not displayed. - terantul
  • Updated the question, look, please ... - spoilt
  • one
    I looked. Enable forced error output error_reporting (E_ALL); on page dorf2.php and copy here what will give out. - terantul
  • Added, but still does not give anything! - spoil

List in php.ini

 display_errors on 

and

 error_reporting = 2147483647