简体   繁体   中英

Can't install PEAR

sudo php -d detect_unicode=0 go-pear.phar

Unable to create PHP code directory ($php_dir) /usr/share/pear.

Do I need to change permissions on /usr/share? Current permissions are drwxr-xr-x

The /usr folder is protected. You can disable SIP, but this is not the best option.

You can select 1 for the "Installation base" and change the directory to /usr/local

Then it will apply to all other addresses.

Take a look on this other question https://apple.stackexchange.com/questions/237778/cant-write-to-usr-even-with-sudo

From this link: http://jason.pureconcepts.net/2012/10/install-pear-pecl-mac-os-x/ With this instructions, you don't need to disable 'System Integrity Protection'

The following instructions install PEAR and PECL on Mac OS X under /usr/local/. PECL is bundled with PEAR. So this is as simple as installing PEAR on Mac OS X.

PEAR is PHP’s Package Repository and makes it easy to download and install PHP tools like PHPUnit and XDebug. I specifically recommend these two for every PHP developer.

Download PEAR
curl -O http://pear.php.net/go-pear.phar
sudo php -d detect_unicode=0 go-pear.phar

Configure and Install PEAR
You should now be at a prompt to configure PEAR.

Type 1 and press return.
Enter: /usr/local/pear

Type 4 and press return.
Enter: /usr/local/bin

Press return

Verify PEAR. You should be able to type:

pear version

Eventually, if you use any extensions or applications from PEAR, you may need to update PHP’s include path.

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