skip to Main Content

i have a developement dir on my server but i dont have root access so i cant change which php ini file loads. I ask my host if they would set things up so that i could have a custom php ini file but they dont allow that.

I am always having to go all the way back to the public dir to check the error log file during development. I would like to force the dev folder to create its own error log file. Is there a way to do this without root access. I just want to be able to check errors in the dev dir because its faster to check them.

I have already added a php.ini file to my dev dir. And inside that php ini file i have the error log location code

  ;just for testing
  error_reporting = E_ALL

  error_log = '/home/xxxxxxxx/public_html/xxxxxxxxx/xxxxxxx_dev/error_log'

but its probably not doing anything as they dont allow those. Can i do this with htaccess? or is there another way to do this for a local error log?

I am on a linux apache machine.

3

Answers


  1. Chosen as BEST ANSWER

    This worked in the .htaccess file...

    enable PHP error logging

    php_flag log_errors on php_value error_log /home/xxxxxxxxx/xxxxxxx/xxxxxxxxx/xx_dev/error_log


  2. You can use set_error_handler() to change system default behavior.

    function myErrorHandler($errno, $errstr, $errfile, $errline)
    {
        // do something
    }
    
    set_error_handler('myErrorHandler');
    
    Login or Signup to reply.
  3. You can set error_log file in .htaccess, for example

    # enable PHP error logging
    php_flag  log_errors on
    php_value error_log  /home/path/public_html/domain/PHP_errors.log
    

    This file should be writable for apache process user (www-data, apache – see apache config).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search