2019年9月4日水曜日

さくらインターネットにcakephp3をインストール

さくらインターネットにcakephp3をインストール

sshでログインします。

ssh ユーザー名@ユーザー名.sakura.ne.jp
ユーザー名@ユーザー名.sakura.ne.jp's password:サーバーパスワードを入力する

コンポーザーのインストール

curl -s http://getcomposer.org/installer | php
php composer.phar self-update
mkdir ~/bin
mv composer.phar ~/bin/composer

cakephp用のフォルダーを作る

mkdir ~/cakephp
cd ~/cakephp

cakephpのインストール

~/bin/composer create-project --prefer-dist cakephp/app:^3.8.1 app

追加プラグインのインストール

cd app
composer require phpoffice/phpspreadsheet
composer require friendsofcake/search
composer require friendsofcake/bootstrap-ui ^2.0.0-RC

追加プラグインのロード

bin/cake.php plugin load Search
bin/cake.php plugin load BootstrapUI

bootstrap shell を使用して必要な変更を加えます。

bin/cake.php bootstrap modify_view

これにより、[README]のAppViewセットアップで説明されているように、src / View / AppViewが書き換えられます。

bin/cake.php bootstrap copy_layouts

これにより、cover.ctp、dashboard.ctp、signin.ctpの3つのサンプルレイアウトがアプリのsrc/Template/Layout/TwitterBootstrapにコピーされます。

データベースの設定

~/cakephp/app/config/app.phpを開く256行目あたりに

    'Datasources' => [
        'default' => [
            'className' => Connection::class,
            'driver' => Mysql::class,
            'persistent' => false,
            'host' => 'ホスト名', // mysql638.db.sakura.ne.jp
            /*
             * CakePHP will use the default DB port based on the driver selected
             * MySQL on MAMP uses port 8889, MAMP users will want to uncomment
             * the following line and set the port accordingly
             */
            //'port' => 'non_standard_port_number',
            'username' => '<ユーザー名>',
            'password' => '<パスワード>',
            'database' => '<データベース名>',
            /*
             * You do not need to set this flag to use full utf-8 encoding (internal default since CakePHP 3.6).
             */
            //'encoding' => 'utf8mb4',
            'timezone' => 'UTC',
            // 'timezone' => 'Asia/Tokyo',
            'flags' => [],
            'cacheMetadata' => true,
            'log' => false,

ウェブフォルダーにシンボリックリンクを作る

cd ~/www
ln -s ~/cakephp/app/webroot web_site_url

0 件のコメント:

コメントを投稿