サーバを立ち上げてからの手順④cakePHPの導入

cakePHPの導入方法について

cakePHP導入

cakePHP 2.8.6をダウンロード、展開
展開フォルダを公開ディレクトリ名にリネイム

インストール

$ wget https://github.com/cakephp/cakephp/archive/2.8.6.tar.gz
$ tar xzvf 2.8.6.tar.gz
$ mv cakephp-2.8.6/ www
$ cd www

cakePHP設定

パーミッションの変更とセキュリティソルト変更

$ chmod -R 777 lib/Cake/Cache/
$ cd app
$ chmod -R 777 tmp/
$ vi Config/core.php

228行目、233行目の文字列を変更する
f:id:harucharuru:20200226161417p:plain

アクセスして、以下のようなページが出ればOK
f:id:harucharuru:20200226161552p:plain

データベース接続

$ Console/cake bake

聞かれたことに対して答えていく

---------------------------------------------------------------
Database Configuration:
---------------------------------------------------------------
Name:  
[default] > 
Datasource: (Mysql/Postgres/Sqlite/Sqlserver) 
[Mysql] > 
Persistent Connection? (y/n) 
[n] > 
Database Host:  
[localhost] > 
Port?  
[n] > 
User:  
[root] > ユーザ名
Password:  
> パスワード
Database Name:  
[cake] > データベース名
Table Prefix?  
[n] > 
Table encoding?  
[n] > 文字エンコーディング(例:utf8)

で、サイトを見たら、以下のようになればOK
f:id:harucharuru:20200226161901p:plain

[参考]timezoneの変更

サイトを見たときに
Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the t....
と言ったwarningが出ていますが、これを解消するためには以下の方法を行います。
管理者権限でログインした状態で、

# vi /etc/php.ini 

878行目のtimezoneの部分のコメントアウトを外して、Asia/Tokyoと入力
f:id:harucharuru:20200226162157p:plain

webサーバを再起動

# systemctl restart httpd.service


すると、サイトの方のwarningが消えました。
f:id:harucharuru:20200226162327p:plain