error_log per Virtual Host?

后端 未结 11 1783
独厮守ぢ
独厮守ぢ 2020-12-02 07:58

On one Linux Server running Apache and PHP 5, we have multiple Virtual Hosts with separate log files. We cannot seem to separate the php error_log between virtu

相关标签:
11条回答
  • 2020-12-02 08:21

    Yes, you can try,

    php_value error_log "/var/log/php_log" 
    

    in .htaccess or you can have users use ini_set() in the beginning of their scripts if they want to have logging.

    Another option would be to enable scripts to default to the php.ini in the folder with the script, then go to the user/host's root folder, then to the server's root, or something similar. This would allow hosts to add their own php.ini values and their own error_log locations.

    0 讨论(0)
  • 2020-12-02 08:23

    Don't set error_log to where your syslog stuff goes, eg /var/log/apache2, because they errors will get intercepted by ErrorLog. Instead, create a subdir in your project folder for logs and do php_value error_log "/path/to/project/logs". This goes for both .htaccess files and vhosts. Also make sure you put php_flag log_errors on

    0 讨论(0)
  • 2020-12-02 08:25

    Create Simple VirtualHost:

    example hostname:- thecontrolist.localhost

    1. C:\Windows\System32\drivers\etc

      127.0.0.1 thecontrolist.localhost in hosts file

    2. C:\xampp\apache\conf\extra\httpd-vhosts.conf

      <VirtualHost *>
        ServerName thecontrolist.localhost
        ServerAlias thecontrolist.localhost
        DocumentRoot "/xampp/htdocs/thecontrolist"
        <Directory "/xampp/htdocs/thecontrolist">
          Options +Indexes +Includes +FollowSymLinks +MultiViews
          AllowOverride All
          Require local
        </Directory>
      </VirtualHost>
      
    3. Don't Forget to restart Your apache. for more check this link

    0 讨论(0)
  • 2020-12-02 08:29

    You can try:

        <VirtualHost myvhost:80>
           php_value error_log "/var/log/httpd/vhost_php_error_log"
        </Virtual Host>
    

    But I'm not sure if it is going to work. I tried on my sites with no success.

    0 讨论(0)
  • 2020-12-02 08:30

    I usually just specify this in an .htaccess file or the vhost.conf on the domain I'm working on. Add this to one of these files:

    php_admin_value error_log "/var/www/vhosts/example.com/error_log"
    
    0 讨论(0)
提交回复
热议问题