PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, November 14, 2022

[FIXED] Why would logging of PHP errors stop?

 November 14, 2022     apache, nginx, php, plesk     No comments   

Issue

Using Plesk with Apache and Nginx together on Centos.

Errors were being logged perfectly on;

/var/www/vhosts/example.com/logs/error_log

/var/www/vhosts/example.com/logs/proxy_error_log

I truncated the files by deleting and recreating them; now nothing is logged. File owner and the file permissions are all the same; but error logging has just stopped.

I check the other domains, they all perfectly work as supposed.


Solution

Actually web server logs are stored in /var/www/vhosts/system/example.tld/logs/.

Log files in /var/www/vhosts/example.tld/logs/ it's not a files but hardlinks to files in /var/www/vhosts/system/example.tld/logs/. Pay attention for same inode number 261064:

# ls -lia /var/www/vhosts/example.tld/logs/error_log
261064 -rw-r--r--. 2 root root 2432 Jun  8 18:26 /var/www/vhosts/example.tld/logs/error_log
# ls -lia /var/www/vhosts/system/example.tld/logs/error_log
261064 -rw-r--r--. 2 root root 2432 Jun  8 18:26 /var/www/vhosts/system/example.tld/logs/error_log

when I've remove this file I've remove hardlink:

# rm /var/www/vhosts/example.tld/logs/error_log
rm: remove regular file `/var/www/vhosts/example.tld/logs/error_log'? y
# ls -lia /var/www/vhosts/system/example.tld/logs/error_log
261064 -rw-r--r--. 1 root root 2432 Jun  8 18:26 /var/www/vhosts/system/example.tld/logs/error_log

When I've create it again it will has own inode number(276777):

# touch /var/www/vhosts/example.tld/logs/error_log
# ls -lia /var/www/vhosts/example.tld/logs/error_log
276777 -rw-r--r--. 1 root root 0 Jun  8 18:33 /var/www/vhosts/example.tld/logs/error_log

So to solve you issue you just need to remove file you have created and create hardlink to file in system/log:

# rm /var/www/vhosts/example.tld/logs/error_log
# ln /var/www/vhosts/system/example.tld/logs/error_log /var/www/vhosts/example.tld/logs/error_log
# ls -lia /var/www/vhosts/example.tld/logs/error_log
261064 -rw-r--r--. 2 root root 2432 Jun  8 18:33 /var/www/vhosts/example.tld/logs/error_log


Answered By - Oleg Neumyvakin
Answer Checked By - Candace Johnson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing