源码安装PHP

1158阅读 0评论2011-04-19 linuxflj
分类:LINUX

1. yum install –y libxml*                                               提供静态和动态支持的软件包

 

2. tar –xjvf 源码包> -C /usr/src/

 

3. cd /usr/src/php-5.2.6/                                                配置。。。

  ./configure –prefix=/usr/local/php5 –enable-mbstring –with-apxs2=/usr/local/apache2/bin/apxs

  --with-mysql=/usr/local/mysql –with-config-file-path=/usr/local/php5

 

5. make && make install                                              编译和安装。。。

 

6.cd  /usr/src/php-5.2.6/

Cp php.ini-dist /usr/local/php5/php.ini

 

7 vi /usr/local/apache2/conf/httpd.conf

  AddType application/x-httpd-php .php            309

  DirectoryIndex index.php index.html              167

 

8 service httpd restart

 

9 cd /usr/local/apache2/htdocs/                                      php测试网页

  Vi test.php                                                                编辑php测试网页

 

  ppinfo();

  ?>

 

  Vi testdb.php                                                            编辑php+数据库测试网页

 

  $link=mysql_connect(localhost','test','');

 if(!$link) echo Fall !!;

 else echo Success !!;

 msql_close();

  ?>

 

9. /test.php                                           测试网页

  /testdb.php

 

10.

 

  以虚拟主机的方式访问时,需要将网页复制到虚拟目录下:

  Cp –a test.php testdb.php ./benetcom/