搜索
首页php教程php手册Linux 安装 php

Linux 安装 php

Jun 06, 2016 pm 07:53 PM
linuxphp安装版本

Linux 版本 : Redhat6.2 php版本 : php-5.4.1 之前写过: Linux Apache 安装 Linux 安装 php-5.4.1 1. 下 载 php-5.4.1.tar.gz 2. 解压 [root@test31~] tar -zxvf php-5.4.1.tar.gz 3. 进入安装文件目录 [root@test31~] cd php-5.4.1 4. 执行 [root@test31

Linux 版本: Redhat6.2

php版本   php-5.4.1

之前写过: Linux Apache 安装

Linux 安装 php-5.4.1

1. 下载 php-5.4.1.tar.gz

2. 解压

[root@test31~] tar -zxvf php-5.4.1.tar.gz

3. 进入安装文件目录

[root@test31~] cd php-5.4.1

4. 执行

[root@test31 php-5.4.1]# ./configure --prefix=/usr/local/php5--with-apxs2=/usr/local/web/apache/bin/apxs--with-mysql

注意:绿色标记为你 apache的安装目录

出现问题:

"configure: error: xml2-config not found.Please check your libxml2 installation."

检查是否安装了libxm包

[root@test31 php-5.4.1]# rpm -qa |grep libxml2
libxml2-2.6.26-2.1.12
libxml2-python-2.6.26-2.1.12

重新安装libxml2和libxml2-devel包

yum install libxml2

yum install libxml2-devel -y

安装完之后查找xml2-config文件是否存在

[root@test31 php-5.4.1]#  find / -name"xml2-config"
/usr/bin/xml2-config

如果存在的话重新安装php

[root@test31 php-5.4.1]# ./configure --prefix=/usr/local/php5--with-apxs2=/usr/local/web/apache/bin/apxs--with-mysql

执行如果报错:  Cannot find MySQL header files under yes

需要指定mysql的安装路径

[root@test31 php-5.4.1]# ./configure --prefix=/usr/local/php5--with-apxs2=/usr/local/web/apache/bin/apxs --with-mysql=/usr/local/mysql

安装成功的标志是:

出现

+--------------------------------------------------------------------+
|License:                                                          |
| This software is subject to the PHP License, available inthis    |
| distribution in the file LICENSE.  By continuingthis installation |
| process, you are bound by the terms of this licenseagreement.    |
| If you do not agree with the terms of this license, you mustabort |
| the installation process at thispoint.                           |
+--------------------------------------------------------------------+

Thank you for using PHP.

 5.然后执行

[root@test31 php-5.4.1]# make

[root@test31 php-5.4.1]# make install

6. 配置 php.ini

<span>[root@test31 php-5.4.1]# cp php.ini-development /usr/local/lib/php.ini</span>

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

[root@test31 php-5.4.1]# vi/usr/local/web/apache/conf/httpd.conf

<span>LoadModule php5_module modules/libphp5.so</span>

再加入一行让apache正确处理apache文件

AddType application/x-httpd-php.php

再找到 DirectoryIndex关键字:添加 index.php

开启.httaccess功能

AllowOverrideAll

保存对httpd.conf的修改。

8. 查看是否安装成功

在apache的htdocs目录下建立文件phpinfo.php 输入代码

phpinfo();

?>

保存,并启动apache。

[root@test31 bin]#./apachectl start

9.打开网址: http://192.168.2.9/phpinfo.php

出现php相关的信息,说明php-5.4.1 安装成功了! 

参考 php 官方文档: http://www.php.net/manual/zh/install.unix.apache2.php

声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

AI Hentai Generator

AI Hentai Generator

免费生成ai无尽的。

热门文章

R.E.P.O.能量晶体解释及其做什么(黄色晶体)
3 周前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳图形设置
3 周前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.如果您听不到任何人,如何修复音频
3 周前By尊渡假赌尊渡假赌尊渡假赌
WWE 2K25:如何解锁Myrise中的所有内容
3 周前By尊渡假赌尊渡假赌尊渡假赌

热工具

SublimeText3 Mac版

SublimeText3 Mac版

神级代码编辑软件(SublimeText3)

SublimeText3汉化版

SublimeText3汉化版

中文版,非常好用

禅工作室 13.0.1

禅工作室 13.0.1

功能强大的PHP集成开发环境

记事本++7.3.1

记事本++7.3.1

好用且免费的代码编辑器

适用于 Eclipse 的 SAP NetWeaver 服务器适配器

适用于 Eclipse 的 SAP NetWeaver 服务器适配器

将Eclipse与SAP NetWeaver应用服务器集成。