Apache PHP ctags インストール
Apache インストール
$yum install httpd* Running Transaction Updating : db4-4.7.25-18.el6_4.x86_64 1/15 Installing : apr-devel-1.3.9-5.el6_2.x86_64 2/15 Installing : httpd-tools-2.2.15-29.el6.centos.x86_64 3/15 Installing : httpd-2.2.15-29.el6.centos.x86_64 4/15 Installing : expat-devel-2.0.1-11.el6_2.x86_64 5/15 Installing : db4-cxx-4.7.25-18.el6_4.x86_64 6/15 Installing : db4-devel-4.7.25-18.el6_4.x86_64 7/15 Installing : cyrus-sasl-devel-2.1.23-13.el6_3.1.x86_64 8/15 Installing : openldap-devel-2.4.23-32.el6_4.1.x86_64 9/15 Installing : apr-util-devel-1.3.9-3.el6_0.1.x86_64 10/15 Installing : httpd-devel-2.2.15-29.el6.centos.x86_64 11/15 Installing : httpd-manual-2.2.15-29.el6.centos.noarch 12/15 Updating : db4-utils-4.7.25-18.el6_4.x86_64 13/15 Cleanup : db4-utils-4.7.25-17.el6.x86_64 14/15 Cleanup : db4-4.7.25-17.el6.x86_64 15/15 Complete!
(一部省略)
PHP インストール
$yum install php ================================================================================== Package Arch Version Repository Size ================================================================================== Installing: php x86_64 5.3.3-23.el6_4 updates 1.1 M Installing for dependencies: libedit x86_64 2.11-4.20080712cvs.1.el6 base 74 k php-cli x86_64 5.3.3-23.el6_4 updates 2.2 M php-common x86_64 5.3.3-23.el6_4 updates 524 k Transaction Summary ================================================================================== Install 4 Package(s) Complete!
(一部省略)
ctags インストール
$yum install ctags ctags.x86_64 0:5.8-2.el6 Complete!
(一部省略)
PHP のログがきれいに省略できたので Apache catgs をアンインストールして PHP と同じ形式のログを取り直そうとしたら15個が5個になりました。削除の際、インストール時に入れた、依存関係にあるソフトが含まれないのですかね?
Apache アンインストール
$yum remove httpd* ============================================================================ Package Arch Version Repository Size ============================================================================ Removing: httpd x86_64 2.2.15-29.el6.centos @updates 2.9 M httpd-devel x86_64 2.2.15-29.el6.centos @updates 526 k httpd-manual noarch 2.2.15-29.el6.centos @updates 3.5 M httpd-tools x86_64 2.2.15-29.el6.centos @updates 137 k Removing for dependencies: php x86_64 5.3.3-23.el6_4 @updates 3.5 M Transaction Summary ============================================================================ Remove 5 Package(s)
(一部省略)
Apache, PHP, ctags のフォーマットが違ってて不恰好ですが、ログの録り直しは諦めます。
Apache の再起動
$ /etc/init.d/httpd restart
httpd を停止中: [ OK ]
httpd を起動中: httpd: apr_sockaddr_info_get() failed for kabosu
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[ OK ]
エラーが出たし、テスト用PHPが真っ白でしたので、早速 httpd.conf を変更しました。
diff httpd.conf
[root@kabosu conf]# diff -u _httpd.conf httpd.conf --- _httpd.conf 2013-11-20 18:45:04.353887277 +0900 +++ httpd.conf 2013-11-21 14:00:51.706844547 +0900 @@ -199,6 +199,7 @@ LoadModule disk_cache_module modules/mod_disk_cache.so LoadModule cgi_module modules/mod_cgi.so LoadModule version_module modules/mod_version.so +LoadModule php5_module modules/libphp5.so # # The following modules are not loaded by default: @@ -399,7 +400,7 @@ # negotiated documents. The MultiViews Option can be used for the # same purpose, but it is much slower. # -DirectoryIndex index.html index.html.var +DirectoryIndex index.html index.html.var index.php # # AccessFileName: The name of the file to look for in each directory @@ -800,6 +801,9 @@ # #AddHandler send-as-is asis +AddHandler php5-script .php +AddType text/html .php + # # For type maps (negotiated resources): # (This is enabled by default to allow the Apache "It Worked" page
Apache の再起動
[root@kabosu conf]# /etc/init.d/httpd restart httpd を停止中: [ OK ] httpd を起動中: [Thu Nov 21 14:24:55 2013] [warn] module php5_module is already loaded, skipping httpd: apr_sockaddr_info_get() failed for kabosu httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName [ OK ]
ん?PHP既に読み込んでるよってエラー。エラーメッセージでググってみたら、インストール時に自動で下記のファイルで libphp5.so が読み込まれていたようです。
[root@kabosu /etc/httpd/conf]# cat /etc/httpd/conf.d/php.conf # # PHP is an HTML-embedded scripting language which attempts to make it # easy for developers to write dynamically generated webpages. # <IfModule prefork.c> LoadModule php5_module modules/libphp5.so </IfModule> <IfModule worker.c> LoadModule php5_module modules/libphp5-zts.so </IfModule> # # Cause the PHP interpreter to handle files with a .php extension. # AddHandler php5-script .php AddType text/html .php # # Add index.php to the list of files that will be served as directory # indexes. # DirectoryIndex index.php # # Uncomment the following line to allow PHP to pretty-print .phps # files as PHP source code: # #AddType application/x-httpd-php-source .phps
httpd.conf を元に戻して Apache を再起動します。
Apache の再起動
[root@kabosu /var/www/html]# /etc/init.d/httpd restart httpd を停止中: [ OK ] httpd を起動中: httpd: apr_sockaddr_info_get() failed for kabosu httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName [ OK ]
動作確認ように test.php を作成して /var/www/html/test.php を配置。
<? phpinfo();
うーん、動かない。。。
<?php phpinfo(); ?>
動いたー!!
職場だと、最初の記述で動くのになー。と思って試してみたら、動きませんでした。反省。。。下記なら動くみたいです。
<?php phpinfo();