PrestaShop + Docker

Docker-Composeファイルによるコンテナ作成時の環境設定は以下の通り。

  prestashop-fpm:
    container_name: prestashop-fpm
    image: prestashop/prestashop:1.7-7.2-fpm    
    tty: true
    expose: 
      - "9000"
    environment:
      - PS_DEV_MODE=true
      - DB_SERVER=localhost
      - DB_USER=user
      - DB_PASSWD=passowrd
      - DB_NAME=store
      - PS_INSTALL_AUTO=1
      - PS_DOMAIN=www.testsite.com
      - PS_LANGUAGE=ja
      - PS_COUNTRY=JP
      - PS_FOLDER_ADMIN=your_admin
      - PS_ENABLE_SSL=1
      - ADMIN_MAIL=test001@gmail.com
      - ADMIN_PASSWD=adminpassword
      - TZ=Asia/Tokyo

注) PrestaShopを指定ドメインのサブディレクトにインストールする場合は、PrestaShopデータベースのテーブル “ps_shop_url”“physical_uri”“/sub_directory/” を追加すること。

pecl memcacheのインストール

Prestashopのキャッシュを有効化するため、php7.2-fpmコンテナにPECLによりPHP拡張機能memcacheを追加。

PECL
https://pecl.php.net/

php7.2-fpmコンテナ内で以下のpeclコマンドによりインストール

# pecl install memcache

peclコマンド一覧

# pecl
Commands:
build                  Build an Extension From C Source
bundle                 Unpacks a Pecl Package
channel-add            Add a Channel
channel-alias          Specify an alias to a channel name
channel-delete         Remove a Channel From the List
channel-discover       Initialize a Channel from its server
channel-info           Retrieve Information on a Channel
channel-login          Connects and authenticates to remote channel server
channel-logout         Logs out from the remote channel server
channel-update         Update an Existing Channel
clear-cache            Clear Web Services Cache
config-create          Create a Default configuration file
config-get             Show One Setting
config-help            Show Information About Setting
config-set             Change Setting
config-show            Show All Settings
convert                Convert a package.xml 1.0 to package.xml 2.0 format
cvsdiff                Run a "cvs diff" for all files in a package
cvstag                 Set CVS Release Tag
download               Download Package
download-all           Downloads each available package from the default channel
info                   Display information about a package
install                Install Package
list                   List Installed Packages In The Default Channel
list-all               List All Packages
list-channels          List Available Channels
list-files             List Files In Installed Package
list-upgrades          List Available Upgrades
login                  Connects and authenticates to remote server [Deprecated in favor of channel-login]
logout                 Logs out from the remote server [Deprecated in favor of channel-logout]
makerpm                Builds an RPM spec file from a PEAR package
package                Build Package
package-dependencies   Show package dependencies
package-validate       Validate Package Consistency
pickle                 Build PECL Package
remote-info            Information About Remote Packages
remote-list            List Remote Packages
run-scripts            Run Post-Install Scripts bundled with a package
run-tests              Run Regression Tests
search                 Search remote package database
shell-test             Shell Script Test
sign                   Sign a package distribution file
svntag                 Set SVN Release Tag
uninstall              Un-install Package
update-channels        Update the Channel List
upgrade                Upgrade Package
upgrade-all            Upgrade All Packages [Deprecated in favor of calling upgrade with no parameters]
Usage: pecl [options] command [command-options] <parameters>
Type "pecl help options" to list all options.
Type "pecl help shortcuts" to list all command shortcuts.
Type "pecl help version" or "pecl version" to list version information.
Type "pecl help <command>" to get the help for the specified command.

キャッシュの有効化
prestashop_memcache

MBOモジュール 503 エラー


モジュールセレクション:modules/addons/modules/catalog/selection、
テーマ一覧:modules/addons/themes/catalog
"Recommended Modules and Services"ボタンなどでの表示エラー

MBO_Error

<原因1:doctrineマッピングエラー>

Entities Mapping

Class Mapping errors
PrestaShopBundle\Entity\Tab * The association PrestaShopBundle\Entity\Tab#tabLangs refers to the owning side field PrestaShopBundle\Entity\TabLang#tab which does not exist.

<対策:以下ファイルの該当箇所を修正>

# nano src/PrestaShopBundle/Entity/TabLang.php

private $id —> private $tab へ修正

class TabLang
{
    /**
     * @ORM\Id
     * @ORM\ManyToOne(targetEntity="PrestaShopBundle\Entity\Tab", inversedBy="tabLangs")
     * @ORM\JoinColumn(name="id_tab", referencedColumnName="id_tab", nullable=false)
     */
    private $tab;
.......
.......

Symfonyデバックモードによる以下メッセージの非表示対応

Enabling the “sensio_framework_extra.router.annotations” configuration is deprecated since version 5.2. Set it to false and use the “Symfony\Component\Routing\Annotation\Route” annotation from Symfony itself

コンテナ内で設定ファイルconfig.ymlに無効化するセクションを追加

# nano app/config/config.yml
sensio_framework_extra:
    router:
         annotations: false