LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-14-2020, 06:51 PM   #1
Pedroski
Senior Member
 
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 18.04
Posts: 1,778

Rep: Reputation: 67
Where does the php error log get writ?


I am reading a book PHP & MySQL: Novice to Ninja by Kevin Yank, doing some simple stuff with php to begin with.

On my little homework web page, on GoDaddy, I keep my php files for each class in a subdirectory aptly named php.

php automatically writes an error log there, for each class, in the php directory.

Now, I have this laptop set up with apache2, php and mysql, so I can learn a bit more and try it out at home first.

Yesterday, for example, there was an error: $firstname was written $firstName, so no output.

Where does php write its error log now?

How can I set php to write an error log in /var/www/html/php/ ??

That will help when things get more complicated.
 
Old 01-14-2020, 07:01 PM   #2
boughtonp
Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 119

Rep: Reputation: 62
If you're running PHP via Apache it'll probably be in Apache's error logs, which might be /var/log/httpd/error_log (can vary depending on how Apache was setup).

Here's the relevant config docs for changing it:
https://www.php.net/manual/en/errorf...#ini.error-log
 
Old 01-14-2020, 08:22 PM   #3
Pedroski
Senior Member
 
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 18.04
Posts: 1,778

Original Poster
Rep: Reputation: 67
Thanks, it is in /var/log/apache2/error.log

Would you happen to know how can I tell apache2 to save the error.log in /var/www/html/php??
 
Old 01-14-2020, 08:46 PM   #4
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.7.1908
Posts: 4,248

Rep: Reputation: 1483Reputation: 1483Reputation: 1483Reputation: 1483Reputation: 1483Reputation: 1483Reputation: 1483Reputation: 1483Reputation: 1483Reputation: 1483
Quote:
Originally Posted by Pedroski View Post
Thanks, it is in /var/log/apache2/error.log

Would you happen to know how can I tell apache2 to save the error.log in /var/www/html/php??
You can manage that in the httpd.conf — but consider that putting your log files inside your web space might not be the best way to do things. Just sayin’

When I’m developing I open a terminal window and run tail -f on the error log. That way I can follow errors “real time” as I fire requests from the browser.

Last edited by scasey; 01-14-2020 at 08:48 PM.
 
1 members found this post helpful.
Old 01-14-2020, 08:47 PM   #5
Pedroski
Senior Member
 
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 18.04
Posts: 1,778

Original Poster
Rep: Reputation: 67
@scasey Thanks, but I'm only tinkering on this old laptop, nothing too serious, nothing public.

Just got to the chapter about using mysql to generate webpages! Yeah!



I looked in /etc/apache2

There is a file envar

I changed
Quote:
export APACHE_LOG_DIR=/var/log/apache2$SUFFIX
Quote:
# changed by me to:
export APACHE_LOG_DIR=/var/www/html/php/$SUFFIX
I forced an error and sure enough, the log is now in /var/www/html/php/

2 other logs are also there, don't know why!

access.log and other_vhosts_access.log

Last edited by Pedroski; 01-14-2020 at 08:51 PM.
 
Old 01-14-2020, 08:50 PM   #6
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.7.1908
Posts: 4,248

Rep: Reputation: 1483Reputation: 1483Reputation: 1483Reputation: 1483Reputation: 1483Reputation: 1483Reputation: 1483Reputation: 1483Reputation: 1483Reputation: 1483
access.log is the log of requests and responses that had no errors.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to log internal-sftp chroot jailed users access log to /var/log/sftp.log file LittleMaster Linux - Server 0 09-04-2018 04:45 PM
[SOLVED] Apache2 does NOT display site, does NOT error_log, DOES download the index.php to ~/Downloads SeaPhor Linux - Server 4 03-15-2018 03:20 PM
Opennms Logs - where are web.log, web_rtc.log and webauth.log referenced? not_much_of_a_guru Linux - Networking 0 07-12-2006 11:28 AM
I really can't do this w/out ur sample code in C nature language, please help me writ cigarstub Programming 2 02-16-2006 08:31 AM
LXer: MFI stumbles over SAP writ LXer Syndicated Linux News 0 02-04-2006 12:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration