Install PHPUnit and xdebug on PHP

Source: Internet
Author: User
Tags configuration php pear phpinfo zts
Install PHPUnit and Xdebug under PHP
?? ? ? Say before the company installed the next phpunit, test ~ ~ But the output code test coverage, need to have PHP extension xdebug, went online to find this xdebug? (www.xdebug.org), download.
?? ? ? In the company's integrated environment, under a 5.2 Vc6 (32bit), change the name to Php_xdebug.dll, and then follow the tutorial to say the configuration php.ini file as follows:
[Xdebug]
Zend_extension_ts= "C:/wamp/php/ext/php_xdebug.dll"
Xdebug.profiler_enable=on
Xdebug.trace_output_dir= "D:/phpapp/xdebug"
Xdebug.profiler_output_dir= "D:/phpapp/xdebug"
?
But found that Xdebug did not install successfully.
According to the tutorial, xdebug this extension needs to be Zend way to load, (as for the reason we check online), but is not successful.
When I woke up this morning and thought about it, I installed it again on my computer.
Also first installs the pear, special mention, my book's environment is installs independently , did not use the integration. PHP's environment is 5.2.10,
There was also an episode in the installation of pear: It was when he ran the command to load the extension php_exif the PHP extension that he reported a mistake, and the general message was that I didn't load the mbstring extension, but this extension I was already loaded successfully, And also can be seen in the Phpinfo information page, later on the Javaeye saw a post, mentioned this problem, originally EXIF this extension needs to use mbstring, But in the php.ini loaded in sequence is according to the letter, mbstring in the Exif extension, so the loading into the EXIF can not find mbstring, the solution is also very simple, as long as the mbstring of the load mentioned in front of the Exif. Restart Apache and reinstall Pear.
Installation pear is the same way to install?? Go-pear, the installation is completed after the discovery version is 1.7.1, due to the company installed when the version is known to be low, so an upgrade pear upgrade pear, Upgrade to 1.9.1, and then install PHPUnit again, because it has been said that 5 of the environment is phpunit2 and phpunit with the 4 environment, so the installation
Pear channel-discover pear.phpunit.de???? After OK
Pear Install--alldeps phpunit2
After I ran PHPUnit, I found that it had only 8 options, and the version was 2.3.6:
It was strange that the company installed the PHPUnit after the upgrade version was 3. X, I installed a problem, so I installed once again phpunit, the results found that I installed the phpunit unexpectedly is 1. X, so incredible, so I deleted phpunit, to the Pear website to see (www.pear.php.net), found that PHPunit2 is 2.3.6 version, so I uninstalled phpunit, (Pear Uninstall PHPUnit), in order to correct, I re-remove phpunit2 Reinstall, and update the next channel (Pear update channels) before installation, and then install Phpunit2 again, and then I ran across to install Xdebug, This is the method that this article begins to install again.
But I found that on my machine if the Xdebug installation mode is the Zend extension mode, the Apache reboot unexpectedly error occurred. So I changed it to use PHP extension to open,

?

[Xdebug]
Extension=php_xdebug.dll
Xdebug.profiler_enable=on
Xdebug.trace_output_dir= "E:/alicx/php/xdebug"
Xdebug.profiler_output_dir= "E:/alicx/php/xdebug"
Reboot successfully, then execute phpinfo and see the Xdebug extension:
?
Then I go to the command line again to run the PHPUnit command:
Found more coverage of these several options to generate coverage files, and the beginning of the prompt me: Xdebug must be zend extension to load, this can do, so I again open the way to load with Zend, and then restart Apache, view the error log discovery:
PHP Warning:? Xdebug must be loaded as a Zend extension in Unknown on line 0
PHP Fatal error:? [Zend Optimizer] Zend Optimizer 3.3.3 is incompatible with Xdebug 2.1.0 in Unknown on line 0
Find such a post in Javaeye:

Xdebug must use Zend_extension_ts or zend_extension to indicate that it is an extension of Zend

Depending on the PHP version, the zend_extension directive can be one of the following:

Zend_extension (non ZTS, non debug build)

Zend_extension_ts (ZTS, non debug build)

Zend_extension_debug (non ZTS, debug build)

Zend_extension_debug_ts (ZTS, debug build)

Zts:zend Thread Safety

You can see whether ZTS is enabled by Phpinfo () to determine zend_extension or zend_extension_ts.

Extension is a PHP engine-based extension

Zend_extension is an extension based on the Zend engine

The problem here, my PHP does not enable Zend Thread Safety, so can not be used zend_extension_ts this way to load, instead of zend_extension this load xdebug.
Restart Apache, success, run PHPUnit again:
 

Next is the error log:

php Fatal error:? [Zend Optimizer] Zend Optimizer 3.3.3 is incompatible with Xdebug 2.1.0 in

unknown on line 0

Is there a problem with the Zend Optimizer I installed? So I annotated all my Zend extensions, and then again with Xdebug's Zend extension

open

Finally, with those three options, check Phpinfo also has the Xdebug option

analysis: it seems that xdebug and optimization have conflicts, Internet search, As I found out in an article, it really conflicted,

and also found Zend_extension extension only 5.3 support, so still have to use Zend_ Extension_ts to extend Xdebug

share this article address:

OK, you can use the The coverage of unit tests is also there, and here I know that my PHPunit2 option is less because I did not install other extensions resulting in unit test commands phpunit options only a few of their own, I installed the xdebug after the coverage of the export of these commands ~ ~ ~
OK, since the installation is complete!! ,
Looks like I'm going back to the company. I have to take a look at my Xdebug startup mode.
                            ---This article is published in the QQ space: Http://user.qzone.qq.com/414073277/blog/1292122868ps:  QQ space Pictures should not come over ...

1 Floor Getaway Shrimp 2010-12-13

In addition, this morning came to the company from colleagues to know that PHPunit2 is a very old version, the current version is PHPUnit 3.5 I think I'm behind the time. Go back to upgrade in the evening ~ ~

2/F Caibaohua 2010-12-13

Put on an Ubuntu, Apt-get can handle it.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.