Home > php教程 > php手册 > Linux下安装PHP 5.4.3(以Apache为WebServer)

Linux下安装PHP 5.4.3(以Apache为WebServer)

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 19:50:49
Original
1472 people have browsed it

本文为Rainisic http://www.cnblogs.com/rainisic/archive/2012/05/23/Apache_PHP_Install.html 下载PHP 官方下载:http://www.php.net/downloads.php 安装PHP 首先,确保Apache在编译安装时支持PHP模块,详情请参考:http://www.cnblogs.com/rainisic/archi

本文为Rainisic

http://www.cnblogs.com/rainisic/archive/2012/05/23/Apache_PHP_Install.html

下载PHP

官方下载:http://www.php.net/downloads.php

安装PHP

首先,确保Apache在编译安装时支持PHP模块,详情请参考:http://www.cnblogs.com/rainisic/archive/2012/05/23/Linux_Apache2_4_Install.html

解压缩PHP

shell> <span>sudo</span> <span>tar</span> zxvf php-<span>5.4</span>.<span>3</span>.<span>tar</span>.gz /opt/sources
Copy after login

停止Apache服务

shell> <span>sudo</span> service httpd stop
Copy after login

配置安装PHP

shell> cd /opt/sources/php-<span>5.4</span>.<span>3</span><span>
shell</span>> <span>sudo</span> ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-<span>mysql
shell</span>> <span>sudo</span> <span>make</span><span>
shell</span>> <span>sudo</span> <span>make</span> <span>install</span>
Copy after login

配置php.ini

shell> <span>sudo</span> <span>cp</span> php.ini-development /usr/local/lib/php.ini
Copy after login

编辑 httpd.conf 文件以调用 PHP 模块。LoadModule 表达式右边的路径必须指向 系统中的 PHP。以上的 make install 命令可能已经完成了这些,但务必要检查。

LoadModule php5_module modules/libphp5.so
Copy after login

告知 Apache 将特定的扩展名解析成 PHP,例如,让 Apache 将扩展名 .php 解析成 PHP。编辑httpd.conf

<filesmatch><span>
    SetHandler application</span>/x-httpd-<span>php
</span></filesmatch>
Copy after login

按照通常的方式启动 Apache 服务测试即可。

扩展阅读

  • PHP官方安装文档:http://www.php.net/manual/zh/install.unix.apache2.php
  • Apache2安装:http://www.cnblogs.com/rainisic/archive/2012/05/23/Linux_Apache2_4_Install.html
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
Latest Issues
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template