Debugging the visualcaptcha setup

· nat's blog


This is all running on the docker container host, that serves the website front. So log into the container host for this.

Check if php-fpm is running #

php-fpm is running in a container that is feeding a nginx running in another container. Now php-fpm is a cgi-bin not a HTTP receiver, so you can't use curl, which makes it more complicated. Added to that the logging of fpm completely sucks.

To troubleshoot php-fpm, you run docker exec -it phpbb-comments-fp /bin/bash to enter the container.

To send a request install sudo apt install libfcgi-dev and then check the status page:

1QUERY_STRING=full \
2SCRIPT_NAME=/status \
3SCRIPT_FILENAME=/status \
4REQUEST_METHOD=GET cgi-fcgi -bind -connect 127.0.0.1:9000

This should provide some sensible output. If not something is deeply wrong and you should check the fpm (exported to the host under var/logs/php*).

Check visualcaptcha execution #

1QUERY_STRING=full \
2SCRIPT_NAME=/visualcaptcha/public/index.php \
3SCRIPT_FILENAME=/var/www/htdocs/visualcaptcha/public/index.php  \
4REQUEST_METHOD=GET cgi-fcgi -bind -connect 127.0.0.1:9000

And there you go suddenly an error out of nowhere:

1PHP message: PHP Fatal error:  Call to undefined function json_decode() in 
2/var/www/htdocs/visualcaptcha/public/index.php on line 10
3Status: 500 Internal Server Error
4...

This time the problem was that for unknown reasons the json extension was no longer loaded. I had to place it into the php.ini file. ../fpm/php.ini and then restart the php-fpm container.

MEMO:

Do not configure the system with Dockerfile by placing custom php.ini files. Instead just edit in etc/php/fpm on the host and then restart the container.

Check with nginx #

Once its running, you can check with nginx, what is produced:

1curl 172.17.0.1/visualcaptcha/public/index.php

Misc #

Restart a container with:

1docker-compose restart phpbb-comments-fpm

Rebuild containers in order (important) with:

1docker-compose build --no-cache php-fpm 
2docker-compose build --no-cache php-smtp-fpm
3docker-compose build --no-cache php-comments-fpm