Copy link to clipboard
Copied
Hello,
I try to develop a site using Dreamweaver CS5, PHP, MySql and Javascript. The most difficult part is the debugging of PHP code and Javascript. Can sombebody point me towards a tutorial or explain how I can debug PHP code and Javascript.
Thank you,
Carly
Copy link to clipboard
Copied
Carly,
One of the best places to look for errors is in the server logs, if you have access to them. That depends on your host.
For PHP you can insert the following code at the beginning of your file:
<?php
error_reporting(E_ALL);
ini_set('display_errors','on');
?>
Everything that goes to the server log will also show up on your web page. Be sure to remove this ASAP as it could be annoying to general readers and it could give away key information.
Another good trick is to use echo/alert statements in key parts of your code to give you an idea of what is going on. (You could also create a log file on your server, but that's getting pretty elaborate). Again, remove ASAP.
A word of caution with the use of echo in PHP. Some PHP processing is messed up when there's anything sent to the browser before it finished. Doing things with headers, for instance. That goes south with any output.
Hope this helps to get you started.
Barry
Find more inspiration, events, and resources on the new Adobe Community
Explore Now