简体   繁体   中英

PEAR & PHPUnit on Windows 7 with WAMP

I know there are several threads on this already, but I've hit a brick wall and can't find any threads with the same issue I now have. In a nutshell, my problem is that PEAR's config is still set to the C:\Windows directory, where it always (correctly) fails due to permissions. I've added System environment variables as follows, so I don't know why these seem to be getting ignored:

PHP_PEAR_BIN_DIR=C:\wamp\bin\php\php5.3.4
PHP_PEAR_DATA_DIR=C:\wamp\bin\php\php5.3.4\PEAR\data
PHP_PEAR_DOC_DIR=C:\wamp\bin\php\php5.3.4\PEAR\docs
PHP_PEAR_INSTALL_DIR=C:\wamp\bin\php\php5.3.4\pear
PHP_PEAR_PHP_BIN=C:\wamp\bin\php\php5.3.4\php.exe
PHP_PEAR_SYSCONF_DIR=C:\wamp\bin\php\php5.3.4
PHP_PEAR_TEST_DIR=C:\wamp\bin\php\php5.3.4\PEAR\tests

typical error is

C:\wamp\bin\php\php5.3.4>pear channel-discover pear.phpunit.de
PEAR_Config::writeConfigFile fopen('C:\Windows\pear.ini','w') failed (fopen(C:\Windows\pear.ini): failed to open stream:
 Permission denied)

My initial install commands were as follows:

php -d phar.require_hash=0 PEAR/go-pear.phar
pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com
pear install phpunit/PHPUnit

I've tried removing the install and starting from scratch, but still no dice. Anyone have any ideas on this?

Try to update your PEAR installation by requesting http://pear.php.net/go-pear.phar in your browser and save the output to a local file go-pear.phar; then run php go-pear.phar from the CLI. This will let you reconfigure the paths and IIRC it will also create a reg file you can simply doubleclick to import the environment variables.

Also make sure to relog to your account when adding environment variables.

Try to change the ini location modifying some entries in the registry

according to this question

PEAR on Windows: How to change pear.ini location

You can find the location of the "sysconf" here and alter it

[HKEY_CURRENT_USER\Environment]
"PHP_PEAR_SYSCONF_DIR"="D:\\webserver\\xampp\\php"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM