Centos下安裝php5.3.10

首先確認己安裝apache 2.2.22

下載php 5.3.10
下載地址: http://www.php.net

安裝
先安裝 libmcrypt
 yum install libmcrypt libmcrypt-devel
安裝PHP

./configure \
--prefix=/usr/local/php \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-mysql=/usr/local/mysql \
--with-pdo-mysql=/usr/local/mysql \
--enable-force-cgi-redirect \
--with-gd \
--with-ttf \
--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-dist   /usr/local/php/lib/php.ini
-------------------------------------------------------------------------------
 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文件,內容如下:
<? 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 = /usr/home
找到upload_tmp_dir
替換成 upload_tmp_dir = /usr/home/tmp
找到upload_max_filesize = 2M
替換成 upload_max_filesize =30M
post_max_size = 150M
post_max_size 大於 upload_max_filesize 爲佳
max_execution_time
默認是30秒.改爲
max_execution_time = 0
0表示沒有限制
 
 
 
phpMyAdmin 安裝
phpMyAdmin是一個用PHP編寫的,可以通過互聯網控制和操作MySQL。通過phpMyAdmin可以完全對數據庫進行操作,例如建立、複製/刪除數據等等。
下載地址 http://www.phpmyadmin.net
將解壓出的文件包上傳的網站目錄下,
找到config.sample.php 和 ./libraties/config.default.php,做以下修改:
 
 
# 一般默認
$cfg['Servers'][$i]['host'] = 'localhost';
 
#  config是不安全的,改成cookie
$cfg['Servers'][$i]['auth_type'] = 'cookie';
 
#此處隨便打幾個字符,不超過46個,如果爲空,會出現錯誤
$cfg['blowfish_secret'] = 'abcdefg';
$cfg['DefaultLang'] = 'zh';
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章