Set Up PHP Development Environment
Notes of Set up PHP development environment
- Install Eclipse PDT;
- Install PEAR and PECL on Mac OS X, php.ini locate in /etc on Yosemite;
Install Xdebug through PEAR/PECL;
Addition configure for Yosemitesudo cp /etc/php.ini.default /etc/php.ini
- add “zend_extension=/usr/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so” to php.ini
Debugging Local PHP Files (PHP CLI Application)
- Create a PHP project;
- Create a PHP file;
- Set a breakpoint in PHP file;
- Save file;
- Create a new debug configuration;
- Eclipse > Preference… > PHP Executables > Add (Executable path:
which php
) - Run > Debug Configurations > Select PHP CLI Application > New
- Eclipse > Preference… > PHP Executables > Add (Executable path:
Debugging PHP Web Applications (PHP Web Application)
- Create a PHP project;
- Create a PHP file;
- Create a new debug configuration;
- Run > Debug Configurations > Select PHP Web Application > New
Test with PHPUnit
- Run > External Tools > External Tools Configurations… > Program > New [Main] Location:/usr/local/bin/phpunit Working Directory:${workspace_loc:/Backend/tests} Apply > Run Reference
Integrate MakeGood (failure)
- Installing Prerequisite Software
- PHP 5.5.27 (cli)
- xdebug-2.3.2
- eclipse mars(4.5.0)
- PDT(3.5.0)
- PHPUnit (4.8.6)
Installing MakeGood Help -> Install New Software… -> Add… -> http://eclipse.piece-framework.com/
Selecting a Testing Framework
Resolving the Dependencies to the Testing Framework
* Defining User Libraries Eclipse -> Preferences... > PHP -> PHP Libraries > New... > OK Add External folder... > [Verifying the include path](http://pear.php.net/manual/en/installation.checking.php) * Adding User Libraries to the Project
fail with PHPUnit_Framework_TestCase class is not available. Fix…, I doubt that MakeGood doesn’t support eclipse mars.
*Testing Framework Specific Configuration
PHPUnit* Open the properties for the project. * Select MakeGood. * Select PHPUnit. * Specify the XML Configuration File. [eg](http://beagile.biz/a-simple-phpunit-xml-configuration-example/)
- Installing Prerequisite Software
Throw java.lang.NullPointerException when create a new debug configuration
Solution: Add a PHP Executable, Eclipse > Preference… > PHP Executables > Add (Executable path: which php
)
Wait for XDebug session
Solution:Debugging PHP Web Applications时卡在这里,原因是XDebug remote debug没配置好,参考了Remote Debugging和Debugging using XDebug,发现phpinfo()输出的内容并没有XDebug。于是来开始配置php.ini,参考的How to set default php.ini to be used, OSX Yosemite
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
/private/tmp/pear/install/xdebug/xdebug.c:25:10: fatal error: ‘php.h’ file not found
Solution:
1
|
|