Install PEAR in PHP 5.6.30 on macOS Sierra
Information
PEAR (= PHP Extension and Application Repository) is a framework and distribution
system for reusable PHP components.
More information about PEAR can be found at:
http://pear.php.net
Operating system used
macOS Sierra
Software prerequisites
PHP 5.6.30
Procedure
- After you installed PHP, see quick guide
Installing PHP5.6.30 on macOS Sierra,
check if you already have PEAR installed, type: pear version
- If PEAR is not installed you need to download the PEAR installer (go-pear.phar).
Goto your homedirectory and type: curl -O http://pear.php.net/go-pear.phar
- Install Pear, type: php -d detect_unicode=0 go-pear.phar
I accept the suggested locations, press Enter.
- Edit .bash_profile and add the following line:
export PATH=$PATH:/Users/robertlie/pear/bin
- Check the installed PEAR version, type: pear version
You should see:
PEAR Version: 1.10.1
PHP Version: 5.6.30
Zend Engine Version: 2.6.0
Running on: Darwin MacBook.local 16.6.0 Darwin Kernel Version 16.6.0:
Fri Apr 14 16:21:16 PDT 2017; root:xnu-3789.60.24~6/RELEASE_X86_64 x86_64
- Locate your php.ini, type:
php --ini
You should see (This is my example!):
Configuration File (php.ini) Path: /usr/local/php5/lib
Loaded Configuration File: /usr/local/php5/lib/php.ini
Scan for additional .ini files in: /usr/local/php5/php.d
Additional .ini files parsed: /usr/local/php5/php.d/10-extension_dir.ini,
/usr/local/php5/php.d/20-extension-opcache.ini,
/usr/local/php5/php.d/40-curl.ini,
/usr/local/php5/php.d/40-openssl.ini,
/usr/local/php5/php.d/50-extension-apcu.ini,
/usr/local/php5/php.d/50-extension-curl.ini,
/usr/local/php5/php.d/50-extension-gmp.ini,
/usr/local/php5/php.d/50-extension-igbinary.ini,
/usr/local/php5/php.d/50-extension-imap.ini,
/usr/local/php5/php.d/50-extension-intl.ini,
/usr/local/php5/php.d/50-extension-mcrypt.ini,
/usr/local/php5/php.d/50-extension-memcache.ini,
/usr/local/php5/php.d/50-extension-memcached.ini,
/usr/local/php5/php.d/50-extension-mongo.ini,
/usr/local/php5/php.d/50-extension-mssql.ini,
/usr/local/php5/php.d/50-extension-oauth.ini,
/usr/local/php5/php.d/50-extension-pdo_dblib.ini,
/usr/local/php5/php.d/50-extension-pdo_pgsql.ini,
/usr/local/php5/php.d/50-extension-pgsql.ini,
/usr/local/php5/php.d/50-extension-propro.ini,
/usr/local/php5/php.d/50-extension-raphf.ini,
/usr/local/php5/php.d/50-extension-readline.ini,
/usr/local/php5/php.d/50-extension-redis.ini,
/usr/local/php5/php.d/50-extension-solr.ini,
/usr/local/php5/php.d/50-extension-ssh2.ini,
/usr/local/php5/php.d/50-extension-twig.ini,
/usr/local/php5/php.d/50-extension-uploadprogress.ini,
/usr/local/php5/php.d/50-extension-xdebug.ini,
/usr/local/php5/php.d/50-extension-xhprof.ini,
/usr/local/php5/php.d/50-extension-xsl.ini,
/usr/local/php5/php.d/60-extension-pecl_http.ini,
/usr/local/php5/php.d/99-liip-developer.ini
- Modify your php.ini file. For example: /usr/local/php5/lib/php.ini
Under "Paths and Directories" add the following line:
include_path = ".:/Users/YOUR_USERNAME/pear/share/pear/"
For example: include_path = ".:/Users/robertlie/pear/share/pear/"
- Restart Apache, type: sudo apachectl restart
- Show the installed PEAR packages, type: pear list
You should see:
Installed packages, channel pear.php.net:
=========================================
Package Version State
Archive_Tar 1.4.2 stable
Console_Getopt 1.4.1 stable
PEAR 1.10.3 stable
Structures_Graph 1.1.1 stable
XML_Util 1.4.2 stable
- To install PEAR packages, here are a few examples:
- Install Log
(More info, https://pear.php.net/package/Log), type:
pear install Log-1.13.1
- Install MDB2
(More info, http://pear.php.net/package/MDB2), type:
pear install MDB2-2.5.0b5
- Install MDB2_Driver_mysql
(More info, https://pear.php.net/package/MDB2_Driver_mysql), type:
pear install MDB2_Driver_mysql-1.5.0b4
- Install Mail
(More info, https://pear.php.net/package/Mail), type:
pear install Mail-1.4.1
- Install Mail_Mime
(More info, https://pear.php.net/package/Mail_Mime), type:
pear install Mail_Mime-1.10.1
- Install Mail_mimeDecode
(More info, https://pear.php.net/package/Mail_mimeDecode), type:
pear install Mail_Mime-1.10.1
- Install Mail_mimeDecode
(More info, https://pear.php.net/package/Mail_mimeDecode), type:
pear install Mail_mimeDecode-1.5.6
- Install Net_DIME
(More info, https://pear.php.net/package/Net_DIME), type:
pear install Net_DIME-1.0.2
- Install Net_Socket
(More info, https://pear.php.net/package/Net_Socket), type:
pear install Net_Socket-1.2.2
- Install Net_URL
(More info, https://pear.php.net/package/Net_URL), type:
pear install Net_URL-1.0.15
- Install SOAP
(More info, https://pear.php.net/package/SOAP), type:
pear install SOAP-0.13.0
- Show the installed PEAR packages, type: pear list
You should see:
Installed packages, channel pear.php.net:
=========================================
Package Version State
Archive_Tar 1.4.2 stable
Console_Getopt 1.4.1 stable
HTTP_Request 1.4.4 stable
Log 1.13.1 stable
MDB2 2.5.0b5 beta
MDB2_Driver_mysql 1.5.0b4 beta
Mail 1.4.1 stable
Mail_Mime 1.10.1 stable
Mail_mimeDecode 1.5.6 stable
Net_DIME 1.0.2 stable
Net_Socket 1.2.2 stable
Net_URL 1.0.15 stable
PEAR 1.10.3 stable
SOAP 0.13.0 beta
Structures_Graph 1.1.1 stable
XML_Util 1.4.2 stable
|