這篇文章主要為大家展示了“ php-5.4.45怎么用”,內(nèi)容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領(lǐng)大家一起研究并學(xué)習(xí)一下“ php-5.4.45怎么用”這篇文章吧。
為了不影響實(shí)驗(yàn)效果,提前可以把selinux 和iptables 關(guān)閉
[root@localhost ~]# chkconfig iptables off
[root@localhost ~]# chkconfig ip6tables off
[root@localhost ~]# /etc/init.d/iptables stop
[root@localhost ~]# /etc/init.d/ip6tables stop
[root@localhost ~]# sed -i "s/LINUX=.*/LINUX=disabled/g" /etc/selinux/config
更改完selinux后要想生效需要重啟一下服務(wù)器,reboot或者shutdown -r now
第一步 安裝yum擴(kuò)展源
# yum install -y epel-release
備注:6.7前版本不支持,需要下一步
# wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-6.repo
第二步 安裝依賴包
# yum install make apr* autoconf automake gcc gcc-c++ zlib-devel openssl openssl-devel pcre-devel gd kernel keyutils patch perl kernel-headers compat* mpfr cpp glibc libgomp libstdc++-devel ppl cloog-ppl keyutils-libs-devel libcom_err-devel libsepol-devel libselinux-devel krb5-devel libXpm* freetype libjpeg* libpng* php-common php-gd ncurses* libtool* libxml2 libxml2-devel patch libmcrypt-devel php-mcrypt libmcrypt mcrypt freetype-devel freetype bzip2-devel bzip2-libs libxml2 libxml2-devel libxml2-python
把這些包全部安裝上就不會報(bào)錯(cuò)了,
第三步 安裝php
1,下載
# cd /usr/local/src/
# wget http://cn2.php.net/distributions/php-5.4.45.tar.bz2
2,解壓
# tar -jxvf php-5.4.45.tar.bz2
3,安裝
# cd php-5.4.45
# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif --disable-ipv6
如果出現(xiàn)報(bào)錯(cuò):sorry,i cannot run apxs.possible reasons follow:
解決方法:
# find / -name perl
/usr/bin/perl
#vim /usr/local/apache2/bin/apxs
把第一行改成 #!/usr/bin/perl -w
#make && make install && echo $?
# cp /usr/local/src/php-5.4.45/php.ini-production /usr/local/php/etc/php.ini
拷貝配置文件
測試
# apachectl -M
php5_module (shared)
檢測php安裝是否成功,用apache -M 查看apache動態(tài)模塊是否加載php5
網(wǎng)頁測試
Apache主配置文件為:/usr/local/apache2/conf/httpd.conf
# vim /usr/local/apache2/conf/httpd.conf
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php (定義apache解析PHP)
#
#
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
#
[root@lanmp php-5.4.45]# cd /usr/local/apache2/htdocs/
[root@lanmp htdocs]# vi info.php
[root@lanmp htdocs]# cat info.php
<?php
phpinfo();
?>
在ie中輸入 http://ip/info.php
以上是“ php-5.4.45怎么用”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學(xué)習(xí)更多知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。
新聞標(biāo)題:php-5.4.45怎么用-創(chuàng)新互聯(lián)
文章URL:http://www.chinadenli.net/article48/djchhp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站營銷、搜索引擎優(yōu)化、域名注冊、網(wǎng)站收錄、網(wǎng)站設(shè)計(jì)公司、服務(wù)器托管
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容