Issues configuring CacheTool & PHP-FPM

1.7k Views Asked by At

I'm trying to use the CacheTool recipe from Deployer.

I'm having issues with the configuration of cachetool.

Using WHM / cPanel and PHP version is PHP 7.4 (ea-php74).

set('cachetool', '/var/cpanel/php-fpm/<username>/sock'); Results in the following error:

In AbstractCommand.php line 39:                                                                                                                                                                                                                                                               
Extension `Zend OPcache` is not loaded
                                                                                                                                                                                   
opcache:reset

Using a specific socket file for the domain: set('cachetool', '/opt/cpanel/ea-php74/root/usr/var/run/php-fpm/<hashed-domain>.sock');

results in

In FastCGI.php line 114:
Error: File not found.
opcache:reset

Trying with the IP: set('cachetool', '127.0.0.1:9000'); returns

================                                                                                               
In FastCGI.php line 143:                       
FastCGI error: Unable to connect to FastCGI application: Connection refused (127.0.0.1:9000)                                                                                                             
In Socket.php line 320:
Unable to connect to FastCGI application: Connection refused

In Socket.php line 270:                                  
stream_socket_client(): unable to connect to tcp://127.0.0.1:9000 (Connection refused)

opcache:reset

I'm a bit lost in all configuration files/possibilities, anyone who can help? Thanks!

1

There are 1 best solutions below

0
On

Define --fcgi-chroot and/or --tmp-dir options to make it work.

From [Readme][1]:

Troubleshooting


[RuntimeException] Error: Unable to open primary script: /dev/shm/cachetool-584743c678dbb.php (No such file or directory) Status: 404 Not Found Content-type: text/html; charset=UTF-8 No input file specified.

This means that cachetool could not write to /dev/shm provide a directory that cachetool can write to through php cachetool.phar --tmp-dir=/writable/dir or configuration.

...

  • To connect to a chrooted fastcgi server you need to set --fcgi-chroot and --tmp-dir parameters
 php cachetool.phar opcache:status --fcgi=/var/run/php5-fpm.sock --fcgi-chroot=/path/to/chroot --tmp-dir=/path/to/chroot/tmp