-
相关依赖包的检查与安装 rpm -qa zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel rpm -qa freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel yum -y install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel yum -y install freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel rpm -qa zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel rpm -qa freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel
-
安装其他依赖以其他包 cd /home/oldboy/tools/ wget https://ftp.gnu.org/gnu/libiconv/libiconv-1.14.tar.gz #下载安装包 ,yum源中没有 tar zxvf libiconv-1.14.tar.gz #解压 ./configure --prefix=/usr/local/libconv make
make install
安装libiconv软件时,可能会报错:*gets未声明,不在函数内等*
解决方法:cd /usr/local/libiconv/srclib
sed -i -e '/gets is a security/d' ./stdio.in.h
3.安装其他软件
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum -y install libmcrypt-devel
yum -y install mhash
yum -y install mcrypt
4.cd /home/tools 上传php-5.6.36.tar.gz
5.解压:tar -zxvf php-5.6.36.tar.gz
cd php-5.6.36
./configure --prefix=/application/php5.6.36
--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-mcrypt
--with-gd
--enable-gd-native-ttf
--with-openssl
--with-mhash
--enable-pcntl
--enable-sockets
--with-xmlrpc
--enable-soap
--enable-short-tags
--enable-static
--with-xsl
--with-fpm-user=www
--with-fpm-group=www
--enable-ftp
--enable-opcache=no
ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/
touch ext/phar/phar.phar
make
make install
ln -s /application/php5.6.36/ /application/php
cp php.ini-production /application/php/lib/php.ini
cd /application/php/etc/
cp php-fpm.conf.default php-fpm.conf
/application/php/sbin/php-fpm 启动php-fpm
ps -ef |grep php-fpm
lsof -i:9000
说明:
1. --with-mysql=/application/mysql mysql的安装位置
2. --with-fpm-user=www nginx的用户
3. --with-fpm-group=www nginx的组
4. 按照上面的安装之后,测试nginx配合php解析没有问题,在php与mysql连接时,会出现500错误,经过一番努力得以解决:
5. yum install php-mysql -y
6. 编辑php.ini文件:修改前:mysqli.default_socket = 修改后:mysqli.default_socket =/tmp/mysql.sock cat /etc/my.cnf 查看mysql.sock的位置,寻找socket。
7. 在编写linux与mysql连接的测试文件时,注意其编码格式!注意格式!注意格式!不要复制!不要复制!不要复制!:
<?php
$link=mysqlconnect("localhost", "root", "workjob");
if ( $link ) {
echo "success";
}
else{
echo mysqlerror();
}
?>**