Thứ Năm, 28 tháng 3, 2013

Install phpunit on windows


Download PHP

Windows downloads of PHP are available here. If you are not sure of which version to get, check out this Stack Overflow page. I used the VC9 thread safe PHP 5.3.10 download.

Install PHP

Once you’ve downloaded the installer, run it and install PHP in C:\php\ (or wherever you like, only remember this path for later). Choose your webserver (or none if you don’t have a webserver installed) and select any additional components as needed, including PEAR.
Once PHP is installed open a command prompt. Check that PHP is set up correctly by running
php -v
It should give you output something like
PHP 5.3.10 (cli) (built: Feb 2 2012 20:27:51)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

If you don’t get this output something has gone wrong with the PHP install or in the modification of your environment variables. Get this fixed before proceeding with the guide.

Install PEAR

In the command prompt, switch to the directory that you installed PHP to by running
cd C:\php\
Then install PEAR by running
go-pear
Press Enter to accept the default when it asks you “Are you installing a system-wide PEAR or a local copy?”
Press Enter again to accept the file layout.
Press Enter to finish.

Install PHPUnit

Run the following commands (they may take a while to update, be patient):
pear channel-update pear.php.net
pear upgrade-all
pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com
pear update-channels


To install PHPUnit, run
pear install --alldeps --force phpunit/PHPUnit

To test that PHPUnit was successfully installed, run
phpunit -v

If all is fine, it should print out something like PHPUnit 3.6.10 by Sebastian Bergmann followed by the help contents.

Set PHPUnit to Windows Environment

Click right mouse in My Computer then chose property .

Choice Advance tab --> Environment Variables.

In System variables , choice Path and add C:\wamp\bin\php\php5.2.6.

 

Problems?

If you get a problem with PEAR refusing to install the dependencies for PHPUnit, try running this command: pear clear-cache. If the underlying problem is this error SECURITY ERROR: Will not write to C:\php\...rest.cacheid as it is symlinked to C:\php\...rest.cacheid - Possible symlink attack then clearing the cache should fix it.
If you get stuck with no helpful error messages while installing PHPUnit, check the PHP error log. To locate it, open your php.ini file (c:\php\php.ini) and look for a line like error_log="C:\Windows\temp\php-errors.log". Open the log file at the location specified and look at the bottom of the log for any recent errors. Copy the error message and Google for solutions.

Không có nhận xét nào:

Đăng nhận xét

Học lập trình web căn bản với PHP

Bài 1: Các kiến thức căn bản Part 1:  https://jimmyvan88.blogspot.com/2012/05/can-ban-lap-trinh-web-voi-php-bai-1-cac.html Part 2:  https://...