I found a PHP error in my server log that says:
[02:09:27 UTC] PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2002] No such file or directory' in /var/www/include/db_connect.php:7
Stack trace:
`#0 /var/www/include/db_connect.php(7): PDO->__construct('mysql:dbname=my...', 'apache', '123...')
Further examination reveals that this error occurs at a time when the server is booting up. The journal log contains the following relevant lines:
02:09:22 systemd[1]: Starting The Apache HTTP Server...
02:09:22 systemd[1]: Starting MariaDB database server...
02:09:22 systemd[1]: Starting The PHP FastCGI Process Manager...
02:09:24 systemd[1]: Started The Apache HTTP Server.
02:09:25 mysqld_safe[713]: Logging to '/var/log/mariadb/mariadb.log'.
02:09:25 mysqld_safe[713]: Starting mysqld daemon with databases from /var/lib/mysql
02:09:25 systemd[1]: Started The PHP FastCGI Process Manager.
02:09:28 NetworkManager[579]: <info> startup complete
02:09:28 systemd[1]: Started MariaDB database server.
Since the PHP error occurs at the 27th second, three seconds after Apache has started, why does PHP complain that it couldn't find the file? In any case, should the starting sequence of Apache, PHP-FPM and MariaDB be reversed so that Apache is the last to get started?