System Status
Everything's OK All of our systems are online and fully functional. Find out more
You are here:
Scripting with Perl & PHP
Troubleshooting common PHP issues
Here are some common problems and solutions you may find useful once you start scripting with PHP.
If you're having problems one of the first things may want to do is enable error reporting. Error reporting takes a lot of the guess work out of debugging your code and should give you a good place to start. To turn on error reporting, include these lines of code at the top of your PHP script.
ini_set('display_errors',1);
error_reporting(E_ALL);
Remember to turn off error reporting once you have fixed your issue. Leaving it enabled may show unwanted output to your visitors.
Often problems with PHP code are cause by something very simple. Check your syntax and look for broken code highlighting (if your editor supports it).
If you're code is being displayed on your website instead of running make sure all your files are saved with the .php extension. Another possible reason for this is that PHP is not enabled on your hosting, we don't enable PHP on our Starter hosting package, if you wish to run PHP and are using this package you will need to upgrade.
Most scripts are compatible across different versions of PHP, however sometimes as PHP is upgraded things are changed slightly and will not always be backwards compatible. Because of this it's always a good idea to know what version of PHP to code for.
If you're using loops within your PHP code you may run into problems where by your script seems to never stop loading. A common cause of this problem is that the loop isn't counting properly.
One way to debug this is to echo() the current count number at the beginning of each loop cycle, this will hopefully give you a better idea of where the problems lay.
If you're not using loops and your page is continuously loading you should double check any HTML or Javascript code.
We highly recommend the very active discussion forum (PHP Builder) for discussing all aspects of PHP - www.phpbuilder.com/board
Everything's OK All of our systems are online and fully functional. Find out more
Any questions? email or call +44 (0)1438 342 490
Stay in touch: