When transferring from one server to another site stopped working. The server gives 500 response. And on the same server there are other sites on php that work fine.

In the logs the following:

[Tue Aug 11 20:50: 59.040653 2015] [cgi: error] [pid 10354] [client 127.0.0.1Cl1431] End of script output before headers: php

What could be the reason?

  • Maybe cgi is prohibited? - ModaL
  • @alexanderbarakin, 123 displayed. If the problem is in the site scripts, why did they work normally on the previous hosting? - Tyler
  • I don't know, maybe it matters. Identifiers [pid 10354] in the error log are always recorded with different. - Tyler
  • @ModaL, no cgi allowed - Tyler 7:49 pm
  • @alexanderbarakin, the fact is that the scripts were almost not edited, I even tried to do the installation from 0, I tried to run them out of the box before my intervention. - Tyler

2 answers 2

  1. first create some kind of test file

    <?php echo 123; 

    name it, for example, test123.php , place it in the docroot site and access it from a browser: http://ваш.сайт/test123.php .

    if line 123 displayed, then most likely there are problems with the contents of php scripts.

  2. The problem may arise, for example, because some of the scripts loaded at the very beginning ( index.php , some plug-in configuration files) were “crookedly fixed” and “garbage” got into it.

    for example, some bom- s at the very beginning, or spaces - before the starting characters <?php , or after the final characters ?> .

    bom s (and “extra” spaces) can be seen, for example, using the command:

     $ hexdump -C путь/к/файлу | less 
  3. How does the request processing begin, for example, to the root? with index.php ? add at the beginning of the script (after <?php ) a line like

     echo случайное.число; exit; 

    if you get output in the form of this random number , move this line further (and deeper into the included files) until you find the “culprit” (file and line) that generates an error.

    in order to speed up the process a little, after the test at the beginning of the file, you can immediately insert a line at the end, and then (if there is an error) return “back” by the “half division” method.

  • +1 for a logical consistent presentation - userlond

Check server settings. File .htaccess try to delete or clean. It is likely that there may be a problem.

With a similar error, what else they say:

This may mean that the file is in DOS format. This can happen if you download a file via ftp from a computer running Windows in binary mode. (You shouldn't use ftp at all.)

( http://en.perlmaven.com/perl-cgi-script-with-apache2 )