我正在使用Codeigniter。
我的项目在Codeigniter的开发环境中运行良好,但是当我切换到生产环境时,它会显示空白页面。
现在,我尝试打印所有错误消息,但是它确实显示了任何错误消息!
即使我试图查看错误日志,但也不会显示任何错误或警告。
我试图显示所有错误和警告,以便我可以解决它们。
ini_set('display_errors', 1);
在我的开发环境中,即使在我的Linux apache控制台中也没有错误,但是当我切换到生产环境时,它只会显示空白页面!
我该如何调试呢?
我的代码:
define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'production');
/*
*---------------------------------------------------------------
* ERROR REPORTING
*---------------------------------------------------------------
*
* Different environments will require different levels of error reporting.
* By default development will show errors but testing and live will hide them.
*/
switch (ENVIRONMENT)
{
case 'development':
error_reporting(-1);
ini_set('display_errors', 1);
break;
case 'testing':
case 'production':
ini_set('display_errors', 0);
if (version_compare(PHP_VERSION, '5.3', '>='))
{
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
}
else
{
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
}
break;
default:
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
echo 'The application environment is not set correctly.';
exit(1); // EXIT_ERROR
}
if (defined('ENVIRONMENT'))
{
switch (ENVIRONMENT)
{
case 'development':
error_reporting(E_ALL);
break;
case 'testing':
case 'production':
error_reporting(0);
break;
default:
exit('The application environment is not set correctly.');
}
}
最佳答案
您需要验证一些东西:
I am here
,并查看它是否打印而不是空白页.htaccess
关于php - 没有PHP错误,codeigniter仍然显示空白页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53612280/