Centos 中 PHP安装方法步骤

2021-04-02 23:25

阅读:508

标签:ini   ash   freetype   etc   目录   依赖   libc   pos   php安装   

安装需要的依赖

yum install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel -y
yum install freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libxslt-devel -y

单独安装依赖 libiconv-devel

cd /tools/
wget http://mirrors.ustc.edu.cn/gnu/libiconv/libiconv-1.14.tar.gz
tar zxf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/application/libiconv
make
echo $?

make install
echo $?

安装PHP需要的依赖服务

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

yum install -y libmcrypt-devel mhash mcrypt

下载PHP包到/tools/目录下
tar xf php-5.5.3.tar.gz
cd /php-5.5.3

编译 安装"\"后不能有空格

./configure \
--prefix=/application/php-5.5.3 \
--enable-mysqlnd \
--with-mysql=/application/mysql \
--with-pdo-mysql=mysqlnd \
--with-iconv-dir=/usr/local/libiconv \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir=/usr \
--enable-xml \
--disable-rpath \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--with-gd \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-soap \
--enable-short-tags \
--enable-static \
--with-xsl \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-ftp \
--enable-opcache=no

预防报错预先配置

ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/

touch ext/phar/phar.phar ###在下载减压后的php-x.x.目录

make

echo $?

make install

echo $?

ln -s /application/php-5.5.3/ /application/php

安装完成

php配置

cd /tools/php-5.3.3 #此目录为php的解压目录,比较php的2个配置文件的不同

vimdiff php.ini*

cp /tools/php-5.5.3/php.ini-production /application/php/lib/php.ini ##"php.ini-production"为生产环境的默认配置(关掉大部分报错提示)

切入进程目录:cd /application/php/etc/ ##(php-fpm.conf.default )

修改文件:cp php-fpm.conf.default php-fpm.conf

启动进程:/application/php/sbin/php-fpm

查看端口:lsof -i :9000

查看进程:ps -ef |grep php-fpm

Centos 中 PHP安装方法步骤

标签:ini   ash   freetype   etc   目录   依赖   libc   pos   php安装   

原文地址:https://blog.51cto.com/12289801/2480822


评论


亲,登录后才可以留言!