首先到PHP(http://www.php.net/downloads.php)網站上抓取PHP Source code
Step1.解壓縮
tar zxvf php-5.3.5.tar.gz
Step2.
make clean
Step3.
./configure --with-apxs2=/usr/local/apache/bin/apxs --disable-debug --enable-ftp --enable-inline-optimization --enable-magic-quotes --enable-mbstring --enable-safe-mode --enable-wddx=shared --enable-xml --with-gettext --with-mysql=/usr/local/mysql --with-regex=system --with-zlib-dir=/usr/lib
Step4.
make && make install
Step5.
cp php.ini-production /usr/local/lib/php/php.ini
Step6.
ln -s /usr/local/lib/php.ini /etc/php.ini
Step7.
ln -s /usr/local/apache/conf/httpd.conf /etc/httpd.conf
Step8.
vi /etc/httpd.conf
加入
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
AddType application/x-tar .tgz
AddType application/x-httpd-php .php .foo
AddType application/x-httpd-php-source .phps .phtmls
AddType application/x-httpd-php .php .htm .html
DirectoryIndex index.php index.htm index.html
修改
ServerName 為 localhost:80
Step9.
ln -s /usr/local/apache/bin/apachectl /etc/rc.d/init.d/apache
Step10.
ln -s /etc/rc.d/init.d/apache /etc/rc.d/rc3.d/S90apache
Step11.
/etc/rc.d/init.d/apache start
Step12.
chmod 755 /usr/local/apache/cgi-bin
Step13.
chmod 755 /usr/local/apache/htdocs
Step14.
測試php
請在 /usr/local/apache/htdocs/ 目錄下建立 test.php 檔案
檔案內容為
phpinfo( );
?>
然後存檔
Step15.
開啟網頁連到Server, 看能不能見到php 測試網頁
參考資料:http://tw.myblog.yahoo.com/trail-0721/article?mid=-2&prev=63&l=a&fid=9
沒有留言:
張貼留言