12.编译安装php-5.3.2 需要先安装如下包
curl-7.16.1.tar.gz freetype-2.3.12.tar.gz jpegsrc.v8b.tar.gz libpng-1.4.2.tar.gz gd-2.0.35.tar.gz libmcrypt-2.5.8.tar.gz mhash-0.9.9.9.tar.gz mcrypt-2.6.8.tar.gz
(1)编译libpng-1.4.2.tar.gz
tar -zvxf libpng-1.4.2.tar.gz
cd libpng-1.4.2
/sbin/ldconfig
./configure --prefix=/usr/local/libpng
make
make install
(2)安装Curl-7.16.1库
这个一般不用安装
tar -zvxf curl-7.16.1.tar.gz
cd curl-7.16.1
mkdir -p /usr/local/curl
./configure --prefix=/usr/local/curl
make
make install
(3)安装 freetype
tar -zvxf freetype-2.3.12.tar.gz
cd freetype-2.3.12
./configure --prefix=/usr/local/module/freetype
make
make install
(4)安装 jpeg8
建立目录:
mkdir -p /usr/local/module/jpeg8
mkdir -p /usr/local/module/jpeg8/bin
mkdir -p /usr/local/module/jpeg8/lib
mkdir -p /usr/local/module/jpeg8/include
mkdir -p /usr/local/module/jpeg8/man
mkdir -p /usr/local/module/jpeg8/man1
mkdir -p /usr/local/module/jpeg8/man/man1
tar -zvxf jpegsrc.v8b.tar.gz
cd jpeg-8b
./configure --prefix=/usr/local/module/jpeg8 --enable-shared --enable-static
makecd
make install
* jpeg8安装文件中没有写创建目录的命令
(5)安装libmcrypt-2.5.8.tar.gz
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure
make
make install
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make
make install
cd ../../
(6)安装mhash-0.9.9.9.tar.gz
tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9/
./configure
make
make install
cd ../
ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
(7)安装 mcrypt-2.6.8.tar.gz
tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
/sbin/ldconfig
./configure
make
make install
cd ../
编译安装 mcrypt-2.6.8.tar.gz 需要指定LD_LIBRARY_PATH路径
LD_LIBRARY_PATH=/usr/local/lib ./configure
(8)安装gd-2.0.35.tar.gz
tar zxvf gd-2.0.35.tar.gz
cd gd
./configure --with-png=/usr/local/lib --with-freetype=/usr/local/module/freetype --with-jpeg=/usr/local/module/jpeg8 --enable-m4_pattern_allow
make
make install
cp gd.h /usr/local/lib/ #如果没有copy这一步,安装php时会报错:
#configure: error: Unable to find gd.h anywhere under /usr/local/lib
安装GD库错误解决方法 configure.ac:64: error: possibly undefined macro: AM_ICONV
到 http://www.gnu.org/software/gettext/下载了gettext-0.17.tar.gz
cp /usr/lib/libattr.* /lib/ (这个在转载的文章里没说,是因为make的时候报错说没有libattr.la这个文件,所以要复制过去)
tar xzf gettext-0.17.tar.gz
cd gettext-0.17
./configure
make
make install
编译PHP时报错:configure: error: libpng.(a|so) not found.
locate libpng.so
解决办法:
#ln -sf libpng.so.3.18.0 libpng.so
cp /usr/lib/libpng.so.3 /usr/local/lib/linpng.so.3
编译php开始
./configure --prefix=/usr/local/php5 --with-gd=/usr/local/lib --with-jpeg-dir=/usr/local/module/jpeg8 --with-zlib --with-png-dir=/usr/local/lib --with-freetype-dir=/usr/local/module/freetype --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql --with-iconv --enable-mbstring --with-pear --with-apxs2=/usr/local/apache2/bin/apxs --with-libxml-dir=/usr/lib --with-curl=/usr/local/curl --with-mcrypt=/usr/local/lib --with-mhash=/usr/local/lib --with-config-file-path=/etc --enable-zip --with-config-file-path=/usr/local/php5/etc
make
make install
make clean
由于版本更新,这些文件有了新的命名:
php.ini-production对应于php.ini-recommended
php.ini-development对应于php.ini-dist
cp php.ini-development /usr/local/php5/etc/php.ini
配置/usr/local/php5/etc/php.ini
去掉
extension=php_gd
extension=php_mysql.dll
extension=php_mysqli.dll
前面的;
13.编译httpd.conf
# vi /usr/local/apache2/conf/httpd.conf
要改的有如下几处:
找到LoadModule php5_module modules/libphp5.so
前面的#号去掉(默认已去掉注释)
#AddType application/x-gzip .gz .tgz
下加二行
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
还有找到DirectoryIndex index.html
加上 index.php 让它把index.php做为默认页
如果启用了SELinux的话还需要执行如下命令
setenforce 0
chcon -t texrel_shlib_t /usr/local/apache2/modules/libphp5.so
service httpd restart
setenforce 1
重新启动apache服务器
service httpd restart
*PHP提示这样的警告:
Warning: date() [function.date]: It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘UTC’ for ’8.0/no DST’ instead in D:\htdocs\index.php on line 5
解决方法:这是因为时区的问题,在php.ini找到date.timezone,修改为date.timezone = PRC,并将前面的分号注释去掉,重启Apache即可。
14安装phpmyadmin
官方下载(不要最新版本,下phpMyAdmin 2.11.9.5就行了,3.1以上需php 5.2以上),上传到你的网站目录下,然后进行配置。只需几步即可搞定。
I. config.sample.inc.php更名为config.inc.php;
II. 打开config.inc.php文件,进行以下修改;
// $cfg['Servers'][$i]['controluser'] = ‘pma’;
// $cfg['Servers'][$i]['controlpass'] = ‘pmapass’;
// $cfg['Servers'][$i]['pmadb'] = ‘phpmyadmin’;
// $cfg['Servers'][$i]['bookmarktable'] = ‘pma_bookmark’;
// $cfg['Servers'][$i]['relation'] = ‘pma_relation’;
// $cfg['Servers'][$i]['table_info'] = ‘pma_table_info’;
// $cfg['Servers'][$i]['table_coords'] = ‘pma_table_coords’;
// $cfg['Servers'][$i]['pdf_pages'] = ‘pma_pdf_pages’;
// $cfg['Servers'][$i]['column_info'] = ‘pma_column_info’;
// $cfg['Servers'][$i]['history'] = ‘pma_history’;
// $cfg['Servers'][$i]['designer_coords'] = ‘pma_designer_coords’;
去掉每行前面的//;
II.$cfg['blowfish_secret'] = ”; |修改为| $cfg['blowfish_secret'] = ‘http’;
IV.$cfg['Servers'][$i]['controluser'] = ‘pma’; |把’pma’修改为你的帐号|$cfg['Servers'][$i]['controlpass'] = ‘pmapass’; |把’pmapass设置为你的mysql登录密码|
V. $cfg['blowfish_secret'] = ”; | 添加短语密码例如:$cfg['blowfish_secret'] = ‘onohot’;
15安装Zend Optimizer
#安装Zend Optimizer: Zend Optimizer(以下简称ZO)用优化代码的方法来提高PHP 4.0应用程序的执行速度。实现的原理是对那些在被最终执行之前由运行编译器(Run-Time Compiler)产生的代码进行优化。一般情况下,执行使用ZO的PHP程序比不使用的要快40%到100%
tar -zxvf ZendOptimizer-3.0.1-linux-glibc21-i386.tar.gz
cd ZendOptimizer-3.0.1-linux-glibc21-i386
./install-tty
Please specify the location for installing Zen Optimizer:
/usr/local/Zend
Enter the location of your php.ini file
/etc/php5/apache2
Are you using Apache Web server?
Specify the full path to the Apache control utility (apachectl)
/usr/sbin/apache2ctl
上述工作完成后,会有提示问你是否要重新启动Web server,当然是回答Yes。
接下来 会有几个提示…
Please specify the location for installingzend Optimizer:
/usr/local/Zend
Enter the location of your php.ini file:
/etc/php5/apache2(这个路径不行的话,通过命令:# find / -name php.ini,可以找到你本机的路径,然后填进去)
Specify the full path to the Apachecontrol utility(apachectl):
/usr/sbin/apache2ctl
Installation couldn’ detect the location of Apache executable. Pleaes specify the full path to the Apache binary (httpd):
/etc/init.d/apach2
Please specify the full path to the Apache configuration file (httpd.conf):
/etc/init.d/apach2
至此zendoptimizer程序安装完毕。
然后打开PHP.INI 在最后面加上以下内容(如果打开PHP.IN发现已经有了就不需要在添加了)
php 5.3的暂时不被支持
注意: 在配置完整个架构后,将服务所需要的端口在防火墙出打开。
ftp服务
[root@localhost ~]# rpm -qa | grep vsftpd ...........查看是否已经安装了vsftpd软件
如果没有
yum install vsftpd
本机是已经安装
vsftpd-2.0.5-16.el5_5.1 ..........................已经安装了vsftpd-2.0.5-16.el5_4.1
[root@localhost ~]#
启动vsftpd服务:
[root@localhost ~]# service vsftpd start
为 vsftpd 启动 vsftpd: [确定]
#chkconfig --level 35 vsftpd on 让vsftpd开机启动
配置vsftpd
修改配置文件/etc/vsftpd/vsftpd.conf
让匿名用户访问并上传,我们
anonymous_enable=YES
anon_umask=002 //上传的东西本组拥有所有的权限,以便于删除
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=yes
本地用户创建文件的权限
local_umask=002 //同组的人拥有所有的权限
最后修改
userlist_enable=yes
userlist_deny=yes
local_root=/var/ftp //把local用户限制到/var/ftp目录下
说明
/usr/sbin/adduser -d /opt/test_ftp -g ftp -s /sbin/nologin test
使用命令(adduser)添加test用户,不能登录系统(-s /sbin/nologin),自己的文件夹在(-d /opt/test_ftp)),属于组ftp(-g ftp)
然后你需要为它设置ftp登录密码 passwd test
passwd test
Changing password for user test.
New UNIX password:
Changing password for user test.New UNIX password:
注意:这里的密码要求为字母和数字的组合才可以,如果不符合密码验证机制的话就修改不成功,
会有各种报错,“BAD PASSWORD: it's WAY too short”,这是报密码太短,不符合/etc/login.defs的设置,
“BAD PASSWORD: it is based on your username”,这是密码与帐号不能同名,这是不符合/etc/pam.d/passwd的设置。
“BAD PASSWORD: it is based on a dictionary word”这是因为出现了字典里的字符串,如果你英文与数字组合使用,就不会报错。