検索

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 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

AI Hentai Generator

AI Hentai Generator

AIヘンタイを無料で生成します。

ホットツール

SublimeText3 Linux 新バージョン

SublimeText3 Linux 新バージョン

SublimeText3 Linux 最新バージョン

Dreamweaver Mac版

Dreamweaver Mac版

ビジュアル Web 開発ツール

ゼンドスタジオ 13.0.1

ゼンドスタジオ 13.0.1

強力な PHP 統合開発環境

mPDF

mPDF

mPDF は、UTF-8 でエンコードされた HTML から PDF ファイルを生成できる PHP ライブラリです。オリジナルの作者である Ian Back は、Web サイトから「オンザフライ」で PDF ファイルを出力し、さまざまな言語を処理するために mPDF を作成しました。 HTML2FPDF などのオリジナルのスクリプトよりも遅く、Unicode フォントを使用すると生成されるファイルが大きくなりますが、CSS スタイルなどをサポートし、多くの機能強化が施されています。 RTL (アラビア語とヘブライ語) や CJK (中国語、日本語、韓国語) を含むほぼすべての言語をサポートします。ネストされたブロックレベル要素 (P、DIV など) をサポートします。

VSCode Windows 64 ビットのダウンロード

VSCode Windows 64 ビットのダウンロード

Microsoft によって発売された無料で強力な IDE エディター