{"id":1623,"date":"2012-07-25T07:50:08","date_gmt":"2012-07-25T07:50:08","guid":{"rendered":"http:\/\/truelogic.org\/wordpress\/?p=1623"},"modified":"2012-07-25T14:10:56","modified_gmt":"2012-07-25T14:10:56","slug":"installing-latest-pear-and-phpunit-on-windows-7","status":"publish","type":"post","link":"https:\/\/truelogic.org\/wordpress\/2012\/07\/25\/installing-latest-pear-and-phpunit-on-windows-7\/","title":{"rendered":"Installing latest PEAR and PHPUnit on Windows 7"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-medium wp-image-1635\" title=\"phpunit\" src=\"https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2012\/07\/phpunit-300x267.png\" alt=\"pear and phpunit\" width=\"200\" height=\"167\" \/>For my recent project based on YII framework, I have to use PHPUnit for doing unit test.\u00a0 My Local development environment is Windows 7 64 bit system. I have installed php 5.3.10, Apache 2.4 and MySQL 5.<\/p>\n<p>Problem for me start from beginning when I looked for go-pear.bat file on my c:\\\\php directory to install pear. I was unable to locate go-pear.bat file in my php installation directory.<\/p>\n<p>On <a href=\"http:\/\/pear.php.net\/manual\/en\/installation.getting.php\" target=\"blank\">http:\/\/pear.php.net\/manual\/en\/installation.getting.php<\/a> it is clearly written to use this file to install pear itself. I googled a lot and found some of the useful instruction for pear installation, but unfortunately they either failed or too old to handle the new environment. After a day of long search I finally manage to install pear and PHPunit on my system.\u00a0 If you also unable to find go-pear.php on your local php installation directory then you can take the following approach.<\/p>\n<p>Here are the steps i have taken to solve this problem, this might also help you.<\/p>\n<p>1.\u00a0\u00a0 \u00a0In your php.ini file find the following line.<br \/>\n<span style=\"margin-left: 40px; background-color: #e6e3e3; color: black;\">;phar.require_hash = On<\/span><\/p>\n<p>2.\u00a0\u00a0 \u00a0Remove the semi-colon from beginning of this line and change \u201cOn\u201d to \u201cOff\u201d (without double quotes).<\/p>\n<p>3.\u00a0\u00a0 \u00a0Restart your apache server.<\/p>\n<p>4.\u00a0\u00a0 \u00a0Input this url in your browser <a href=\"http:\/\/pear.php.net\/go-pear.phar\" target=\"blank\">http:\/\/pear.php.net\/go-pear.phar<\/a>, you will be prompted to download go-pear.phar file.<\/p>\n<p>5.\u00a0\u00a0 \u00a0Download go-pear.phar file and move it to the php installation directory (c:\\\\php in my case).<\/p>\n<p>6.\u00a0\u00a0 \u00a0Open cmd navigate to c:\\\\php and run the following command<br \/>\n<span style=\"margin-left: 40px; background-color: #e6e3e3; color: black;\">php go-pear.phar<\/span><\/p>\n<p>7.\u00a0\u00a0 \u00a0Enter \u2018local\u2019 to the question asked. Follow the instruction.<\/p>\n<p>8.\u00a0\u00a0 \u00a0Restart apache.<\/p>\n<p>PEAR has been installed successfully (no need to configure your environment variable). To check it, type pear on your cmd you will be able to see the help menu for the pear.<\/p>\n<p>Now let\u2019s install PHPUnit (I have installed PHPUnit 3.6.11). While installing PHPUnit when I run the below command (in point 9) I got the error \u201cPEAR_Config::writeConfigFile fopen(&#8216;C:\\Windows\\pear.ini&#8217;,&#8217;w&#8217;)indows\\pear.ini): failed to open stream: Permission denied)\u201d.<\/p>\n<p>I have to re-open the cmd as administrator, so let\u2019s continue to finish our installation by installing PHPUnit<\/p>\n<p>9.\u00a0\u00a0 \u00a0Open cmd (remember to open it as Administrator ) navigate to the php installation folder and run the following commands.<br \/>\n<span style=\"margin-left: 40px; background-color: #e6e3e3; color: black;\">pear config-set auto_discover 1<\/span><br \/>\n<span style=\"margin-left: 40px; background-color: #e6e3e3; color: black;\">pear install pear.phpunit.de\/PHPUnit<\/span><\/p>\n<p>10.\u00a0\u00a0 \u00a0Wait while it install and follow the instruction.<\/p>\n<p>11.\u00a0\u00a0 \u00a0Restart your apache server.<\/p>\n<p>That\u2019s all you need to run a successful installation on windows 7. Though I have not tested but this process may also work in windows XP.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>For my recent project based on YII framework, I have to use PHPUnit for doing unit test.\u00a0 My Local development environment is Windows 7 64 <a class=\"mh-excerpt-more\" href=\"https:\/\/truelogic.org\/wordpress\/2012\/07\/25\/installing-latest-pear-and-phpunit-on-windows-7\/\" title=\"Installing latest PEAR and PHPUnit on Windows 7\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":1635,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,10,11,12],"tags":[286,166,198,200,285,288,287],"class_list":["post-1623","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-apachephp","category-programming","category-tutorials","category-useful-lists","tag-go-pear","tag-latest","tag-pear","tag-php","tag-phpunit","tag-unable","tag-windows-7"],"_links":{"self":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts\/1623","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/comments?post=1623"}],"version-history":[{"count":21,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts\/1623\/revisions"}],"predecessor-version":[{"id":1641,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts\/1623\/revisions\/1641"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/media\/1635"}],"wp:attachment":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/media?parent=1623"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/categories?post=1623"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/tags?post=1623"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}