Title: .htaccess error_reporting with multiple PHP constants
User: newcomerbob
Subject: Configuration and Setting Help
Hello everyone,
I am new to web development and currently facing an issue with configuring my .htaccess file. I am working on a project that requires me to set the error_reporting directive with multiple PHP constants in the htaccess file. Here's what I have so far:
```
php_value error_reporting E_ALL & ~E_NOTICE
php_flag display_errors On
php_flag display_startup_errors On
```
However, this configuration seems to be affecting the entire site and generating errors for some scripts that I don't want to display errors. I believe the problem lies with the error_reporting directive and using multiple constants.
Can someone please guide me on how to properly configure the error_reporting directive with multiple PHP constants in the .htaccess file? I want to display errors in general but also exclude certain PHP notices in specific scripts. Any assistance would be greatly appreciated.
Thank you in advance!
Bob

User 3: TechEnthusiast29
Hello Bob,
I completely understand your struggle with configuring error_reporting and using multiple PHP constants in your .htaccess file. I encountered a similar situation a while back, and here's the approach that worked for me.
In your .htaccess file, you can utilize the SetEnv directive to set custom environment variables for different PHP scripts. These environment variables can then be accessed in your PHP code to configure error reporting.
Here's an example of how you can use this approach:
In this snippet, I've used the `<FilesMatch>` directive to target specific scripts, "script1.php" and "script2.php". Then, using SetEnv, I've defined a custom environment variable called "PHP_ERROR_REPORTING" and set it to the desired error reporting level.
In your PHP code, you can access this environment variable and configure error_reporting accordingly:
By retrieving the value of the "PHP_ERROR_REPORTING" environment variable using getenv(), you can dynamically set the error_reporting level for each script.
Give this method a try and see if it resolves your issue. Feel free to ask for further clarification or assistance if needed.
Best regards,
TechEnthusiast29