David
David

Reputation: 16726

Specify a relative path to 'php_value error_log'

Rather than put the absolute path to an error_log in my .htaccess, I would like to find a way to specify it relative to the .htaccess file (or similar):

php_value error_log %{DOCUMENT_ROOT}/libs/log/error/PHP_errors.log

It would be something like I would want to do, but this doesn't seem to work. If I specify the absolute, it does work.

Upvotes: 7

Views: 6198

Answers (2)

Radon8472
Radon8472

Reputation: 4951

When you have access to the server-config httpd.conf file, you can add the Line:

# set this to your document-root path
Define DOCROOT   "d:\htdocs"

and in your htaccess you can write:

php_value error_log ${DOCROOT}/libs/log/error/PHP_errors.log

With this define you can even replace all other places where your document root is use e.g.

DocumentRoot "${DOCROOT}"

@see: https://httpd.apache.org/docs/2.4/de/mod/core.html#define

Upvotes: 2

jexact
jexact

Reputation: 541

You can set it to ./path/error.log.

Upvotes: 4

Related Questions