将698行的代码:_GL_WARN_ON_USE (gets, "gets is a security hole - use fgetsinstead");替换为:
#if defined(__GLIBC__)&& !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)
_GL_WARN_ON_USE (gets, "gets is asecurity hole - use fgets instead");
#endif
##这个问题centos6.8里没有遇到过
[root@linuxidc LAMP]# cd php-5.3.27/
[root@linuxidc php-5.3.27]# yum install libxml2-devel.x86_64 libxml2.x86_64 openssl-devel.x86_64 libcurl-devel.x86_64 libjpeg-turbo.x86_64 libjpeg-turbo-devel.x86_64 png* libpng-devel.x86_64 freetype.x86_64 freetype-devel.x86_64 libxslt-devel.x86_64 libxslt.x86_64
##以上是安装PHP所必须的包,一个不能落下
2 新建一个文件填入如下参数,可以直接复制,参数看个人所需求吧,不一定要这些,还有很多参数。
[root@linuxidc php-5.3.27]# vim 1.txt
./configure \
--prefix=/application/php5.3.27 \
--with-apxs2=/application/apache/bin/apxs \
--with-mysql=/application/mysql \
--with-xmlrpc \
--with-openssl \
--with-zlib \
--with-freetype-dir \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-iconv=/usr/local/libiconv \
--enable-short-tags \
--enable-sockets \
--enable-zend-multibyte \
--enable-soap \
--enable-mbstring \
--enable-static \
--enable-gd-native-ttf \
--with-curl \
--with-xsl \
--enable-ftp \
--with-libxml-dir
##上面apache的路劲和mysql路径必须正确。
[root@linuxidcphp-5.3.27]# make && make installmake
[root@linuxidcphp-5.3.27]# cd /application/
[root@linuxidc application]# ln -s php5.3.27/ php
[root@linuxidc application]# cd -
/home/tools/LAMP/php-5.3.27
[root@linuxidc php-5.3.27]# cp php.ini-production /application/php/lib/php.ini
4编辑httpd配置文件
[root@linuxidc php-5.3.27]# cd /application/apache/conf/
[root@linuxidc conf]# vim httpd.conf
DirectoryIndex index.html index.php
##在169行添加index.php
AddTypeapplication/x-httpd-php .php .phtml(注意.php和.phtml的空格)
AddTypeapplication/x-httpd-php-source .phps(注意.phps前的空格)
##在311行添加上面两个配置
去站点下添加一个index.php页面,测试PHP和mysql的工作状态是否OK
vim index.php
<?php
//$link_id=mysql_connect('主机名','用户','密码');
$link_id=mysql_connect('localhost','root','*******') or mysql_error();
if($link_id){
echo "mysqlsuccessful by linuxidcde lake !";
}else{
echo mysql_error();
}
?>
[root@linuxidc num1]# /application/apache/bin/apachectl graceful