WordPress: WordPress: version 4.9.8

PHP version: v7.2.12

Dockcer image is wordpress:4.9.8

The graphic verification code cannot be loaded

Recently, when I used wordpress to build a website, I used the Weike-social-login plug-in to realize the login functions of wechat, QQ, Dagpin and Github. After the function of graphic verification code was turned on, I found that the TWO-DIMENSIONAL code of the graph could not be loaded. F12 saw the status code was 200, but there was no return value. Error This request has no response data available

After opening the wordpress log, it is found thatdebugThe following error is reported in the log file. To enable the debug log method, go to historical articlesHow to enable the WordPress debugging mode (Error message)To print logs towp-contentIn the directorydebug.logIn the.

[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 327Copy the code

Website information says: graphic captcha function needs to be installedGd libraryandfreetypePhpinfo () ¶The GD extension has no FreeType:

Look at the methods in phpInfo ()

Create a new php-info.php file in the root directory of the site:

<? php phpinfo();Copy the code

Saved, with the domain name, such as https://action.liabio.cn/php-info.php, you can see.

Docker compiles images

Dockerfile:

FROM the 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 gdCopy the code

Run the following compile command:

Docker build-t wordpress-freetype:4.9.8Copy the code

Result Compilation error.

Docker image compilation 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\"": unknownCopy the code

Because I use version 19.03.5 docker, I checked the information on the Internet, which basically means that the compilation of version 18 docker will not report errors.

Sure enough, the 18 version of Docker compiled without error:

Use a new image that integrates with FreeType

After using the new image, you can see the successful freeType integration.You can see that the QR code has been successfully displayed.

reference

Docker official PHP image installed after no mysqli GD extension

The author is simple

Author: Xiaowantang, a passionate and serious writer, currently maintains the original public account “My Xiaowantang”, focusing on writing the go language, Docker, Kubernetes, Java and other development, operation and maintenance knowledge to enhance the hard power of the article, looking forward to your attention. Note: Be sure to specify the source (note: from the official account: My Small bowl of soup, author: Small bowl of soup)