xenonite
xenonite

Reputation: 1671

apache 2.2 (ubuntu) won't let me set php error reporting via .htaccess?

i have a problem with my server which is running ubuntu (debian) linux and apache 2.2/php 5.2

as this is mainly a productive server, display_errors is turned OFF in the php.ini

for development purposes, i want to enable these error reporting stuff for certain domains. but when i set

php_flag display_errors on

in the .htaccess file of the test-domain, it simply wont work :( so i have to set display_errors in the php.ini which affects ALL websites on the server... how can is set this locally for ONE domain?

Upvotes: 1

Views: 1760

Answers (2)

Marc B
Marc B

Reputation: 360702

Is AllowOverride enabled in your vhost? If it's set to 'None', then Apache will utterly ignore .htaccess files.

Upvotes: 1

Álvaro González
Álvaro González

Reputation: 146460

You cannot provide PHP directives in an .htaccess file unless PHP runs as Apache module. Is that the case? If so, first make sure the file is actually being read. A quick test you can do is to make a syntax error on purpose in the .htaccess file: your site should return a 500 error message. If you are running PHP as CGI, you probably have a custom php.ini file somewhere for each user.

Last but not least, you can enable error reporting in a per-application basis. Just add this code on top:

<?php

ini_set('display_errors', 1);
error_reporting(E_ALL);

?>

Upvotes: 2

Related Questions