Install phpunit and xdebug on PHP

Source: Internet
Author: User
Tags zts
Install phpunit and xdebug ???? I installed phpunit in my company and tested it ~~ But the output code test coverage rate requires php extension xdebug, so I went to the Internet to find this xdebug? (Www.xdebug.org .???? Install phpunit and xdebug in the company's PHP environment
?? ? ? I installed phpunit in my company and tested it ~~ But the output code test coverage rate requires php extension xdebug, so I went to the Internet to find this xdebug? (Www.xdebug.org), download.
?? ? ? In the integrated environment used by the company, a 5.2 Vc6 (32bit) is created, and the name is changed to php_xdebug.dll. Then, follow the instructions in the tutorial to configure the 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"
?
However, xdebug is not installed successfully.
According to the tutorial, the extension of xdebug needs to be loaded in zend mode (for the reason you can check it online), but it is not successful.
I got up this morning and thought about it, so I installed it again on my computer.
Install pear first. in particular, the environment of my notebook is installed independently without integration. The PHP environment is 5.2.10,
When installing pear, there was also an episode: He ran this command to load the php_exif extension to php and reported an error, the general information is that I did not load the mbstring extension, but I have already loaded this extension, and I can also see it on the phpinfo information page. later I saw a post on javaeye, when this problem is mentioned, the original exif extension requires mbstring, but in php. the sequential loading of ini is based on letters, and mbstring is placed after the exif extension. Therefore, mbstring cannot be found when it is loaded to exif. the solution is also very simple, you only need to mention the loading of mbstring before exif. Restart apache and then reinstall pear.
The same is true for installing pear ?? Go-pear. after the installation is complete, it is found that the version is 1.7.1. because we know the version is low during the installation, we upgraded pear upgrade pear to 1.9.1, then install PHPUnit again, because phpunit2 is used in the 5 environment, and phpunit is used in the 4 environment.
Pear channel-discover pear.phpunit.de ???? After OK
pear install --alldeps phpunit2
After running phpunit, I found that there are only eight options and the version is 2.3.6:
 
It is strange that the phpunit version installed in the company is 3 after upgrade. X, is there a problem with my installation? so I installed phpunit again and found that the phpunit I installed was 1.X ?, This is incredible, so I deleted PHPunit and went to the pear website to see it (www.pear.php.net). I found PHPunit2 is 2.3.6, so I uninstalled phpunit (pear uninstall phpunit, I deleted phpunit2 and re-installed it. before the installation, I updated the next channel (pear update channels) and installed phpunit2 again. so I ran to install xdebug, this is the method described in the beginning of this article for re-installation.
However, I found that on my machine, if the xdebug installation mode is zend extension mode, an error occurs when apache is restarted. So I changed it to php extension,

?

[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"
Restart successfully. run PHPinfo and you will see the xdebug extension items:
?
Then I run the phpunit command again:
 
I found that the coverage option was added to generate the coverage file, and prompted me at the beginning: xdebug must be loaded in zend extension mode. what should I do, so I started loading with zend again, restarted apache, and checked the error log and found:
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 this post in javaeye:

Xdebug must use zend_extension_ts or zend_extension to indicate that it is a zend extension.

Based on the PHP version, the zend_extension command 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 use phpinfo () to check whether ZTS is enabled and decide whether to use zend_extension or zend_extension_ts.

Extension is an extension based on the php engine.

Zend_extension indicates zend-based extension

This is the problem. my php does not enable ZEND Thread Safety. Therefore, zend_extension_ts cannot be used for loading. Instead, I use zend_extension to load xdebug.
Restart apache and run phpunit again:
 

The following 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 commented out all my zend extensions and used the zend extension of xdebug again.

Enable

Finally, the three options are available, and the xdebug option is available for viewing phpinfo.

Analysis: It seems that there is a conflict between xdebug and optimization. I found a conflict in an article,

We also found that the zend_extension extension is only supported by 5.3, so we still need to use zend_extension_ts to expand xdebug.

Share this article address: http://hi.baidu.com/fykknd/blog/item/e5734e5d3960b94efbf2c0a5.html

OK, you can use the unit test coverage rate. here I will know, I have few PHPunit2 options. because I have not installed other extensions, I have only a few phpunit options for unit testing. after I installed xdebug, with coverage, export these commands ~~~
OK. the installation has been completed !!,
It seems that back to the company I have a good look at my xdebug startup mode.
--- This article is synchronously published in the QQ space: http://user.qzone.qq.com/414073277/blog/1292122868ps: QQ space images cannot be referenced ······
Xiaodao shrimp on the first floor in addition, I came to the company this morning and learned from my colleagues that PHPunit2 is a very old version, the current version is phpunit 3.5. it seems that I am outdated. · go back to upgrade at night ~~~ On the second floor, caibaohua had a ubuntu package installed on. apt-get can be done.

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.