参照: さくらレンタルサーバー
プラン: さくらレンタルサーバー スタンダード
アカウント名: accountname01
[コントロールパネル]でデータベースaccountname01_schemenameを作成しておきます。
% mkdir ~/bin
% cd ~/bin
% curl -sS https://getcomposer.org/installer | php
% alias composer php /home/accountname01/bin/composer.phar
% cd
% vi .cshrc
% grep composer ~/.cshrc
alias composer php /home/accountname01/bin/composer.phar
%
<注意点> DebugKitを無効としています。
% mkdir ~/files
% mkdir ~/wrk
% cd ~/wrk
% composer create-project --prefer-dist cakephp/app:^5 html
% cd html
% composer remove --dev cakephp/debug_kit
% cd ~/www
% rm -Rf *
% cp -R ~/wrk/html/* .
% vi ~/www/.htaccess
% cat ~/www/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
% cd ~/www
% ln -s webroot/css css; \
ln -s webroot/favicon.ico favicon.ico; \
ln -s webroot/font font; \
ln -s webroot/img img; \
ln -s webroot/js js
% cd ~/www/config
% vi .env
% cat .env
#!/usr/bin/env bash
export DEBUG="false"
export APP_ENV=production
% cp plugins.php ~/files
% vi plugins.php
% diff ~/files/plugins.php plugins.php
31c31
< 'DebugKit' => ['onlyDebug' => true],
---
> //'DebugKit' => ['onlyDebug' => true],
% cp app_local.php ~/files
% vi app_local.php
```
Datasourcesを以下のように編集
'Datasources' => [
'default' => [
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Mysql',
'host' => 'mysql####.db.sakura.ne.jp',
'username' => 'accountname01_schemename',
'password' => 'P@ssw0rd',
'database' => 'accountname01_schemename',
'url' => env('DATABASE_URL', null),
],
],
'''
WEBブラウザで以下のURLを表示
https://half-of-string.com/
おおよそ以下のような画面になっていればOK。
Welcome to CakePHP 5.x.x ..... (🍰)
Please be aware that this page will not be shown if you turn off debug mode unless you replace templates/Pages/home.php with your own version.
Environment
Your version of PHP is 8.1.0 or higher (detected 8.2.20).
Your version of PHP has the mbstring extension loaded.
Your version of PHP has the openssl extension loaded.
Your version of PHP has the intl extension loaded.
You should set zend.assertions to 1 in your php.ini for your development environment.
Filesystem
Your tmp directory is writable.
Your logs directory is writable.
The Cake\Cache\Engine\FileEngine is being used for core caching. To change the config edit config/app.php
Database
CakePHP is able to connect to the database.
DebugKit
DebugKit is not loaded.
.......... 以下、省略 ..........