Simple PHP debugging tips

Whether you are just getting started in PHP development or have been at it for a while, here are some tips that will help you troubleshoot when your code isn’t working quite the way it should. Post a comment if you find these tips useful or would like to share your own. I’d love to hear from you. Identifying the PHP function being called The first tip is especially useful if you are working on a larger PHP project where there might be multiple definitions of functions or class methods. You may be surprised to discover that it isn’t the function you … Continue reading

Tips for Customizing the Layout of NetBeans for Productive Debugging in PHP

Here are a few productivity tips to make editing and debugging PHP code easier in NetBeans by just modifying the editor’s layout. Display the NetBeans Debugging Window Click Window > Debugging and select the desired debugging tabs. In NetBeans 8.0, your options will include: Variables Watches Call Stack Breakpoint Session Threads Sources Debugging Display a list of your PHP functions in NetBeans In NetBeans, the function list is called Navigator. To display a list of the PHP functions in the currently opened file, simply toggle the navigator by pressing Ctrl+7. Add a Debug File Icon to the NetBeans Toolbar To … Continue reading

Sending Custom Emails in Moodle Using the email_to_user() Function

You can send custom emails from within Moodle using PHP using your own forms using the email_to_user() function. By the way, did you know that Moodle actually uses the open source PHPMailer behind the scenes? A typical call to Moodle’s email_to_user() function would look like: email_to_user($toUser, $fromUser, $subject, $messageText, $messageHtml, ”, ”, true); This is a very simple version of a very powerful function. For more information about the email_to_user() function, take a look at the source code for function email_to_user in Moodle’s /lib/moodlelib.php. If you wanted to also include an attachment, you would need to also specify the path to the file to attach … Continue reading

Making XDEBUG work with NetBeans on Windows

After spending way more time that I should like to admit trying to get XDEBUG to work with Notepad++ using the DBGp plugin in anything but the simplest of projects, I decided to look for an alternative. I compared features of 9 different IDE’s for PHP development and reading tons of reviews. There are many great IDE’s out there and everyone will have their favourite. My short list ended up including: Eclipse (PDT) 3.5 — Didn’t bother trying it. While I’m sure it’s a fine product, the website is ancient and not user friendly. Way too much work to try and … Continue reading