Pro PHP- Patterns, Frameworks, Testing and More

(vip2019) #1

(^120) CHAPTER 8 ■ TESTING, DEPLOYMENT, AND CONTINUOUS INTEGRATION
That said, Xinc offers an option to call publishers on both the success and failure of the
build process. In this case, when the build fails, you want to receive an e-mail alerting you
to the broken build. You could also configure a host of other actions, such as calling another
Phing target using publishonsuccess or publishonfailure.


Starting Xinc


With your config.xml in place in /etc/xinc, you can start Xinc:

> /etc/init.d/xinc start

To test that Xinc is working correctly, make a change to your repository and commit. Within a
minute, it should show up on your testing site, or you should receive an e-mail message about
failing unit tests.
You now have a fully integrated build, test, and deployment system.

Xdebug for Debugging
Debugging is one of the more complicated parts of PHP development. Many people use echo
statements and print out values, while others use frameworks that provide logging components.
Xdebug is the next level of this concept. It allows you to examine even more detail about a PHP
application while it is running. Beyond debugging, Xdebug also has a number of profiling
options that can help you determine where your code is running slowly.

Installing Xdebug


Xdebug for PHP is most easily distributed through PECL and installation is fairly straightforward:

> pecl install xdebug

...compiling...

Build process completed successfully
Installing '/usr/lib/php5/20060613+lfs/xdebug.so'
install ok: channel://pecl.php.net/xdebug-2.0.1
configuration option "php_ini" is not set to php.ini location
You should add "extension=xdebug.so" to php.ini

At this point, Xdebug has been compiled but it is not active. The instructions on the screen
here are slightly confusing and not quite accurate. In your php.ini file, you will need to add the
following line:

zend_extension=/usr/lib/php5/20060613+lfs/xdebug.so

■Caution Despite Xdebug’s postinstallation message, you must add zend_extension, not extension,
to the php.ini file.

McArthur_819-9C08.fm Page 120 Friday, February 22, 2008 9:06 AM

Free download pdf