這篇文章主要介紹如何在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. 進入安裝文件目錄
[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.12libxml2-python-2.6.26-2.1.12
##libxml2-python-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 license, you must abort |
| the installation process at this license, you must abort |
linux安裝php 模組--with-mysql --with-mysqli非得需要安裝mysql嗎
###以上是linux下如何安裝Php的詳細內容。更多資訊請關注PHP中文網其他相關文章!