Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
267 views
in Technique[技术] by (71.8m points)

php - Find out the error_log's path

I have this domain.com pointed to /home/username/public_html/domain.com.

I added these lines to the .htaccess file:

ErrorDocument 500 /oohps.php
ErrorDocument 404 /where.php

So I can show some styled template.

The problem is that when trying to access a nonexisting page, I get an additional internal server error, so these files are not opened.

I wanted to check for the logs, but I cannot find the error log in that path (/home/username/public_html/domain.com).

I found one in /var/log/httpd, but I don't think it’s the right folder, because there are many errors not involved with this page and I didn't see any involved.

Is there a PHP function that would output the errors log file path?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

An internal server error has often something to do with Apache and /var/log/httpd/ is the error log file of Apache, so I think you are in the right file.


The error path is set in php.ini. To get the path use ini_get():

<?php
  $errorPath = ini_get('error_log');
?>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...