====== CentOS5.2でApache2.2インストール ====== ===== 環境 ===== * CentOS5.2 * Apache2.2.9 * mod_rewrite * mod_ssl ===== コンフィグ ===== # tar zxvf httpd-2.2.9.tar.gz # cd httpd-2.2.9 # ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite=shared --enable-ssl --enable-speling=shared ・ ・ ・ configure: error: ...No recognized SSL/TLS toolkit detected enable-speling=sharedはmod_spelingを使用する場合に。 ===== エラー対処 ===== これでコンフィグ通ります。 # yum install openssl-devel ===== 起動スクリプト用意 ===== # cp /usr/local/src/httpd-2.2.14/build/rpm/httpd.init /etc/init.d/httpd # chmod 755 /etc/init.d/httpd -PATHの修正 # vi /etc/init.d/httpd 54 #apachectl=/usr/sbin/apachectl 55 apachectl=/usr/local/apache2/bin/apachectl 56 #httpd=${HTTPD-/usr/sbin/httpd} 57 httpd=${HTTPD-/usr/local/apache2/bin/httpd} 58 prog=httpd 59 #pidfile=${PIDFILE-/var/log/httpd/httpd.pid} 60 pidfile=${PIDFILE-/usr/local/apache2/logs/httpd.pid} -chkconfigに登録 # /sbin/chkconfig --add httpd # /sbin/chkconfig httpd on -スタート # /sbin/service httpd start ===== Apache起動で変なエラー ===== httpd: Syntax error on line 55 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp5.so into server: /usr/local/apache2/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied 「SELinuxポリシーが適用されて、エラーの出たライブラリの セキュリティコンテキストが適切に設定されていない」ことを意味するそうです。 ==== 対処 ==== SELinuxを無効にするか、下のコマンド chcon -c -v -R -u system_u -r object_r -t textrel_shlib_t libphp5.so ===== PHP ===== ./configure --with-apxs2=/usr/local/apache2/bin/apxs \ --with-mysql=/usr/local \ --with-pgsql=/usr/local/pgsql \ --enable-cli \ --enable-pear \ --with-tsrm-pth \ --with-gd --with-zlib \ --with-freetype-dir=/usr/local \ --with-jpeg-dir=/usr/local \ --with-png-dir=/usr/local \ --enable-force-cgi-redirect \ --enable-mbstring \ --enable-mbstr-enc-trans \ --enable-trans-sid \ --enable-versioning \ --enable-gd-native-ttf \ --enable-gd-jis-conv ===== httpd.confに追加 ===== AddType application/x-httpd-php .php .html