Mac編譯安裝PHP5.6
阿新 • • 發佈:2021-01-08
一、原始碼下載
原始碼下載 : wget http://mirrors.sohu.com/php/php-5.6.2.tar.gz
解壓:tar -zxvf php-5.6.2.tar.gz
進入目錄: cd php-5.6.2
二、配置初始化
./configure \ --prefix=/usr/local/php5.6 \ --with-mysql \ --with-mysqli \ --with-pdo-mysql \ --with-mhash \ --with-curl \ --with-gd \ --with-zlib \ --with-mcrypt \ --with-xpm-dir=/usr/X11/include \ --with-gd=/usr/local/Cellar/gd/2.3.0 \ --with-freetype-dir=/usr/local/Cellar/freetype/2.10.4 \ --with-jpeg-dir=/usr/local/Cellar/libjpeg \ --with-png-dir=/usr/local/Cellar/libpng/1.6.37 \ --with-libxml-dir=/usr/local/Cellar/libxml2/2.9.10_2 \ --with-zlib-dir=/usr/local/Cellar/zlib/1.2.11 \ --with-iconv=/usr/local/Cellar/libiconv/1.16 \ --with-curl=/usr/local/Cellar/curl/7.74.0 \ --with-config-file-path=/usr/local/php5.6/etc \ --enable-gd-native-ttf \ --enable-gd-jis-conv \ --enable-xml \ --enable-sockets \ --enable-simplexml \ --enable-soap \ --enable-sockets \ --enable-pdo \ --enable-cli \ --enable-fpm
找不到的依賴可以使用brew search/install安裝
三、編譯安裝
make && make install
四、配置檔案
cp php.ini-development /usr/local/php5.6/etc/php.ini cp /usr/local/php5.6/etc/php-fpm.conf.default /usr/local/php5.6/etc/php-fpm.conf /usr/local/php5.6/etc/php-fpm.conf 中 pid = run/php-fpm.pid ,不是這個就改成這個 /usr/local/php5.6/etc/php-fpm.conf 中 可以修改listen埠,nginx配置改為對應的埠即可 /usr/local/php5.6/sbin/php-fpm 啟動php-fpm
五、安裝擴充套件
下載相應擴充套件的tar.gz包
解壓,cd進入
執行PHP目錄下的 /usr/local/php5.6/bin/phpize
./configure --with-php-config=/usr/local/php5.6/bin/php-config
make && make install
查詢端口占用
sudo lsof -i:9001
sudo kill -9 34343