Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1155178
  • 博文数量: 220
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1769
  • 用 户 组: 普通用户
  • 注册时间: 2015-03-13 16:19
个人简介

努力, 努力, 再努力

文章分类

全部博文(220)

文章存档

2018年(8)

2017年(46)

2016年(75)

2015年(92)

我的朋友

分类: 系统运维

2015-06-20 11:54:38

  1. 下载php 5.3.10

 

下载地址:

2. 安装

先安装所所需的组件包

 

yum install libxml2-devel.x86_64 openssl-devel.x86_64 bzip2-devel.x86_64 curl-devel.x86_64 libjpeg-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_64 libmcrypt-devel.x86_64 libtool-ltdl-devel.x86_64  -y

 

*******************************************************************************

 

3. 安装PHP 5.3.10

./configure \
--prefix=/usr/local/php \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-mysql=/usr/local/mysql \
--with-pdo-mysql=/usr/local/mysql \
--with-mysqli \
--with-gd \
--with-openssl \
--enable-gd-native-ttf \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-zlib \
--with-gettext \
--with-curl \
--with-iconv \
--with-bz2 \
--with-mcrypt \
--enable-soap \
--enable-sockets \
--enable-mbstring=all \
--enable-bcmath \
--enable-ftp

 

#> make

#> make install

#> cp php.ini-production   /usr/local/php/lib/php.ini

-------------------------------------------------------------------------------

安装php5.3, php.ini中 改:

short_open_tag = On

date.timezone = "Asia/Chongqing"

 

PHP5.3安装Zend Optimizer,已经被正式改成了“Zend Guard Loader”,

下载:

ZendGuardLoader.so 拷到 apache/modules

php.ini中加入:

 

zend_extension=/usr/local/apache/modules/ZendGuardLoader.so

zend_loader.enable=1

zend_loader.disable_licensing=0

重启apache

-------------------------------------------------------------------------------

 

httpd.conf配置文件中添加:

AddType application/x-httpd-php .php .php3

DirectoryIndex 一行后添加  index.php

 

在虚拟主机下加上下一条,控制权限

php_admin_value open_basedir "/tmp/:/usr/local/www/"

 

测试:编写test.php文件,内容如下:

 

 phpinfo();

?>

 

修改php.ini

屏蔽带来安全隐患的函数

找到disable_functions函数,加入 disable_functions = chmod,exec,system,passthru,shell_exec,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,dl,popen,curl_exec,popen,pcntl_exec,socket_accept,socket_bind,socket_clear_error,socket_close,socket_connect,socket_create_listen,socket_create_pair,socket_create,socket_get_option,socket_getpeername,socket_getsockname,socket_last_error,socket_listen,socket_read,socket_recv,socket_recvfrom,socket_select,socket_send,socket_sendto,socket_set_block,socket_set_nonblock,socket_set_option,socket_shutdown,socket_strerror,socket_write,stream_socket_client,stream_socket_server,pfsockopen,disk_total_space,disk_free_space,chown,diskfreespace,getrusage,get_current_user,getmyuid,getmypid,dl,leak,listen,chgrp,link,symlink,dlopen,proc_nice,proc_get_stats,proc_terminate,shell_exec,sh2_exec,posix_getpwuid,posix_getgrgid,posix_kill,ini_restore,mkfifo,dbmopen,dbase_open,filepro,filepro_rowcount,posix_mkfifo,putenv,sleep

修改register_globals = on

找到open_basedir

替换成 open_basedir = /data/web

找到upload_tmp_dir

替换成 upload_tmp_dir = /usr/home/tmp

找到upload_max_filesize = 2M

替换成  upload_max_filesize =20M

post_max_size = 30M

post_max_size 大于 upload_max_filesize 为佳

max_execution_time

默认是30.改为

max_execution_time = 0

0表示没有限制

 

重启 apache

阅读(3273) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~