Answer the question
In order to leave comments, you need to log in
How to fix white screen on custom cms?
Good afternoon everyone.
I am transferring now one site to my local server. Downloaded the directory, the database.
Found a file where the path to the database is written. Registered. Climbed into the database, looked for a field similar to wordpress databases, where the domain name is written. Didn't find anything like it.
It seems to be everything, but the site gives a 500 error. Removed .htaccess. Now it only shows a white screen. What else needs to be done or how can I find out what I did wrong?
Answer the question
In order to leave comments, you need to log in
Enabling the output of all errors and warnings in the php.ini file
error_reporting = E_ALL
display_errors = On
display_startup_errors = On
Enabling the output of all errors and warnings in the PHP script code
You can enable the output of notifications and warnings by adding the following lines to the beginning of the desired .php file:
ini_set( 'error_reporting', E_ALL);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
Enabling the output of all errors and warnings in the .htaccess file
php_value display_errors 1
php_value display_startup_errors 1
php_value error_reporting E_ALL
PHP has an extremely useful register_shutdown_function() function that will help you deal with errors. But do not forget that only you should see error messages, and not everyone in a row when entering the site. Here is an example:
<?
register_shutdown_function( "fatal_handler" );
function fatal_handler() {
$errfile = "unknown file";
$errstr = "shutdown";
$errno = E_CORE_ERROR;
$errline = 0;
$error = error_get_last();
if( $error !== NULL) {
$errno = $error["type"];
$errfile = $error["file"];
$errline = $error["line"];
$errstr = $error["message"];
echo format_error( $errno, $errstr, $errfile, $errline);
}
}
function format_error( $errno, $errstr, $errfile, $errline ) {
$trace = print_r( debug_backtrace( false ), true );
$content = '<table style="background-color: #FFFFFF;margin: 0 auto;">
<thead><th style="width: 100px;">Item</th><th>Description</th></thead>
<tbody>
<tr>
<th>Error</th>
<td><pre>'.$errstr.'</pre></td>
</tr>
<tr>
<th>Errno</th>
<td><pre>'.$errno.'</pre></td>
</tr>
<tr>
<th>File</th>
<td>'.$errfile.'</td>
</tr>
<tr>
<th>Line</th>
<td>'.$errline.'</td>
</tr>
<tr>
<th>Trace</th>
<td><pre>'.$trace.'</pre></td>
</tr>
</tbody>
</table>';
return $content;
}
class PHPFatalError
{
public function set_handler() {
register_shutdown_function(array($this, 'handle_shutdown'));
}
public function handle_shutdown() {
if (($error = error_get_last())) {
// echo сообщения о деталях ошибки
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question