LoginSignup
1
0

More than 5 years have passed since last update.

raspberry pi 3 でstretch その8

Last updated at Posted at 2017-11-12

概要

raspberry pi 3 でstretchやってみた。
webサーバやってみた。

写真

image.png

環境

Raspberry Pi 3 model B v1.2 element14
2017-09-07-raspbian-stretch

インストール

sudo aputitude install apache2 php mysql-server php-mysql

MariaDb設定

sudo mysql_secure_installation

パスワード設定

sudo mysql -uroot -p

create database mydb;
create user 'yamada'@'localhost' identified by 'tarou';
grant all on `mydb`.* to 'yamada'@'localhost';

確認

nano info.php

<?php
    phpinfo();
?>

sudo cp info.php /var/www/html

ブラウザで「localhost/info.php」を開く。

nano test.php

<?php
    $conn = mysqli_connect('localhost', 'yamada', 'tarou', 'mydb');
    if (mysqli_connect_errno() > 0)
    {
        print "接続に失敗しました";
        exit;
    }
    print "ok";
?>

sudo cp test.php /var/www/html

ブラウザで「localhost/test.php」を開く。

以上

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