linux php5.5安裝配置的方法:先下載PHP原始碼包;然後加入epel來源,建立www用戶;接著進行編譯安裝「/usr/local/src/php-5.5.15/」;最後配置PHP即可。
推薦:《PHP影片教學》
php5.5編譯安裝
系統環境:centos6.5
PHP套件:5.5.15
https://wiki.swoole.com/wiki/page/177.html
#下載PHP 原始碼包
wget http://cn2.php.net/distributions/php-5.5.15.tar.bz2
tar xf php-5.5.15.tar.bz2 -C /usr/local/src/
設定檔: /usr/local/php/etc/php-fpm.conf
##設定pid: /var/run/php-fpm/ php-fpm.pid錯誤日誌:error_log=/var/log/php-fpm.log /etc/php.ini新增 來源 來源#
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm yum install gcc bison bison-devel zlib-devel libmcrypt-devel mcrypt mhash-devel openssl-devel libxml2-devel libcurl-devel bzip2-devel readline-devel libedit-devel
groupadd www useradd -g www -s /sbin/nologin -M www
cd /usr/local/src/php-5.5.15/ ./configure \ --prefix=/usr/local/php \ --with-config-file-path=/etc \ --enable-inline-optimization \ --disable-debug \ --disable-rpath \ --enable-shared \ --enable-opcache \ --enable-fpm \ --with-fpm-user=www \ --with-fpm-group=www \ --with-mysql=/usr/local/mysql \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-gettext \ --enable-mbstring \ --with-iconv \ --with-mcrypt \ --with-mhash \ --with-openssl \ --enable-bcmath \ --enable-soap \ --with-libxml-dir \ --enable-pcntl \ --enable-shmop \ --enable-sysvmsg \ --enable-sysvsem \ --enable-sysvshm \ --enable-sockets \ --with-curl \ --with-zlib \ --enable-zip \ --with-bz2 \ --with-readline \ --without-sqlite3 \ --without-pdo-sqlite \ --with-pear
--with-apxs2=/usr/local/apache/bin/apxs 参数 --prefix=/usr/local/php \ 安装路径 --with-config-file-path=/etc \ php.ini配置文件路径 --enable-inline-optimization \ 优化项 --disable-debug \ --disable-rpath \ --enable-shared \ --enable-opcache \ 启用 opcache,默认为 ZendOptimizer+(ZendOpcache) --enable-fpm \ FPM --with-fpm-user=www \ --with-fpm-group=www \ --with-mysql=mysqlnd \ MySQL --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-gettext \ 国际化与字符编码支持 --enable-mbstring \ --with-iconv \ --with-mcrypt \ 加密扩展 --with-mhash \ --with-openssl \ --enable-bcmath \ 数学扩展 --enable-soap \ Web 服务,soap 依赖 libxml --with-libxml-dir \ --enable-pcntl \ 进程,信号及内存 --enable-shmop \ --enable-sysvmsg \ --enable-sysvsem \ --enable-sysvshm \ --enable-sockets \ socket & curl --with-curl \ --with-zlib \ 压缩与归档 --enable-zip \ --with-bz2 \ --with-readline \ GNU Readline 命令行快捷键绑定 --without-sqlite3 \ --without-pdo-sqlite \ --with-pear 更多 PHP 扩展与应用库
make -j4 make install
# make clean # make clean all # ./configure ... # make -j4 # make install
# cp php.ini-development /etc/php.ini
# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf # cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm # chmod +x /etc/init.d/php-fpm
# service php-fpm start Starting php-fpm done vi ~/.bash_profile PATH=$PATH:$HOME/bin
PATH=$PATH:$HOME/bin:/usr/local/php/bin
設定開機自啟動
echo service php-fpm start >> /etc/rc.local
# rpm -Uvh http://download.Fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm # rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
# yum install --enablerepo=remi,remi-php56 php php-opcache php-pecl-apcu php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof php-pdo php-pear php-fpm php-cli php-xml php-bcmath php-process php-gd php-common
vi /usr/local/php/etc/php-fpm.conf
cp /home/soft/php-5.3.15/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod 755 /etc/init.d/php-fpm /etc/init.d/php-fpm start chkconfig –add php-fpm
service php-fpm start service php-fpm stop service php-fpm reload
find / -name bcmath.so
php -i |grep php.ini
php warning: Module 'bcmath' already loaded in unknow on line 0
yum clean all rpm --rebuilddb yum update
yum install php-gd --enablerepo=remi-php56
以上是linux php 5.5 安裝設定方法的詳細內容。更多資訊請關注PHP中文網其他相關文章!