After the base image of the container is replaced, php core warningYii\Base\ErrorExceptionwith messagemoduleGDalready loaded
1. After the basic image of the container is replaced, when the RANCHER environment variable, CHANNEL_PUB_API_CFG_MIGrate=true, the container starts failure. Error: php core warningYii\Base\ErrorExceptionwith messagemoduleGDalready loaded. as shown in Figure 1
chmod 0755 yii
chmod 0755 yii_test
... initialization completed.
CHANNEL_PUB_API_CFG_MIGRATE=true
Yii Migration Tool (based on Yii v2.0.41.1)
No new migrations found. Your system is up-to-date.
PHP Core Warning 'yii\base\ErrorException' with message 'Module 'gd' already loaded'
in ./Unknown:0
Stack trace:
#0 [internal function]: yii\base\ErrorHandler->handleFatalError()
#1 {main}
2. When the RANCHER environment variable, channel_pub_api_cfg_migrate=false, the container starts successfully. as shown in Figure 2
chmod 0755 yii
chmod 0755 yii_test
... initialization completed.
CHANNEL_PUB_API_CFG_MIGRATE=false
running without db migrate
CHANNEL_PUB_API_CFG_CONSOLE=false
copy without console
CHANNEL_PUB_API_CFG_CRONTAB_VTT=false
crontab.php not running
POD_NAMESPACE=ccp
test fail
get environment fail
ENVIRONMENT:default
POD_NAMESPACE=ccp
POD_HOSTIP=192.168.1.46
POD_IP=10.42.2.200
3. When the RANCHER environment variable, channel_pub_api_cfg_migrate=true, is essentially executing a series of command lines.
env | grep CHANNEL_PUB_API_CFG_MIGRATE || export CHANNEL_PUB_API_CFG_MIGRATE="false"
if [[ $CHANNEL_PUB_API_CFG_MIGRATE == "true" ]]
then
php /mcloud/www/ccp_api/yii migrate --migrationPath=@yii/log/migrations/ --interactive=0
php /mcloud/www/ccp_api/yii migrate --interactive=0
php /mcloud/www/ccp_api/yii cache/flush-schema db --interactive=0
php /mcloud/www/ccp_api/yii douyin-web-app/init-sync
php /mcloud/www/ccp_api/yii qq-tp-app/init-sync
php /mcloud/www/ccp_api/yii qq-cw-app/init-sync
php /mcloud/www/ccp_api/yii weibo-weibo-connect-web-app/init-sync
php /mcloud/www/ccp_api/yii wx-bizplugin-app/init-sync
php /mcloud/www/ccp_api/yii netease-tp-app/init-sync
elif [[ $CHANNEL_PUB_API_CFG_MIGRATE == "false" ]]
then
echo "running without db migrate"
else
echo "please set environment variable CHANNEL_PUB_API_CFG_MIGRATE true or false"
fi
4. Decide to manually execute the above commands in the successfully started container first to determine which command is causing the error. Set the RAncher environment variable, channel_pub_api_cfg_migrate=false . The first 3 commands were executed in turn, and all reported errors. as shown in Figure 3
[root@api-console-migrate-5788cbf65c-qkjv2 /]# php /mcloud/www/ccp_api/yii migrate --migrationPath=@yii/log/migrations/ --interactive=0
Yii Migration Tool (based on Yii v2.0.41.1)
No new migrations found. Your system is up-to-date.
PHP Core Warning 'yii\base\ErrorException' with message 'Module 'gd' already loaded'
in ./Unknown:0
Stack trace:
#0 [internal function]: yii\base\ErrorHandler->handleFatalError()
#1 {main}
[root@api-console-migrate-5788cbf65c-qkjv2 /]# php /mcloud/www/ccp_api/yii migrate --interactive=0
Yii Migration Tool (based on Yii v2.0.41.1)
No new migrations found. Your system is up-to-date.
PHP Core Warning 'yii\base\ErrorException' with message 'Module 'gd' already loaded'
in ./Unknown:0
Stack trace:
#0 [internal function]: yii\base\ErrorHandler->handleFatalError()
#1 {main}
[root@api-console-migrate-5788cbf65c-qkjv2 /]# php /mcloud/www/ccp_api/yii cache/flush-schema db --interactive=0
Schema cache for component "db", was flushed.
PHP Core Warning 'yii\base\ErrorException' with message 'Module 'gd' already loaded'
in ./Unknown:0
Stack trace:
#0 [internal function]: yii\base\ErrorHandler->handleFatalError()
#1 {main}
[root@api-console-migrate-5788cbf65c-qkjv2 /]#
5. Search in your own technology blog: ModuleGDalready loaded. Similar problems have been solved. Reference URL:https://www.shuijingwanwq.com/2020/06/15/4240/
6. Check whether GD exists in /usr/local/php/etc/php.ini. exists. as shown in Figure 4
;extension = "memcached.so"
extension = "redis.so"
;extension = "mongo.so"
extension = "sockets.so"
extension = "swoole.so"
extension = "mongodb.so"
extension = "rdkafka.so"
extension = "exif.so"
extension = "imagick.so"
extension = "gd.so"
extension=mcrypt.so
7. Finally, by adding: sed -i in the Dockerfile/gd.so/d/usr/local/php/etc/php.ini & & \ to solve this problem.
RUN sed -i 's/open_basedir = .\/:\/tmp:\/data:\/webtv/;open_basedir = .\/:\/tmp:\/data:\/webtv:\/usr\/local\/php/g' /usr/local/php/etc/php.ini && \
sed -i 's/allow_url_fopen = Off/allow_url_fopen = On/g' /usr/local/php/etc/php.ini && \
sed -i 's/disable_functions = exec,system,passthru,shell_exec,escapeshellarg,escapeshellcmd,proc_close,proc_open,dl,popen,show/disable_functions = system,shell_exec,escapeshellarg,escapeshellcmd,dl,popen,show/g' /usr/local/php/etc/php.ini && \
sed -i 's/;realpath_cache_ttl = 120/realpath_cache_ttl = 1200/g' /usr/local/php/etc/php.ini && \
sed -i '/gd.so/d' /usr/local/php/etc/php.ini && \
sed -i 's/memory_limit = 2048M/memory_limit = 6144M/g' /usr/local/php/etc/php.ini && \
sed -i 's/pm.max_children = 20/pm.max_children = 40/g' /usr/local/php/etc/php-fpm.conf
8. After the upgrade, run the relevant commands again. Error: php core warningYii\Base\ErrorExceptionwith messagemoduleexifalready loaded. Concocted as the law. Added in Dockerfile: sed -i/exif.so/d/usr/local/php/etc/php.ini && \ .
9. Extension of error reporting in sequence: sockets. Also handle it. The 3-line configuration was finally added to the Dockerfile. as shown in Figure 5
10. When the RANCHER environment variable, channel_pub_api_cfg_migrate=true, the container starts successfully. as shown in Figure 6
chmod 0755 yii
chmod 0755 yii_test
... initialization completed.
CHANNEL_PUB_API_CFG_MIGRATE=true
Yii Migration Tool (based on Yii v2.0.41.1)
No new migrations found. Your system is up-to-date.
Yii Migration Tool (based on Yii v2.0.41.1)
Total 1 new migration to be applied:
m211104_075052_alter_ccp_tables
*** applying m211104_075052_alter_ccp_tables
> insert into {{%ccp_platform}} ... done (time: 0.025s)
> insert into {{%channel_type}} ... done (time: 0.059s)
> alter column publish_task_id in table {{%ccp_task_log}} to integer(11) NOT NULL DEFAULT 0 COMMENT '关联任务id' ... done (time: 0.116s)
> alter column account_token in table {{%ccp_platform_account}} to string(500) NOT NULL DEFAULT '' COMMENT '平台账号访问令牌' ... done (time: 0.029s)
> alter column refresh_token in table {{%ccp_platform_account}} to string(500) NOT NULL DEFAULT '' COMMENT '刷新令牌' ... done (time: 0.023s)
*** applied m211104_075052_alter_ccp_tables (time: 0.264s)
1 migration was applied.
Migrated up successfully.
Schema cache for component "db", was flushed.
抖音的网站应用模型的初始化(同步)成功
模型(企鹅号的第三方服务平台应用)创建成功
模型(企鹅号的内容网站应用)创建成功
模型(微博的微连接的网页应用)创建成功
微信的第三方平台应用模型的初始化(同步)成功
模型(网易号的第三方内容平台应用)创建成功
CHANNEL_PUB_API_CFG_CONSOLE=false
copy without console
CHANNEL_PUB_API_CFG_CRONTAB_VTT=false
crontab.php not running
POD_NAMESPACE=ccp
test fail
get environment fail
ENVIRONMENT:default
POD_NAMESPACE=ccp
POD_HOSTIP=192.168.1.48
POD_IP=10.42.3.235





