linux下安裝apache php的方法:首先下載“httpd-2.2.11”并解壓安裝包 ;然后通過“make install”進行編譯安裝;接著下載php并進行編譯安裝;最后修改配置文件即可。
linux下安裝apache php過程
安裝apache過程總結
安裝httpd-2.2.11
下載地址:http://archive.apache.org/dist/httpd/
安裝過程
[root@zhibing /]# rpm -qa |grep httpdhttpd-manual-2.0.52-32.enthttpd-suexec-2.0.52-32.entsystem-config-httpd-1.3.1-1httpd-2.0.52-32.ent //查看本機是否已經安裝httpd [root@zhibing /]# rpm -e httpd --nodeps //刪除本機存在的httpd [root@zhibing tmp]# tar zxvf httpd-2.2.11.tar.gz //解壓安裝包 [root@zhibing tmp]# cd httpd-2.2.11 //進入httpd-2.2.11 [root@zhibing httpd-2.2.11]# ./configure --prefix=/usr/local/apache --enable-s0 //檢測程序, --prefix 軟件要安裝的路徑–enable-so表示讓apache核心裝載dso,但是不實際編譯任何動態模塊 [root@zhibing httpd-2.2.11]# make //編譯 [root@zhibing httpd-2.2.11]# make install //編譯后安裝
安裝 php-5.2.9
下載地址:http://cn.php.net/downloads.php
注意:安裝php-5.2.9之前,png,gd,freetype,zlib,mysql,openssl都存在,若不存在,手動安裝一下
安裝過程
[root@zhibing tmp]# tar zxvf php-5.2.9.tar.gz [root@zhibing tmp]#cd php-5.2.9.tar.gz[root@zhibing php-5.2.9]#./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-png-dir --with-gd --with-freetype-dir --with-zlib --with-mysql=/usr/local/mysql --with-openssl --with-gettext -enable-sockets //檢測程序,并同時加載相關參數 [root@zhibing php-5.2.9]#make && make install //編譯安裝 [root@zhibing php-5.2.9]#cp php.ini-recommended /usr/local/php/lib/php.ini //拷貝php.ini文件啟動時會讀取到的配置文件 [root@zhibing php-5.2.9]#ln -s /usr/local/php/bin/* /usr/local/bin/ //連接 ot@zhibing php-5.2.9]#lvi /usr/local/apache/conf/httpd.conf //修改配置文件添加
addtype application/x-gzip .gz .tgzaddtype application/x-httpd-php .phpaddtype p_w_picpath/x-icon .ico添加
index.php index.html index.html.var <ifmodule dir_module> directoryindex index.html index.php index.html index.html.var</ifmodule>
測試:
[root@zhibing ]#vi /usr/local/apache/htdocs/test.php //新建test.php在新文件中添加
<?phpphpinfo();?>wq保存退出
phpinfo是特殊的php函數,可以顯示目前服務器內php模塊的相關核心數據
[root@zhibing ]## /usr/local/apache/bin/apachectl –k stop [root@zhibing ]##/usr/local/apache/bin/apachectl –k start //重新啟動apache
在瀏覽器中輸入主機地址例如http://主機ip/test.php如有出現下面圖片就說明apace安裝成功
注冊商標可以變形么南京ecs云服務器掛載有什么用乘“云”直上,意能通與京東云達成戰略合作怎樣選擇云服務器配置是什么域名無法修改顯示被鎖定-域名及賬戶問題net域名怎么樣?net域名好不好企業郵箱反垃圾設置德國ecs云服務器創建云盤