LoginSignup
1
1

More than 5 years have passed since last update.

ローカル開発環境からブラウザでphpを表示できない(解決済み)

Last updated at Posted at 2015-11-09

もともとunixコマンドの勉強をしようとドットインストールを見ていたのだけれども「ローカル開発環境?え?なにそれ?それやってる前提で始めるの?」ってことでローカル開発環境の構築 [MacOS X編]っていうのを見てたのだが、"Hello from Vagrant!"と書かれたphpファイルをローカル開発環境で表示させようとすると、

index.php
<?php
echo "hello from Vagrant!";

とそのまま表示されてしまう。
どういうことなのかと色々と調べた結果、ローカル開発環境からブラウザでphpファイルを確認できないという名前のforumを発見。同志よ。と思い色々と試した結果、未だに動きません。ちなみにPHP 5.5.29 CentOS 6.7 apache2.2.15です。sudo vi /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 !prefork.c>
LoadModule php5_module modules/libphp5-zts.so
</IfModule>


The following lines prevent .user.ini files from being viewed by Web clients.

<Files ".user.ini">
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
            Order allow,deny
            Deny from all
            Satisfy All
        </IfModule>
    </Files>

    Allow php to handle Multiviews

    AddType text/html .php


    Add index.php to the list of files that will be served as directory indexes.

    DirectoryIndex index.php

     mod_php options
    <IfModule  mod_php5.c>

     Cause the PHP interpreter to handle files with a .php extension.

    <FilesMatch \.php$>
        SetHandler application/x-httpd-php
    </FilesMatch>

     Uncomment the following lines to allow PHP to pretty-print .phps
     files as PHP source code:

    <FilesMatch \.phps$>
        SetHandler application/x-httpd-php-source
    </FilesMatch>


     Apache specific PHP configuration options
     those can be override in each configured vhost

    php_value session.save_handler "files"
    php_value session.save_path    "/var/lib/php/session"
    php_value soap.wsdl_cache_dir  "/var/lib/php/wsdlcache"
</IfModule>

ということで未だに沼の中。。。

1
1
6

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1