After a long time, I got some time to get back into Mediawiki development being mentor of the GCI program. So, gotta complete this long pending draft.
Here is the first version of this post- https://crondev.wordpress.com/2014/05/23/debugging-mediawiki-part-1/
The current and the next post aren’t targeted at Mediawiki alone, and are generic for any Web Application.
Here, we will set up XDebug- One of the most powerful debuggers for PHP developers
Now, assuming you have PHP installed(If not, do it now- For OS X , you need to activate PHP which is installed by default), let’s install XDebug.
Assuming you have PHP 5.5
* For OS X
sudo port install php55-xdebug
* For Linux
sudo apt-get install php55-xdebug
* For Windows: Download the precompiled distribution here
Now, let’s make PHP know that we installed this debugger. For that, edit your
Where to look for php.ini?
Usually it is found in
/etc/php.ini in Linux and OS X. If you don’t have this file, look for
/etc/php.ini.default and rename it to
Usually in the above mentioned places, or in the PHP folder. In Windows system, it is in the PHP installation folder.
Now here, we need to know where the
xdebug.so is installed. For Windows, we simply downloaded the .dll file it, so no issues. For Linux and OS X, it is usually in
Tip: Linux and OS X users can use
Now, time to edit the file. Add the following lines to it:
zend_extension="xdebug.so PATH OBTAINED ABOVE" [xdebug] xdebug.remote_enable=1 xdebug.remote_host=localhost xdebug.remote_port=9000 xdebug.profiler_output_dir="SOME OUTPUT DIRECTORY"
Now let’s restart Apache, for OS X, use:
sudo apachectl restart
Let’s see if everything worked. In console type
If you get XDebug in this output, it means everything worked!!
In the next post, I will discuss about how to integrate this debugger with PHPStorm, one of the most popular IDEs for PHP development.