Configure PHP for Web Development using Eclipse - rajivkanaujia/alphaworks GitHub Wiki
Ruby is shipped with MacOS.
You have configured Apache and validated PHP via instructions at Configure Apache for Web Development
The debugger will be used for debugging PHP code when used in conjunction with Eclipse IDE See Enable debugging in PHP via Xdebug
Restart Apache
$ sudo apachectl restart
TEST using inprivate mode or inprivate browsing --> Visit http://localhost/~rajiv/phpinfo.php and check for following values.
If the values are same as mentioned below, you have configured the debugger accurately.
Don't forget to replace the localhost url with your actual URL (http://localhost/~/phpinfo.php)
xdebug.remote_enable On On
xdebug.remote_handler dbgp dbgp
xdebug.remote_host localhost localhost
xdebug.remote_port 9000 9000
Go to Help --> Marketplace and search for PHP Development
It is assumed that you have successfully configured Apache to enable PHP development and installed PDT in Eclipse.
Create a folder/directory ~/Sites/AlphaWorksPHP/
This is the location where all sample PHP code will be written/deployed.
Open Eclipse Preference.
Configure PHP Server
Preference --> PHP --> Servers
Select the top one and click Edit. Update the "Document Root"
Go to Debugger Tab. Select Xdebug and confirm the port. Click "Finish" button once done.
Go to Path Mapping tab and select the location where sample PHP code will be written or deployed. Click the Add button Add right "Path in File System" and associated "Path on Server" Click the OK button
Click Finish button
Preference --> PHP --> Debug Check Server Settings. Ensure right PHP Server is selected
Using Terminal, execute following command to find the location of PHP executable and php.ini
$ which php
/usr/bin/php
$ php -i | grep "php.ini"
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /etc/php.ini
Go to Eclipse Preference --> PHP --> PHP Executables Click Add button to add PHP executable
Click Next button to review Debugger to be used
You can also use the Search button to find default PHP executable
Configure eclipse to use external browser Go to Preference --> General --> Web Browser Select Use external web browser and select the browser Click OK to finish
In subsequent wikis, I will show how to use Eclipse to build and debug your first Hello World example in PHP
Note: If you like the instructions here, please refer it on your posts/documentation. Contact me if there are corrections needed.