Where PHP Error Log file located in XAMPP localhost and live CENT OS 6 Server?

where PHP Error Log file located in XAMPP localhost and live CENT OS 6 Server?

Also files keep passwords eg databases etc must be outside public reach in web server? how access from my php code, a such file outside web root public dir? cent os 6, LAMPP…

There are some XAMPP error logs in apache > logs
Unless you have a VPS I believe the only error logs you can view are the ones in the individual folders. You may to be able to download some logs above root in the logs folder, I think it depends on how the hosting is setup.

To include a file above root you would use something like: include ‘/home/user/folder/file.php’;
You can setup a folder path in your php code with set_include_path but that never worked for me on a shared server.I have setup a folder in the php.ini file on my VPS which works well.

Try this:



echo '<br /><br />Error_log Stuff: <br />';

$newErrorLog = __DIR__  .'/ERROR_LOG_IS_NOW_IN_THIS_DIR.PHP';
$newErrorLog = getcwd() .'/ERROR_LOG_IS_NOW_IN_THIS_DIR.PHP';

echo '<br /><br />GET OLD: ', // SET
    ini_get( 'error_log' ); // NO PARAMETERS

echo '<br /><br />SET NEW and GET OLD: ', // SET
    $oldErrorLog = ini_set( 'error_log', $newErrorLog );

echo '<br /><br />SHOW NEW: ', 
    ini_get( 'error_log' ); // NO PARAMETERS

echo '<br /><br />FORCE (and display) ERROR: ', 
    $forceError = $divideByZero / 0;

if( file_exists($newErrorLog) && filesize($newErrorLog) )
{
  echo '<br /><br />file_size(file_size($newErrorLog): ',   
      filesize($newErrorLog);

  $str = file_get_contents( $newErrorLog ) ;
  echo '<br /><br />CONTENTS of $newErrorLog: <br />', 
    nl2br( $str );

}

die;


Output:

Error_log Stuff:

GET OLD: /opt/lampp/logs/php_error_log

SET NEW and GET OLD: /opt/lampp/logs/php_error_log

SHOW NEW: /opt/lampp/htdocs/localhost/sp-test/ERROR_LOG_IS_NOW_IN_THIS_DIR.PHP

FORCE (and display) ERROR:
Notice: Undefined variable: divideByZero in /opt/lampp/htdocs/localhost/sp-test/sp-test.php on line 22

Warning: Division by zero in /opt/lampp/htdocs/localhost/sp-test/sp-test.php on line 22

file_size(file_size($newErrorLog): 1256

CONTENTS of $newErrorLog:
{26-Apr-2014 17:50:19 Europe/Berlin} PHP Notice: Undefined variable: divideByZero in /opt/lampp/htdocs/localhost/sp-test/sp-test.php on line 22
{26-Apr-2014 17:50:19 Europe/Berlin} PHP Warning: Division by zero in /opt/lampp/htdocs/localhost/sp-test/sp-test.php on line 22
{26-Apr-2014 17:50:19 Europe/Berlin} PHP Fatal error: Call to undefined function file_size() in /opt/lampp/htdocs/localhost/sp-test/sp-test.php on line 24

Have you set ip any virtual host. If so you can actually set the location of the error log…