B、安装PHP
tar xzvf php-4.3.10.tar.gz
cd php-4.3.10
./configure --prefix=/usr/local/php --with-gd=/usr/local/modules/gd --with-jpeg-dir=/usr/local/modules/jpeg6 --with-zlib --with-png --with-freetype-dir=/usr/local/modules/freetype --enable-magic-quotes --with-mysql=/usr/local/mysql --with-iconv --with-mbstring --with-apxs2=/usr/local/apache2/bin/apxs --enable-track-vars --enable-force-cgi-redirect --enable-ftp --with-config-file-path=/etc
一点说明:
--prefix=/usr/local/php 指定把php安装到/usr/local/php目录中;
--with-mysql=/usr/local/mysql 指定mysql数据服务器安装的位置;
--with-apxs2=/usr/local/apache2/bin/apxs 这是加入apache中为DSO模块的位置;
-enable-track-vars 为启动cookie的get/post等追踪功能
--with-config-file-path=/etc 指定php的配制文件存放的目录是/etc目录,我们安装完成后,也要把php.ini复制到这个目录中来。
make
make install
cp php.ini-dist /etc/php.ini
更改apache的配制文件:得加几行,目的是让apache能解释php程序。
查找AddType application/x-tar .tgz 行,在下面添加
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
找到下面一行在后面加上index.php,这表示网站的默认页也能够为index.php
DirectoryIndex index.html index.php
进行php.ini文件的配置工作
查找safe_mode=Off,更改为safe_mode=On
1)查找max_execution_time = 30,更改为max_execution_time = 600
(2)查找max_input_time = 60,更改为max_input_time = 600
(3)查找memory_limit = 8M ,更改为memory_limit = 20M
(4)查找display_errors = On,更改为display_errors = Off
(5)查找register_globals = Off,更改为register_globals = On
(6)查找post_max_size = 8M,更改为post_max_size = 20M
(7)查找upload_max_filesize = 2M,更改为upload_max_filesize = 20M
(8)查找session.auto_start = 0,更改为session.auto_start = 1
保存后退出,从而完成了php.ini文件的配置工作。