0
2

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.

VPS 借りたので③ PHP、MySQLの設定メモ

Posted at

前々回前回の続きです。

ようやく基本的な設定が終わりまして、その他実行環境の設定です。
今回もドットインストールを見ながら調べたことのメモです。

  • PHPの設定

    • インストール
      # yum install php php-devel php-mysql php-mbstring php-gd
      devel はよくわかんないけど、それ以外はMySQL、マルチバイト文字、グラフィクのライブラリ(?)の模様。
      入れたあとは、php -v でバージョン確認。

    • 設定ファイルいじる
      /etc/php.ini
      いつものごとくバックアップ。.org

    • 設定ファイルの中身

      • エラーログの場所を /var/log の下に
        error_log = /var/log/php.log

      • 日本語環境に
        mbstring.language = Japanese

      • エンコーディングをUTF-8に
        mbstring.internal_encoding = UTF-8

      • HTTP通信時のインプット文字コードの設定
        mbstring.http_input = auto
        ※自動変換にするとトラブルの元っていうブログもあってどうしたらいいのか不明

      • 文字コードの自動判別を行う時にどの文字コードから順に確認していくのか
        mbstring.detect_order = auto
        ※これも自動だとダメっていうのがあったけど不明

      • 参考:日本語利用の為の設定

      • PHPの情報を公開するかどうか
        expose_php = Off
        参考:知らなかったよ、expose_php | PHPの種 ブログ

      • タイムゾーンの設定
        date.timezone = Asia/Tokyo

    • サーバー再起動
      # service httpd restart

  • MySQL の設定

    • # yum install mysql-server

    • 設定ファイルいじる
      /etc/my.cnf
      いつものごとくバックアップ。.org

    • 設定ファイルの中身

      • UTF-8 環境にする。
        ソース自体はドットインストール自体からコピペ。
    • MySQL の起動
      # service mysqld start

    • セキュリティ周りの設定
      # mysql_secure_installation
      ログイン権限とかパスワードとか設定する。
      参考:ぷちWiki - mysql_secure_installation

    • 自動起動
      # chkconfig mysqld on

    • 起動確認
      # mysql -u root -p

これで、サーバの設定からウェブ作るまでのとりあえずの設定は終わった感じかと思われます。
Ruby とか Python とか node とかは適当に入れるべし。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?