WAMP Problems and Solutions

Some time ago I discovered WAMP but didn’t use it because the habit of doing everything on my actual webservers was so much a part of my daily activity that it seemed like a step backwards.

As my applications have become more involved I have taken to the habit of messing with them late at night when the load would be less. But this is a horrible way to go about doing things and so I took another look at WAMP as even moderate changes are best made without the world seeing your “efforts” (usually spelled ERROR) Β in real time as you make them.

Aside from that being able to develop applications and run a server right from you desktop it is simply easier to open up and edit local files move them around and load them. You don’t have to deal with temporary delays in either the internet or the remote server. In short you can just operate through the development cycle much faster leaving more time for beer, women (men?), gaming or whatever tickles your fancy.

So here is a list of what I encountered going from installation to use with my sites. Some were related to settings others where a result of programming errors. In either case I am listing them here in the hope that someone else might benefit from this information and might experience for themselves the pure JOY of developing from their desktop instead of live where the people get so0000 cranky when they see “Internal Server Error” πŸ™‚

PHP short tags don’t work by default.

Solution: click on the wamp tray icon > PHP > settings (make sure Open Short Tags is checked).
It is also worth considering not using short tags as this will ensure you pages work where short tags are not allowed.

Concatenating a variables doesn’t work as expected in WAMP.

e.g. $MYVAR.=””; without first declaring $MYVAR=””; creates an error
Solution: Simply declare the variable as empty before trying to concatenate to it. Make logical sense that you should have to do this and in truth is probably just good practice but like many things it always seemed to work OK on my Linux systems so I never worried to much about it and therefore developed the habit. It doesn’t work on WAMP. Similar to advice offered above, it is better to simply follow standard practice and declaring the variable will also work on systems that don’t require it.

Mod REWITE doesn’t work in WAMP.

Solution: >>click on teh wamp tray icon > Apache > Apache module > (make sure rewrite_module is checked)

…more coming as I encounter it

…as promised here are some more.

Register Globals is OFF by default

I have to be honest in saying that much of this has been a pretty humbling experience to me as a programmer. I gave up on WAMP and tried XAMPP only to find similar and even more sever problems.

I was about to give up on both to them when something about the fact that my get variables where being ignored and I realized the register_globals must be off. So if your interest is just in making the thing work follow the instruction at the bottom….BUT….you might consider adopting the approach I am and starting coding properly and registering your variables.

The failure are not with WAMP they are with the code you are trying to run. Most hosts configure their servers to register_globals and suppress the error reporting. Both of these issues are a result of bad coding.

So enough with the speeches on my own personal revelations here is how you can get WAMP to run with all your poorly written scripts. πŸ™‚

Turning off error Reporting

click the wamp tray icon>PHP>PHP.ini You need to edit the PHP.ini file. Search for a line that reads error_reporting.

By default it is set to: error_reporting = E_ALL
Change it to: error_reporting = E_ALL & ~E_NOTICE

All your errors should not be “invisible”. And by invisible I mean you haven’t fixed them they just aren’t appearing on the screen any more. See my previous statements about proper coding.

Registering Globals

I began coding before Registering Globals was considered a bad idea (and it is). But I nonetheless perceived it was OK and developed the habit of relying on Registering Globals being available for much of the code I wrote. By default in WAMP it isn’t. Many commercial hosting account have it turned on because frankly there is alot of horrible coding out there which would break if it wasn’t.

OK, enough with the pontifications… the solution is super simple.
Click on the WAMP tray icon> PHP > PHP Settings >Make sure register_globals is checked.

Some Final Thoughts after Day 1

WAMP works beautifully. After making the above changes all the scripts I through at it ran perfectly, ModRewrite worked perfectly, get variable flew around in urls and made things happen as expected. In short I made WAMP accept the crappy code I was giving it. And that leads me to an unexpected conclusion. I have to change my coding habits.

I have been design websites and coding since 1997. I have in that time picked up some pretty bad habits. I am making a decision and promise to be a better coder. The benefits to it are simply too numerous. Not the least of which would have been that I wouldn’t have had to invest and entire day trying to make my sites run on WAMP.

The fault is not with WAMP it is the code your giving it.

Author: Brian Marshall

Share This Post On