Solaris 10 預裝 GNU 工具鏈但 PATH 未設置,需手動調整。
# vi /etc/profile export PATH=$PATH:/usr/ccs/bin:/usr/sfw/bin # source /etc/profile
驗證:gcc 無參數運行顯示版本信息即可。
gunzip -d tar-1.16.tar.gz tar xvf tar-1.16.tar cd tar-1.16 ./configure --prefix=/usr/local/gnutar make && make install mv /usr/sbin/tar /usr/sbin/tar.orig ln -s /usr/local/gnutar/bin/tar /usr/sbin/tar
cd /root tar zxvf httpd-2.2.0.tar.gz cd httpd-2.0.45 ./configure --prefix=/usr/local/apache2 --enable-so make && make install
確認生成 /usr/local/apache2 目錄。
直接配置報錯:libxml2 version 2.6.11 or greater required。系統自帶版本過舊,不建議升級系統庫,改為獨立安裝新版:
cd /root tar zxvf libxml2-2.6.26.tar.gz cd libxml2-2.6.26 ./configure --prefix=/usr/local/libxml make && make install
再配置 PHP 指定新庫路徑:
cd /root/php-5.2.0 ./configure --prefix=/usr/local/php5 \ --with-apxs2=/usr/local/apache2/bin/apxs \ --with-libxml-dir=/usr/local/libxml make && make install
檢查 /usr/local/apache2/conf/httpd.conf 自動插入的模塊加載行:
LoadModule php5_module modules/libphp5.so
手動添加 MIME 類型(注意 .php 前有空格):
AddType application/x-httpd-php .php .phtml
echo '' > /usr/local/apache2/htdocs/index.php /usr/local/apache2/bin/apachectl start # 瀏覽器訪問 https://ServerIP/index.php
顯示 PHP 信息頁面即成功。
