Installing PHP 5.4 and PEAR
PHP5.4 is pretty easy to install on windows. Although it doesn’t have a self installing binary like some of the previous versions, the install is pretty straight forward.
- Download PHP 5.4 from php.net here (you want to download the VC9 x86 thread safe zip)
- Extract the downloaded zip to c:\php
- In your favorite browser go to http://pear.php.net/go-pear.phar to download go-pear.phar
- Move go-pear.phar from your download directory to c:\php
- Rename the file php.ini-development or php.ini-production to php.ini in the directory c:\php
- Add php to the PATH environment variable, by appending ;c:\php to it
note: If you’re not sure how to set the path variable in windows 7 this is a good guide. - Open a command prompt with administrative permissions (go to, all programs –> accessories and right-click command prompt and select “run as administrator”)
- Go to the php directory
cd c:\php
- Beginning the PEAR install
php go-pear.phar
- Select system for the install type (it’s the default, so you can just press enter)
- Next you will be shown the paths that PEAR will use, you want to change number 11 to c:\php\pear.ini
–>To do this type 11, press enter, then type c:\php\pear.ini - After the install has finished run c:\php\PEAR_ENV.reg to finish the installation
Installing PHP Codsniffer
- Open a command prompt with administrative rights
- Go to the PHP install directory
cd c:\php
- Install PHP Codesniffer
pear install PHP_CodeSniffer
thank you very much
Thanks.. for your post
This isn’t working for me. For WordPress and Drupal I used a Web Platform Installer which placed php 5.3 under C:\Program Files (x86)\IIS Express\PHP\v5.3 which is protected. The pear install appears to be okay- I guess. but installing codesniffer puts that in doubt.
I tried moving pear outside to a writable set of directories C:\Git\pear, but then I get
C:\>pear install PHP_CodeSniffer
Notice: unserialize(): Error at offset 79 of 555 bytes in Config.php on line 1050
Notice: unserialize(): Error at offset 79 of 555 bytes in C:\Git\Pear\pear\PEAR\Config.php on line 1050
ERROR: The default config file is not a valid config file or is corrupted.
I remember running into issues with having php under the program files directory. Is it possible that you can tell the installed your using to install to c:\some_folder_name.
It would probably fix your issue.
You could also try just installing php itself into c:\php and let your IIS server know where you installed it.
I finally noticed that “pear config-show” shows PEAR Installer cache directory cache_dir C:\temp \pear\cache
See the space! Digging in pear\pear\Config.php I saw that if you set set PHP_PEAR_CACHE_DIR=C:\temp\pear\cache
So now CodeSniffer installs! Please update PEAR to set the CACHE_DIR!
I haven’t circled back to see if this would work with the original php install.
Reblogged this on Блог zBujhm-а and commented:
Этот блог реально мне помог с установкой PEAR и PHP CodeSniffer под виндой!
Helped
Simply thanks…
bookmarked!!, I really like your blog!
Just what I needed. Thanks for posting.