我正在寻找一种在lighttpd上单独配置虚拟主机以显示或不显示错误和警告的方法。
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
我喜欢从虚拟热点配置中创建它。
$HTTP["host"] =~ "domain1'.com" {
server.document-root = "/home/lighttpd/domain1.com/http"
accesslog.filename = "/home/lighttpd/domain1.com/logs/access.log"
php_flag display_errors On ....???
}
如果你尝试上面的代码,你会得到以下错误
root@web:~/lighttpd# /etc/init.d/lighttpd restart
2014-02-05 11:23:54: (configfile.c.932) source: /usr/share/lighttpd/mysql_vhost.py line: 8 pos: 24 parser failed somehow near here: display_errors
2014-02-05 11:23:54: (configfile.c.932) source: /etc/lighttpd/lighttpd.conf line: 32 pos: 1 parser failed somehow near here: (EOL)
是否有其他方式从lighttpd内部与PHP对话?PHP是作为模块加载的。应该是一个
不确定,我们正在寻找这样的东西
<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/domains/example.com/html
ErrorLog /var/www/domains/example.com/apache.error.log
CustomLog /var/www/domains/example.com/apache.access.log common
php_flag log_errors on
php_flag display_errors on
php_value error_reporting 30719
php_value error_log /var/www/domains/example.com/php.error.log
</VirtualHost>
使用30719
的原因如下
除PHP 5.4.0. 32767 in PHP 5.4.x
, 30719 in PHP 5.3.x
, 6143 in PHP 5.2.x
, 2047
之前的E_STRICT
级别外,支持的所有错误和警告。请点击此处阅读。
可以使用
php_value error_reporting 2147483647
上面的数字,根据文档应该启用'所有'错误,无论版本,如果你想要一个更细粒度的设置,手动或值在一起,或运行
或见下文
php_value error_reporting 6143 # for all errors notice, warnings, etc
php_value error_reporting 6135 #show warnings less strict
如果PHP在lighttpd下作为模块运行,那么您可以在虚拟主机配置中放入以下代码:-
php_flag display_errors off