install php

WBOY
Release: 2016-06-23 14:37:24
Original
1110 people have browsed it

3、安装PHP
  在现行的官方网站上的PHP版本是无法与Apache2整合于一起的,必须先到 http://snaps.php.net 上下载PHP的最新开发版本。该站点是PHP团队开发中与Apache2整合的新版本,每天更新。
  将php4-latest.tar.gz复制到/usr/local/src目录下
  # tar zxvf php4-latest.tar.gz
  # cd php4-200208212100 (目录会有所不同)
  # ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-mail --with-apxs2=/usr/local/apache/bin/apxs --enable-track-vars
  # make
  # make install
  # cp php.ini-recommended /usr/local/php/lib/php.ini
  虽然很多文章都是以php.ini-dist作为配置文件的,但出于安全上的考虑,笔者更喜欢用recommended的。^_^

4、更新链接库及添加PHP识别
  # vi /etc/ld.so.conf
  在最后添加 /user/local/mysql/lib
  保存退出
  # ldconfig
  # vi /usr/local/apache/conf/httpd.conf
  在适当的位置添加下面语句以识别PHP文件
  AddType application/x-httpd-php .php
  LoadModule php4_module modules/libphp4.so
  在DirectoryIndex后面添加index.php

  附注: 在网路上的某些文章中对于PHP的识别采用Filter的模式,如下语句:
AddType text/html .php
AddInputFilter PHP .php
AddOutputFilter PHP .php
  但经笔者多次验证,目前的版本中还无法用Filter的模式识别PHP,仍须用LoadMoudle的方式。或是笔者操作有误,如果你成功了,麻烦告诉我。

至此,Linux下的Apache2+PHP+MySQL整合完成。^_^

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!