简体   繁体   中英

Force defined php.ini log file

php.ini:

error_log = /var/log/php.log

Running on shell:

php@> error_log("test"); 
// WRITES TO /var/log/php.log

Running on apache index.php:

error_log("test"); 
// WRITES to apache/error_log

Apache 2.4.6 / Php 5.4.16

  • I already checked for alternative php.ini files

  • What i need is the apache directive that controls it, already looked in the man page.

  • Already checked permissions and file ownership

You may set this path directly from the PHP code. For example:

ini_set("log_errors", 1);
ini_set("error_log",$_SERVER['DOCUMENT_ROOT']."/logs/php-error.log");

我的新vps启用了SELinux,因此我必须将此attr添加到文件中

sudo chcon -t httpd_log_t php.log

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM