Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP.INI: Relative paths?

Tags:

php

I am using a local php.ini file at the root of my website host.

If I put the path "logs/php_error.log" for error_log in php.ini, does it look for a folder called logs in the same folder as php.ini?

The php.ini is located in the root folder (public_host) on my web server. I want to store the errors in a folder located where the php.ini is . How can I write such path in my local php.ini?

/public_html/php.ini
/public_html/logs/php_error.log
like image 604
Peter Lur Avatar asked Apr 09 '14 16:04

Peter Lur


1 Answers

It highly depends on how you are running PHP, since you have not specified this.

Since you are using a local php.ini I assume that you are using suPHP? If yes, then the CWD of a new spawned process by suPHP resides inside the folder where the script is being called. So if you put a relative path in php.ini, it will be relative to the location of the script launched by Apache (eg. if you put it simply like "error_log", it will create an error_log file in the same directory with the script that was executed by Apache). Using suPHP, I guess it is highly recommended to just use an absolute path.

like image 171
Florin Asăvoaie Avatar answered Sep 23 '22 14:09

Florin Asăvoaie