0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

cakephp環境構築

Last updated at Posted at 2024-06-18
1	バージョン確認						'							
	php -v													
	composer -V													
	mysql --version													
														
2	php.ini下記全てコメントアウトを外す													
	extension=curl													
	extension=php_intl.dll 													
	extension=openssl													
	extension=pdo_mysql													
	extension=pdo_odbc													
	extension=pdo_pgsql													
	extension=pdo_sqlite													
														
3	自作のパスに移動													
	cd C:\cakephp													
	cakephpのプロジェクトを作成													
	composer self-update && composer create-project --prefer-dist cakephp/app:"4.*" CakeBlog													
	Set Folder Permissions ? (Default to Y) [Y,n]? y													
														
4	開発サーバ起動													
	cd CakeBlog
 
    サーバ起動
	bin\cake server			注意 windowsの場合、/ ではない。
    サーバ停止
    cstr c
    
	http://localhost:8765/				動作確認									
														
	vscode 起動													
	code ./													
 
    db
	bin\cake migrations migrate
														
														
5	app 設定													
	config/.env.example  コピー  .env作成												
	.envは以下に設定する													
														
	export APP_NAME="CakeBlog"													
	export DEBUG="true"													
	export APP_ENCODING="UTF-8"													
	export APP_DEFAULT_LOCALE="ja_JP"													
	export APP_DEFAULT_TIMEZONE="Asia/Tokyo"													
	export SECURITY_SALT="sdfsfdewe568998"						←任意入力							
														
6	.env読み込みような設定													
	config/bootstrap.php													
	下記コメントアウト外す													
	// if (!env('APP_NAME') && file_exists(CONFIG . '.env')) {													
	//     $dotenv = new \josegonzalez\Dotenv\Loader([CONFIG . '.env']);													
	//     $dotenv->parse()													
	//         ->putenv()													
	//         ->toEnv()													
	//         ->toServer();													
	// }													
														
7	db 設定
    1⃣
    coonfig/app.php コピー  app_local.php作成
    
    2⃣
    app_local.php
	一番上に下記一行追加													
	use Cake\Database\Driver\Mysql;	

    3⃣
	Datasources'以下ように設定
 
    'driver' => Mysql::class,													
    'host' => 'localhost',													
    'username' => 'root',													
    'password' => 'test',													
    'database' => 'cakedb',													

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?