practical mod to wampserver.ini
Posted by: pete (---.gtcust.grouptelecom.net)
Date: March 08, 2006 12:31AM

Hi,

Here's just a suggestion.

I just switched to wamp for development purposes. One of the important things when developing is to be able to turn errors on and off right ? Maybe I didn't see a feature for this if there is one but I made one.

in apache2/bin is the PHP.INI file. Make two copies. One is php-off.ini, the other is php-on.ini

in each of those modify the error notification

(
display_errors = On
error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT
)
or
{
display_errors = Off
error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR
)

Modifications to make in wampserver.ini

line 98
Type: submenu; Caption: "PHP Errors"; SubMenu: PHP_errors

line 543 to 557

[PHP_errors]
Type: separator; Caption: "PHP Errors"
Type: item; Caption: "errors on"; Action: multi; Actions: PHP_ErrorOn;
Type: item; Caption: "errors off"; Action: multi; Actions: PHP_ErrorOff;


[PHP_ErrorOn]
Action: service; Service: wampapache; ServiceAction: stop; Flags: waituntilterminated
Action: run; Filename: "LOCATION OF BATCH FILE TO OVERWRITE PHP.INI error on";
Action: service; Service: wampapache; ServiceAction: startresume;

[PHP_ErrorOff]
Action: service; Service: wampapache; ServiceAction: stop; Flags: waituntilterminated
Action: run; Filename: "LOCATION OF BATCH FILE TO OVERWRITE PHP.INI error off";
Action: service; Service: wampapache; ServiceAction: startresume;

LOCATION OF BATCH FILE...... should be full location ex: "c:\winnt\error-on.bat"

the batch files should be as follow:

c:
cd\
cd wamp
cd apache2
cd bin
copy php-off.ini php.ini /y

one with php-on.ini and another batch file for the off




Not sure if anyone is following me. Maybe this modification could be integrated with wamp in the next version. I think it would be a great feature to have included.

Oh and... Its weird that you have to restart the server to update the php.ini file. When I had apache2/php/mysql installed manualy as separate packages, I only had to overwrite it and I assume PHP would read the ini file everytime it got called...

Options: ReplyQuote
Re: practical mod to wampserver.ini
Posted by: CyberSpatium (---.hsd1.or.comcast.net)
Date: March 08, 2006 07:01PM

There is no reason to use this mod.

PHP comes with the default setting of most errors messages not being displayed. This is for security reasons, because when you are running a production server, displaying those error messages could expose information about your server and/or php script.

Also, since most people who use php scripts are on a shared hosting environment, and do not have access to editing the php.ini file, there are built in php error reporting functions we can use to set what kind of error reporting we which to use while developing or using your scripts.

When I am developing scripts, I put this code at the top of my php scripts:
error_reporting(E_ALL);

This turns on all error reporting, and all errors will be displayed. This makes it 100 time easier to develop my scripts, knowing all the errors being made.

When you are done testing your scripts, you just delete one line of code, instead of having to go through all this.

Error Reporting - PHP Manual
[us3.php.net]

Options: ReplyQuote
Re: practical mod to wampserver.ini
Posted by: pete (---.gtcust.grouptelecom.net)
Date: March 08, 2006 07:40PM

Using that line is fine with me.

I always have a development server on my computer and I liked being to turn all errors on and off versus maybe putting that line in one of your global includes and having to edit that one.. all I had to do is click one button at the bottom of my second monitors quick launch menu and errors would be on, or off.

I guess using the line doesn't really complicate things. As long as you're using includes. If you had a whole whackload of seperate files not using includes and you were trying to debug, adding and removing that line from everything can take a while.

Options: ReplyQuote


Sorry, only registered users may post in this forum.