Wordpress version: wordpress:4.9.8 version
php version: v7.2.12
The dockcer image is: wordpress:4.9.8
Article Directory
Graphic Authentication Code could not be loaded
When building a station with wordpress recently, when wechat-social-login plug-in is used to implement Wechat, QQ, Pin, Github login function, after opening the graphics verification code function, you can see that the graphics QR code can not be loaded all the time. F12 can see the status code is 200, but there is no return value, error This request has no response data available
After opening the wordpress log, the following error was reported in the debug log file.Open debug log method please step through the history article How to turn on WordPress debugging mode (error alert) , print the log to debug.log in the wp-content directory.
[08-Feb-2020 07:37:42 UTC] PHP Fatal error: Uncaught Error: Call to undefined function Gregwar\Captcha\imagettfbbox() in /var/www/html/wp-content/plugins/wechat-social-login/includes/captcha/CaptchaBuilder.php:327 Stack trace: #0 /var/www/html/wp-content/plugins/wechat-social-login/includes/captcha/CaptchaBuilder.php(440): Gregwar\Captcha\CaptchaBuilder->writePhrase(Resource id #7, '84sx', '/var/www/html/w...', 150, 40) #1 /var/www/html/wp-content/plugins/wechat-social-login/includes/social/class-xh-social-ajax.php(203): Gregwar\Captcha\CaptchaBuilder->build() #2 /var/www/html/wp-content/plugins/wechat-social-login/includes/social/class-xh-social-ajax.php(209): XH_Social_Ajax::{closure}() #3 /var/www/html/wp-includes/class-wp-hook.php(286): XH_Social_Ajax::captcha('') #4 /var/www/html/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters('', Array) #5 /var/www/html/wp-includes/plugin.php(453): WP_Hook->do_action(Array) #6 /var/www/html/wp-admin/admin-ajax.php(99): do_action('wp_ajax_xh_soci...') #7 {main} thrown in /var/www/html/wp-content/plugins/wechat-social-login/includes/captcha/CaptchaBuilder.php on line 327
Web site queries said: Graphic Authentication Code features require the installation of gd libraries, freetype and other dependencies, as detailed by phpinfo(): gd extension does not have freetype:
Ways to view phpinfo()
Create a new php-info.php file in the root directory of the Web site, which contains:
<?php phpinfo();
After saving, you can see it by accessing it with the domain name, such as https://action.liabio.cn/php-info.php.
docker compile mirror
The Dockerfile file is as follows:
FROM wordpress:4.9.8 RUN echo 'deb http://mirrors.163.com/debian/ stretch main contrib non-free\ndeb http://mirrors.163.com/debian/ stretch-updates main contrib non-free\ndeb http://mirrors.163.com/debian/ stretch-backports main contrib non-free' > /etc/apt/sources.list RUN apt update \ && apt install -y libwebp-dev libjpeg-dev libpng-dev libfreetype6-dev \ && docker-php-source extract \ && cd /usr/src/php/ext/gd \ && docker-php-ext-configure gd --with-webp-dir=/usr/include/webp --with-jpeg-dir=/usr/include --with-png-dir=/usr/include --with-freetype-dir=/usr/include/freetype2 \ && docker-php-ext-install gd \ && php -m | grep gd
Execute the following compilation commands:
docker build -t wordpress-freetype:4.9.8 .
Result compilation error.
docker compile mirror error
OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:319: getting the final child's pid from pipe caused \"EOF\"": unknown
Because I used the 19.03.5 version of docker, I checked the data on the Internet, which roughly means that I need the 18 version of docker to compile without error.
True, the 18 version docker compilation did not error:
Use a new mirror that integrates freetype
With the new mirror, you can see that freetype is successfully integrated.
You can see that the QR code has been successfully displayed.
Reference resources
No mysqli gd expansion after installation under docker's official php mirror