博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
CentOS6.5 下编译安装php-5.6.3.tar.gz
阅读量:2242 次
发布时间:2019-05-09

本文共 3263 字,大约阅读时间需要 10 分钟。

一、安装相关依赖库
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel curl curl-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers pcre pcre-devel
二、解压php包
tar -zxvf php-5.6.3.tar.gz
cd php-5.6.3
export LD_LIBRARY_PATH=/usr/local/libgd/lib
三、编译安装
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc/ --with-mysql=/usr/local/mysql --with-mysql-sock=/usr/local/mysql/mysql.sock --with-apxs2=/usr/local/apache/bin/apxs --with-gd --with-jpeg-dir --with-png-dir --enable-mbstring --enable-xml --enable-fpm --with-freetype-dir --with-mcrypt --with-mhash --with-libxml-dir --with-zlib-dir
make
make install
四、配置php
cp php.ini-production /usr/local/php/etc/php.ini #复制php配置文件到安装目录
===>
我安装的时候,放到这里不起作用,移动到/usr/local/php/lib 下,正常
rm -rf /etc/php.ini #删除系统自带配置文件
ln -s /usr/local/php/etc/php.ini /etc/php.ini #添加软链接到 /etc目录
vi /etc/php.ini
找到:disable_functions =
修改为:disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd, posix_getegid,posix_geteuid,posix_getgid, posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid,posix_getuid,posix_isatty, posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid, posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname
#列出PHP可以禁用的函数,如果某些程序需要用到这个函数,可以删除,取消禁用。
找到:;date.timezone =
修改为:date.timezone = PRC #设置时区
找到:expose_php = On
修改为:expose_php = Off #禁止显示php版本的信息
找到:short_open_tag = Off
修改为:short_open_tag = ON #支持php短标签
:wq! 保存
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf #拷贝模板文件为php-fpm配置文件
ln -s /usr/local/php/etc/php-fpm.conf /etc/php-fpm.conf #添加软连接到 /etc目录
vi /usr/local/php/etc/php-fpm.conf #编辑
user = www #设置php-fpm运行账号为www
group = www #设置php-fpm运行组为www
pid = run/php-fpm.pid #取消前面的分号
:wq! #保存退出
cp /home/php-5.6.3/sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm #拷贝php-fpm到启动目录
chmod +x /etc/rc.d/init.d/php-fpm #添加执行权限
chkconfig php-fpm on #设置开机启动
编辑apache配置文件httpd.conf,以apache支持php
# vim /etc/httpd/httpd.conf
添加如下
AddType application/x-httpd-php .php .phtml
定位至DirectoryIndex index.html
修改为:
DirectoryIndex index.php index.html
添加index.php为默认主页
重新启动apache
五、测试
在/usr/local/apache/htdocs目录下建一个test.php或test.phtml的文件,内容如下示:
<</FONT>
?
php
phpinfo();
?
>
:wq! #保存退出
=======================================================
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --disable-ipv6 --with-pear --with-curl --with-openssl

转载地址:http://yoebb.baihongyu.com/

你可能感兴趣的文章
Struts2中的session、request、respsonse获取方法
查看>>
如何理解MVC模型
查看>>
SpringMVC中乱码解决方案
查看>>
SpringMVC中时间格式转换的解决方案
查看>>
post和get请求相关知识点
查看>>
关于try finally 中的return语句的问题
查看>>
RequestBody/ResponseBody处理Json数据
查看>>
springmvc请求参数获取的几种方法
查看>>
在eclipse中创建和myeclipse一样的包结构
查看>>
Java中的IO流
查看>>
java中的关键字
查看>>
如果某个方法是静态的,它的行为就不具有多态性
查看>>
优化Hibernate所鼓励的7大措施
查看>>
Java 8系列之重新认识HashMap
查看>>
HashMap 、 ArrayList、String 重写了equals方法 而Object类(比如User)没有重写
查看>>
Servlet的生命周期
查看>>
Object中的getClass()返回的是当前运行的类
查看>>
加载驱动程序的方法
查看>>
深入理解java异常处理机制
查看>>
object类的基本方法
查看>>