Linux下PHP下载安装
生活随笔
收集整理的這篇文章主要介紹了
Linux下PHP下载安装
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
一.? ?安裝
1.??? yum 安裝
yum install php –y
?
2.??? 源碼安裝
1)?? 在官方網站(php.net)上下載php到本地。
wget http://cn2.php.net/distributions/php-5.6.30.tar.gz
2)?? 解壓縮
tar –xf php-5.6.30
3)?? 進入目錄
cd php-5.6.30
4)?? 創建文件夾
mkdir /usr/local/php
5)?? 安裝依賴
yum install libxml2-devel –y
全部包如下:
yum -y install openssl
yum -y install openssl-devel
yum -y install curl
yum -y install curl-devel
yum -y install libjpeg
yum -y install libjpeg-devel
yum -y install libpng
yum -y install libpng-devel
yum -y install freetype
yum -y install freetype-devel
yum -y install pcre
yum -y install pcre-devel
yum -y install libxslt
yum -y install libxslt-devel
yum -y install bzip2
yum -y install bzip2-devel?
?
6)?? 安裝
./configure --prefix=/usr/local/php ?--with-zlib --enable-zip --with-openssl --enable-fpm --enable-mbstring --with-libdir=lib64 --without-pear ?--disable-phar
注:如果要連接mysql,需要加上 --with-mysql=/usr/local/mysql
如果想后裝mysql,需要加上 --with-mysql=mysqlnd
如果連接nginx,最好加上 --with-fpm-user=www? --with-fpm-group=www
?????????????? 全部如下:
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-curl --with-freetype-dir --with-gd --with-gettext--with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-bz2 --with-mhash --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-gd-native-ttf --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-zip
注:32位系統要去掉--with-libdir=lib64。
make && make install
7)?? 拷貝服務腳本到init.d目錄
cp /usr/local/php/sbin/php-fpm /etc/init.d/php-fpm
8)?? 添加執行權限
chmod +x /etc/init.d/php-fpm
9)?? 拷貝配置文件
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp xxw/tools/php-5.6.30/php.ini-production /usr/local/php/etc/php.ini #前面為你下載解壓后的目錄
二.? PHP配置
php的配置文件為 php.ini
如果前面配置的時候沒有加用戶和組,這里可以直接打開/usr/local/php/etc/php-fpm.conf
將里面的user = nobody,改為和nginx一樣的用戶和組。
總結
以上是生活随笔為你收集整理的Linux下PHP下载安装的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【JAVA之NIO框架介绍】
- 下一篇: 创灵原始与鸿蒙,上古启示录