linux下如何安装Php

墨辰丷
发布: 2018-05-15 15:06:54
原创
1779人浏览过

本篇文章主要介绍如何在linux下如何安装PHP,感兴趣的朋友参考下,希望对大家有所帮助。

linux 安装 php-5.4.5

1. 下载 php-5.4.5.tar.gz

2. 解压

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

3. 进入安装文件目录

立即学习PHP免费学习笔记(深入)”;

[root@test31~] cd php-5.4.5

4. 执行

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

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

出现问题:

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

检查是否安装了libxm包

[root@test31 php-5.4.5]# 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.5]#  find / -name "xml2-config"
/usr/bin/xml2-config

如果存在的话重新安装php

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

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

需要指定mysql的安装路径

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

安装成功的标志是:

出现

+--------------------------------------------------------------------+
| License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE.  By continuing this installation |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |
+--------------------------------------------------------------------+

Thank you for using PHP.

 相关推荐:

最详细的linux安装php过程

linux安装php 模块--with-mysql --with-mysqli非得需要安装mysql吗

Linux安装php报错记录

以上就是linux下如何安装Php的详细内容,更多请关注php中文网其它相关文章!

PHP速学教程(入门到精通)
PHP速学教程(入门到精通)

PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!

下载
相关标签:
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
作者最新文章
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号