環境

CentOS 初期設定

$ sudo setenforce 0
$ sudo vi /etc/sysconfig/selinux
SELINUX=disabled
$ sudo /sbin/service iptables stop
$ sudo chkconfig iptables off

Apache インストール

$ sudo yum -y install httpd
$ httpd -v
Server version: Apache/2.2.15 (Unix)

PHP インストール

$ sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
$ wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
$ sudo rpm -Uvh remi-release-6.rpm
$ sudo yum -y install --enablerepo=remi,remi-php71 php php-devel php-openssl php-pdo php-mysql php-mbstring php-tokenizer php-xml
$ php --version
PHP 7.1.7 (cli) (built: Jul  6 2017 13:46:08) ( NTS )
$ php -m

Apache 起動

$ sudo /sbin/service httpd start
$ sudo chkconfig httpd on

PHP 動作確認

$ cd /var/www/html/
$ sudo vi index.php
<?php
echo "Hello World!"
?>
<!DOCTYPE html>
<html lang="ja">
<body>
    <p>Hello World <?php echo "from PHP!";?></p>
<body>
</html>
$ sudo chown -R apache:apache /var/www/html/
$ sudo rm index.php

トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS