0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CentOS7+Apacheでphpinfoを表示させたい。

Posted at

概要

筆者「WindowsでLAMP環境を構築してからアプリ開発をしたい!」 ⇒でも、ソースを書いてもサーバー上でPHPが読み込まれない… ⇒調査!!!(した結果を自分用にメモとして綴ります)

環境

・Vagrant ・VirtualBox ・CentOS7.7 ・PHP7.2 ・Apache2.4

①httpd.confに追記

`$ cd /etc/httpd/conf` httpd.confがあるディレクトリに移動して、
`$ vi httpd.conf` viで編集します。
httpd.conf
LoadModule php7_module C:/php/sapi/php7Apache2.dll
AddType application/x-httpd-php .php

【viコマンドメモ】
・「i」で編集
・追記したら「:wq」で保存+終了

②phpinfo.phpをつくる

`$ cd var/www/html` 今度はドキュメントルートに移動して
`$ touch phpinfo.php` phpinfoのファイルを作成
phpinfo.php
<?php
  phpinfo(); //phpの詳細を表示する関数
?>

これを書いて保存+終了!
サーバーを立ち上げてphpinfo.phpにアクセスすれば無事中身が確認できました。
phpinfo.JPG

まとめ

XAMPPに慣れてVagrant等の仮想環境から逃避していたので勉強になりました。 vagrant box addとかyumコマンドでインストールさえ済めば万事解決なわけなかった()
0
0
0

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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?