Requirements:
- Zend Studio 7.x.x
- Firefox with Zend Studio toolbar
- You are using Linux Ubuntu distribution. Other Linux distribution should be similar.
- You must already have Zend Studio installed.
Finding ZendDebugger.so
If Zend Studio is installed, you can locate ZendDebugger.so as follow:
- sudo updatedb
Update the database of all the files and directories in our system. This command should be run by the cron job everyday. You may omit this step unless Zend Studio is newly installed. - locate ZendDebugger.so
Find the exact path to ZendDebugger.so
/home/user/Zend/ZendStudio-7.2.1/plugins/org.zend.php.debug.debugger.linux.x86_5.3.7.v20100625/resources/php5/ZendDebugger.soLoad ZendDebugger.so extension
/home/user/Zend/ZendStudio-7.2.1/plugins/org.zend.php.debug.debugger.linux.x86_5.3.7.v20100625/resources/php53/ZendDebugger.so
I do not recommend editing the php.ini file as we can easily create a mess in there. Instead, we should create a new configuration file under /etc/php5/conf.d directory. All configuration files end with ini under that directory will be loaded every time PHP execution is called. We can easily maintain our configuration that way:
zend_debugger.allow_hosts - which hosts allowed to debug, separated by comma.sudo cat > /etc/php5/conf.d/zend_debugger.iniPaste from command line (ctrl+shift+v):
zend_extension=/full/path/to/ZendDebugger.sozend_debugger.allow_hosts=127.0.0.1, 192.168.0.1/16zend_debugger.expose_remotely=alwaysdone with ctrl+c.
zend_debugger.expose_remotely - telling the web browser that Zend Debugger is enable on this server.
If you are using PHP 5.3, you must use .../php53/ZendDebugger.so. Otherwise, use .../php5/ZendDebugger.so.
Restart apache server:
sudo service apaches restartHopefully, there is no error. Otherwise, check the path to your ZendDebugger.so or the version of ZendDebugger.so you are loading. Most of the problem occur there.
Confirm Zend Debugger is installed
Create a test page as follow:
cat > test.php
Paste from command line (ctrl+shift+v):
<?php
echo phpinfo();
done with ctrl+c.If you see the following image, your Zend Debugger is successfully configured on your server. In my case, it's just my personal laptop.
Let's debug...
Open Firefox with Zend Studio toolbar, go to your website click on the Debug button as show below:
Enjoy! But please remember, It is twice as difficult to debug a program as to write it. Therefore, if you put all of your creativity and effort into writing the program, you are not smart enough to debug it.
Anonymous
No comments:
Post a Comment