Turn on error reporting
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.
Note: 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).
PHP code being displayed instead of running
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, so if you wish to run PHP and are using this package you will need to upgrade.
PHP version compatibility issues
With the arrival of PHP7 there are a few incompatibilities with older PHP versions as well as new features that aren’t backwards compatible. Before switching your website over to PHP7 we’d advise testing any PHP included in your site.
You can change the version of PHP your web hosting uses from within your LCN.com account, which you can learn how to do by reading our handy guide.
PHP page loads continuously
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 lies.
Advanced troubleshooting and PHP knowledge sharing
We highly recommend the very active discussion forum (PHP Builder) for discussing all aspects of PHP - www.phpbuilder.com/board.