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?

XAMPPでの環境構築にてやったこと

Posted at

前提

  • PHP, JavaScript, MySQLのアーキテクチャをロリポップサーバーに載せたアプリを作りたい

手順

  1. ロリポップのサーバーと契約 契約はこちらから

  2. XAMPPをダウンロード インストールはこちらから

    1. MySQLにチェック(DB)
    2. phpMyAdminにチェック()
    3. それ以外は外してもいったん大丈夫
  3. Laravelをインストール (Windows Ver) 参考サイト

    1. Composerをインストール インストールはこちら

    2. cmdにてcomposerを使ってLaravelを指定のリポジトリに作成する

      composer create-project laravel/laravel app-name
      
    3. サーバーを起動する

      cd app-name
      
      php artisan serve
      
  4. XAMPPを起動

    1. Apache、MySQLを起動
      image.png
      • この際、ローカルのMySQLが動いていたらポート番号がかぶってエラーになるので、ポート番号をずらすか、ローカルのMySQLをアンインストールして回避しましょう。
  5. MySQLの設定 参考サイト

    1. Userを作る
    2. DataBaseを作る
    3. tableを作る
      drop table if exists receipts;
      create table receipts (
        id int unsigned primary key auto_increment,
        user_id int unsigned foreign key ,
        regi_date date,
        store_name varchar(255),
        amount int,
        payment_type varchar(255),
        douhan varchar(255),
        invoice_no varchar(255),
        created_at datetime,
        updated_at datetime,
        deleted_flg tinyint(1) default 0
      );
      
      
  6. マイグレーション

    1. 作ったLaravelフォルダ内の.envファイルのDB_CONNECTIONの値をsqliteからmysqlに変更
    2. DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, DB_PASSWORDも使用しているXAMPPのMySQLの値に変更
    3. マイグレートコマンドを実行
      php artisan migrate --force
      
    4. マイグレート出来たかどうかをMySQL側で確認
      • TABLEにmigrations, jobs, cache等が追加されていればOK

まとめ

  • 自分はこの手順で環境構築を行い、次のチュートリアルに進めた。
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?