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?

EC-CUBEバージョンアップ

0
Last updated at Posted at 2026-10-24

EC-CUBE、PHP、各バージョンの互換性を確認

現行バージョンを確認

EC-CUBE
PHP
MySQL

目標バージョンを設定

EC-CUBE
PHP
MySQL

格納サーバーで対応しているか確認

PHP
MySQL

目標バージョンを決定

EC-CUBE
PHP
MySQL

プラグイン適合

現行プラグインが目標EC-CUBEバージョンに適合しているか確認
不適合なら目標EC-CUBEバージョンに適合しているプラグインがあるか調査
現行プラグインの設定情報を保存

サイトファイルバックアップ

コントロールパネルからバックアップが簡単

データベースバックアップ

PhpMyAdminでバックアップ

メンテナンスモード

管理画面よりメンテナンスモードを有効
フロントで確認

プラグイン(メジャーアップデート)

未アップデートプラグインがあればアップデートする
プラグイン無効化
サーバーからプラグインファイルを退避(ローカルにダウンロードしてサーバー上から削除)
PhpMyAdminでプラグインの「enable」1→0「initialaized」1→0

プラグイン(マイナーアップデート)

未アップデートプラグインがあればアップデートする
プラグイン無効化

「開発者向けドキュメントサイト」で流れを確認

https://doc4.ec-cube.net/update423_43x
以下の違いに注意
バージョン内での本体バージョンアップ
バージョン移行の本体バージョンアップ

カスタマイズしたファイルを確認

商品画像
html/upload/save_image/***.jpg

ソースファイルダウンロード

https://github.com/EC-CUBE/ec-cube/releases/
目標バージョンのソースファイルZipをダウンロード
解凍

ソースファイル差し替え

以下のディレクトリをサーバーから削除後、新バージョンディレクトリをアップロード

[root]
  │
  ├──[app/config/eccube]
  ├──[app/DoctrineMigrations]
  ├──[bin]
  ├──[src]
  ├──[html]
  │

vendorディレクトリ上書き

削除後アップロードではなく、上書きする

[root]
  │
  ├──[vendor]
  │

個別ファイル上書き

composer.json
composer.lock
package.json
package-lock.json
index.php

画像データを復元

html/upload/save_image
html/template/default/assets/img/top/
html/template/default/assets/img/common/

カスタマイズファイルのカスタム部分を上書き

composer.json/composer.lockの更新

SSHで接続
キャッシュ削除

rm -rf var
php bin/console cache:clear --no-warmup
php bin/console eccube:composer:require-already-installed

スキーマ更新

rm -rf var
php bin/console doctrine:schema:update --force --dump-sql

マイグレーション

php bin/console doctrine:migrations:migrate

キャッシュ等の再生成

composer dump-autoload
php bin/console eccube:generate:proxies
php bin/console cache:warmup --env=prod
rm -rf var/sessions

フロントテンプレートファイルの更新

差分ソースファイルで差し替え済ならスキップ

PHPバージョンアップ

同一サーバーにインストールされているすべてのサイトへの影響を確認
コントロールパネルからバージョンアップ
WordPress・EC-CUBE管理画面からPHPバージョンを確認

MySQLバージョンアップ

同一サーバーにインストールされているすべてのサイトへの影響を確認
すべてのデータベースをバックアップ
すべてのサイトの管理ページをダウンロード
(WordPress:wp-config.php, EC-CUBE:.env)
コントロールパネルからバージョンアップ
管理ページのデータベース名を書き換え
WordPress・EC-CUBE管理画面からMySQLバージョンを確認

メンテナンスモード無効

バージョンアップ確認

管理画面 > システム

プラグイン(メジャーアップデート)

PhpMyAdminでdtb_pluginをインポート
・データベース全体を表示しdtb_pluginを削除
・バックアップしたdtb_pluginをインポート
サーバーへプラグインファイルを復旧

プラグイン

必要なら目標EC-CUBEバージョンに適合しているプラグインを購入
必要なら目標EC-CUBEバージョンに適合しているプラグインをインストール
プラグイン設定
プラグイン有効化

フロント確認

正常動作を確認

つまずきポイント

スキーマ更新でエラー

bin/console doctrine:schema:update --force --dump-sql

 CRITICAL  [console] Error thrown while running command "'doctrine:schema:update' --force --dump-sql". Message: "An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`my-system_pw2023`.`#sql-41e_bfb6cb9e`, CONSTRAINT `FK_6C38C0F89395C3F3` FOREIGN KEY (`customer_id`) REFERENCES `dtb_customer` (`id`))" ["exception" => Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException^ { …},"command" => "'doctrine:schema:update' --force --dump-sql","message" => "An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`my-system_pw2023`.`#sql-41e_bfb6cb9e`, CONSTRAINT `FK_6C38C0F89395C3F3` FOREIGN KEY (`customer_id`) REFERENCES `dtb_customer` (`id`))"] ["file" => "/home/my-system/www/pw_poster/shelter/vendor/symfony/console/EventListener/ErrorListener.php","line" => 48,"class" => "Symfony\Component\Console\EventListener\ErrorListener","callType" => "->","function" => "onConsoleError","uid" => "155a692","user_id" => "N/A","session_id" => "N/A"]

In ExceptionConverter.php line 56:

  An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or
  update a child row: a foreign key constraint fails (`my-system_pw2023`.`#sql-41e_bfb6cb9e`, CONSTRAINT `FK_6C38C0F8
  9395C3F3` FOREIGN KEY (`customer_id`) REFERENCES `dtb_customer` (`id`))


In Exception.php line 28:

  SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fa
  ils (`my-system_pw2023`.`#sql-41e_bfb6cb9e`, CONSTRAINT `FK_6C38C0F89395C3F3` FOREIGN KEY (`customer_id`) REFERENCE
  S `dtb_customer` (`id`))


In Connection.php line 69:

  SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fa
  ils (`my-system_pw2023`.`#sql-41e_bfb6cb9e`, CONSTRAINT `FK_6C38C0F89395C3F3` FOREIGN KEY (`customer_id`) REFERENCE
  S `dtb_customer` (`id`))

データベース内のどこかのテーブルにあるcustomer_idの外部キーがテーブルdtb_customerを参照したが、そこのidに同じ値がない

PhpMyAdminでSQLコマンド

SELECT COUNT(*) FROM dtb_customer_address
WHERE customer_id IS NOT NULL
  AND customer_id NOT IN (SELECT id FROM dtb_customer);

-- 中身も確認
SELECT * FROM dtb_customer_address
WHERE customer_id IS NOT NULL
  AND customer_id NOT IN (SELECT id FROM dtb_customer);

問題の値を修正

autoloadファイルの再生成でエラー

composer dump-autoload
-bash: composer: command not found

rootにcomposer.pharがある場合

ls composer.phar
which -a composer composer.phar
ls ~/composer* /usr/local/bin/composer* 2>/dev/null

rootにcomposer.pharがない場合、生成する

cd /home/my-system/www/pw_poster/shelter
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
php -r "unlink('composer-setup.php');"

参考記事

単独本体バージョンアップ
移行本体バージョンアップ

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?