Pear install for macports PHP5

霸气de小男生 提交于 2019-12-04 16:05:34

问题


I have PHP5 installed via macports in /opt/local/..the default location for macports. There's no portfile for pear. If I do a standard pear install from the pear site what directory location should pear be placed in to work with PHP?


回答1:


While the curl option works, it won't update as you update your ports. An alternative:

sudo port install php5 +pear

This will install the variant of php5 with pear, in the same location as downloading above, and it will update as you update macports.




回答2:


I had a similar issue just now, and went for installing PEAR in exactly the directory you mentioned.

curl -O http://pear.php.net/go-pear.phar
sudo php go-pear.phar

I changed the installation base directory ($prefix) to point to /opt/local and ran the installer. It amended my php.ini file to include the PEAR path.

My bash path already contained /opt/local/bin, so PEAR just worked!




回答3:


I wonder why nobody wrote an updated solution, so I do it:

sudo port install pear-PEAR
sudo port install php53-pear

Replace 53 with whatever version of PHP you want to use. Then install the pear-package you need with MacPorts! You can get a full list of available packages with

port echo name:^pear-

As mentioned in a comment of the other answer, go here for more info: https://superuser.com/q/650299/39309




回答4:


For those of you running PHP outside of MacPorts @Ben's answer, with the following modification, is actually the solution to the problem. I needed PEAR to install PHPUnit so I could do some unit testing but I use XAMPP.

I followed Ben's solution but got an error when trying to install it. My error was:

WARNING! The include_path defined in the currently used php.ini does 
not contain the PEAR PHP directory you just specified:
</opt/local/share/pear>
If the specified directory is also not in the include_path used by
your scripts, you will have problems getting any PEAR packages working.

Current include path           : .:
Configured directory           : /opt/local/share/pear
Currently used php.ini (guess) :

I set the path of Currently used php.ini to the following and all worked perfectly:

/Applications/XAMPP/xamppfiles/etc/php.ini

Hope that at worst, this helps other XAMPP users!



来源:https://stackoverflow.com/questions/4981134/pear-install-for-macports-php5

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!