Giter Club home page Giter Club logo

cachetool's People

Contributors

bangpound avatar barasimumatik avatar brandung-sjorek avatar duxthefux avatar floodcode avatar francoisfreitag avatar fyrye avatar gander avatar gordalina avatar jaymecd avatar jdufresne avatar johnorourke avatar jrmbrgs avatar marvinhinz avatar masonm avatar mbrodala avatar mikesorokin avatar mwernaert avatar myfluxi avatar nlemoine avatar pauliuspetronis avatar rusnak avatar scuben avatar sebastien-fauvel avatar sideshowcoder avatar simpod avatar svillette avatar szepeviktor avatar tmotyl avatar vigneshgurusamy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cachetool's Issues

Latest phar file is missing the new FCGI vendor

We use cachetool in our deploy scripts and since 1.8.0 we have issues with the phar file:

curl -sO http://gordalina.github.io/cachetool/downloads/cachetool.phar
php cachetool.phar apc:cache:clear all --fcgi=/tmp/.xxx-fpm.sock
PHP Fatal error:  Class 'Adoy\FastCGI\Client' not found in phar:///home/kumaci/cachetool.phar/src/CacheTool/Adapter/FastCGI.php on line 45

Seems like the new Adoy classes are not included in the phar file

Apc info fail with php7

Hi,

The "apc:cache:info" options fail with php-fpm 7.0:

/vagrant$ sudo -u www-data -g www-data php cachetool.phar apc:cache:info --fcgi=/var/run/php/php7.0-fpm.sock

Fatal error: Uncaught TypeError: Argument 1 passed to CacheTool\Command\ApcCacheInfoCommand::normalize() must be of the type array, null given, called in phar:///vagrant/cachetool.phar/src/CacheTool/Command/ApcCacheInfoCommand.php on line 61 and defined in phar:///vagrant/cachetool.phar/src/CacheTool/Command/ApcCacheInfoCommand.php on line 102

TypeError: Argument 1 passed to CacheTool\Command\ApcCacheInfoCommand::normalize() must be of the type array, null given, called in phar:///vagrant/cachetool.phar/src/CacheTool/Command/ApcCacheInfoCommand.php on line 61 in phar:///vagrant/cachetool.phar/src/CacheTool/Command/ApcCacheInfoCommand.php on line 102

Call Stack:
    0.0191    1047000   1. {main}() /vagrant/cachetool.phar:0
    0.0192    1045920   2. require('phar:///vagrant/cachetool.phar/bin/cachetool') /vagrant/cachetool.phar:10
    0.0480    2307112   3. Symfony\Component\Console\Application->run() phar:///vagrant/cachetool.phar/bin/cachetool:35
    0.0535    2612528   4. CacheTool\Console\Application->doRun() phar:///vagrant/cachetool.phar/vendor/symfony/console/Application.php:117
    0.0547    2650640   5. Symfony\Component\Console\Application->doRun() phar:///vagrant/cachetool.phar/src/CacheTool/Console/Application.php:119
    0.0549    2650640   6. CacheTool\Console\Application->doRunCommand() phar:///vagrant/cachetool.phar/vendor/symfony/console/Application.php:186
    0.1319    3076336   7. Symfony\Component\Console\Application->doRunCommand() phar:///vagrant/cachetool.phar/src/CacheTool/Console/Application.php:136
    0.1320    3076336   8. Symfony\Component\Console\Command\Command->run() phar:///vagrant/cachetool.phar/vendor/symfony/console/Application.php:791
    0.1330    3079080   9. CacheTool\Command\ApcCacheInfoCommand->execute() phar:///vagrant/cachetool.phar/vendor/symfony/console/Command/Command.php:256
    0.1772    3119848  10. CacheTool\Command\ApcCacheInfoCommand->normalize() phar:///vagrant/cachetool.phar/src/CacheTool/Command/ApcCacheInfoCommand.php:61


Variables in local scope (#10):
  $array = NULL
  $key = *uninitialized*
  $value = *uninitialized*

cachetool.phar 3.1.0 no longer works with PHP 7.0

I think this is due to Symfony 4.0 support (which wasn't previously released), which in turn does not support PHP 7.0 (mostly due to usage of nullable return and method parameter types).

When trying to run cachetool.phar with 7.0 I'm getting the error:

PHP Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) in phar://cachetool.phar/vendor/symfony/console/Output/Output.php on line 40

symfony/console/Output/Output.php:40

tag a new release?

There's been quite some interesting changed since October, so it'd be nice to have a release with them in it.

Opcache errors after deployment with symlink switch

Even though we are invoking the cachetool during deployment to reset the PHP opcode cache, we encounter internal server errors after the symlink switch to the new release. The error disappears after a short while.

To verify that everything is basically working correct we have also put opcache:status before and after opcache:reset:

$ .../bin/cachetool opcache:status
+----------------------+---------------------------------+
| Name                 | Value                           |
+----------------------+---------------------------------+
| Enabled              | Yes                             |
| Cache full           | No                              |
| Restart pending      | No                              |
| Restart in progress  | No                              |
| Memory used          | 53.81 MiB                       |
| Memory free          | 74.19 MiB                       |
| Memory wasted (%)    | 0 b (0%)                        |
| Strings buffer size  | 16 MiB                          |
| Strings memory used  | 6.73 MiB                        |
| Strings memory free  | 9.27 MiB                        |
| Number of strings    | 335325                          |
+----------------------+---------------------------------+
| Cached scripts       | 1054                            |
| Cached keys          | 1372                            |
| Max cached keys      | 16229                           |
| Start time           | Fri, 12 Feb 2016 14:04:08 +0000 |
| Last restart time    | Tue, 16 Feb 2016 10:32:12 +0000 |
| Oom restarts         | 0                               |
| Hash restarts        | 0                               |
| Manual restarts      | 7                               |
| Hits                 | 8193                            |
| Misses               | 1073                            |
| Blacklist misses (%) | 0 (0%)                          |
| Opcache hit rate     | 88.420030218001                 |
+----------------------+---------------------------------+

$ .../bin/cachetool opcache:reset

$ .../bin/cachetool opcache:status
+----------------------+---------------------------------+
| Name                 | Value                           |
+----------------------+---------------------------------+
| Enabled              | Yes                             |
| Cache full           | No                              |
| Restart pending      | No                              |
| Restart in progress  | No                              |
| Memory used          | 20.87 MiB                       |
| Memory free          | 107.13 MiB                      |
| Memory wasted (%)    | 0 b (0%)                        |
| Strings buffer size  | 16 MiB                          |
| Strings memory used  |  452.05 KiB                     |
| Strings memory free  | 15.56 MiB                       |
| Number of strings    | 335325                          |
+----------------------+---------------------------------+
| Cached scripts       | 0                               |
| Cached keys          | 0                               |
| Max cached keys      | 16229                           |
| Start time           | Fri, 12 Feb 2016 14:04:08 +0000 |
| Last restart time    | Tue, 16 Feb 2016 12:08:43 +0000 |
| Oom restarts         | 0                               |
| Hash restarts        | 0                               |
| Manual restarts      | 8                               |
| Hits                 | 0                               |
| Misses               | 2                               |
| Blacklist misses (%) | 0 (0%)                          |
| Opcache hit rate     | 0                               |
+----------------------+---------------------------------+

While I'm not sure about the memory and string usage, scripts and keys are indeed removed as expected.

This is an environment with an Apache 2.4.10 and PHP 5.6.17 with PHP-FPM. The relevant part of the php.ini:

opcache.enable=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=8192
opcache.validate_timestamps=0
opcache.revalidate_freq=0

Any idea what could be wrong?

Prime the opcode cache

Hi!
I saw there's support for the opcode_compile_file function on the opcache adapter, but there's no real command defined that gives you that functionality. Is there any reason for this? I'm thinking of extending this repo to add that command.

Are you open to a PR about this?

Regards,
Joaquín

Not in white list. Check listen.allowed_clients

We use cachetool in our (automated) deploys. Once in a while this fails with a RuntimeException

FastCGI error: Not in white list. Check listen.allowed_clients.

It would be nice if cachetool could deal with this more gracefully (e.g. try again a few times and exit) instead of throwing an exception.

This happens on Ubuntu 16.04 + PHP 7.0.21

ApcProxy::apc_add functionality is incorrect

Since apc_add and apc_store can accept a string or array for the key, when a string is supplied a var must also be applied, otherwise when key is an array it is handled as a key:var paired array

$cache->apc_add(['Hello' => 'World']); results in an exception being thrown.

public function apc_add($key, $var = null, $ttl = 0)
    {
        if (is_array($key) && $var === null) {
            throw new \InvalidArgumentException('When $key is set $var cannot be null');
        }

should be something like

public function apc_add($key, $var = null, $ttl = 0)
    {
        if (is_string($key) && $var === null) {
            throw new \InvalidArgumentException('When $key is set $var cannot be null');
        } elseif (is_array($key) && $var !== null) {
            throw new \InvalidArgumentException('When $key is an array $var must be null');
        }

reference: http://php.net/manual/en/function.apcu-add.php

PHP Fatal error: Unknown: Failed opening required in Unknown on line 0

hello, when i use cachetools reset opcache in php7 environoment ,sometimes i got a php-error:

[25-Oct-2016 16:20:45 Asia/Shanghai] PHP Fatal error:  Unknown: Failed opening required '/home/user/webroot/site/application/model/v2/index.php'(include_path='.:/home/user/php7/lib/php') in Unknown on line 0

i use codeigniter web framework, can you help me solve this problem?

opcache last restart time:

| Last restart time | Tue, 25 Oct 2016 16:20:45 +0000 |

opcache setting:

zend_extension="/home/user/php7/lib/php/extensions/no-debug-non-zts-20151012/opcache.so"
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=11000
opcache.revalidate_freq=0
opcache.fast_shutdown=1
opcache.enable_cli=0
opcache.save_comments=0
opcache.enable_file_override=0
opcache.huge_code_pages=0
opcache.validate_timestamps=0
opcache.log_verbosity_level=2
opcache.error_log=/home/user/php7/log/opcache.error.log

Try socket and tcp by default

It'd be great if by default cachetool would attempt a connection on 127.0.0.1:9000 (as it does now) but if that fails also attempt /var/run/php5-fpm.sock before giving up.

1.x branch and Symfony 2

Any way to create a 1.x branch or create a 1.10.1 tag for the fixes to v1?

I'm stuck with Symfony >= 2.5 components for my application, so would be nice to continue support for Symfony 2.x.
Not sure what specific Symfony 3 portions your library uses, so may only need to update composer since the Table Helper was depreciated in 2.5 and removed from the console as a separate component in 3.0.

Following how Doctrine uses their include for 2.5 which requires Symfony Console and works with Symfony 2 or 3.

    "require": {
        "php": ">=5.4",
        "symfony/console": "~2.5|~3.0",
        "symfony/dependency-injection": "~2.5|~3.0",
        "symfony/process": "~2.5|~3.0",
        "symfony/yaml": "~2.5|~3.0",
        "psr/log": "~1.0",
        "monolog/monolog": "~1.1",
        "adoy/fastcgi-client": "~1.0"
    },

Simple as is: thank you!

Wonderful too for production and devops, thank you very much for taking so much effort into this!

PHP Fatal error: Uncaught RuntimeException: Error: Primary script unknown

I am not so sure what I am doing wrong, but I cant get it work in this env of php56.

Steps:

  1. php72 $(which composer) global require gordalina/cachetool --prefer-dist
  2. Create cache.php
<?php
include '<HOME-DIR>/.composer/vendor/autoload.php';

use CacheTool\Adapter\FastCGI;
use CacheTool\CacheTool;

$adapter = new FastCGI('/var/run/php-fpm/php-fpm.sock');
$cache = CacheTool::factory($adapter);
$cache->opcache_reset();

php cache.php

Results:

[2018-08-27 15:36:25] cachetool.DEBUG: FastCGI: Response: "Primary script unknown\nStatus: 404 Not Found\r\nX-Powered-By: PHP\/5.6.37\r\nContent-type: text\/html; charset=UTF-8\r\n\r\nFile not found.\n" [] []
PHP Fatal error:  Uncaught RuntimeException: Error: Primary script unknown
Status: 404 Not Found
X-Powered-By: PHP/5.6.37
Content-type: text/html; charset=UTF-8

File not found.
 in <HOME-DIR>.composer/vendor/gordalina/cachetool/src/CacheTool/Adapter/FastCGI.php:94
Stack trace:
#0 <HOME-DIR>.composer/vendor/gordalina/cachetool/src/CacheTool/Adapter/AbstractAdapter.php(43): CacheTool\Adapter\FastCGI->doRun(Object(CacheTool\Code))
#1 <HOME-DIR>.composer/vendor/gordalina/cachetool/src/CacheTool/Proxy/OpcacheProxy.php(140): CacheTool\Adapter\AbstractAdapter->run(Object(CacheTool\Code))
#2 [internal function]: CacheTool\Proxy\OpcacheProxy->opcache_reset()
#3 <HOME-DIR>.composer/vendor/gordalina/cachetool/src/CacheTool/CacheTool.php(167): call_user_func_array(Array, Array)
#4 <HOME-DIR>cache.php(13): CacheTool\CacheTool->__call('opcache_reset', Array)
#5 {main}
  thrown in <HOME-DIR>.composer/vendor/gordalina/cachetool/src/CacheTool/Adapter/FastCGI.php on line 94

Remarks:
The only thing that is a bit exceptional is that this is a server with php56, where php72 is installed on cli only to get the cachetool to work.

Many thanks

cachetool doesn't work out of the box with SELinux

You get a 404 on the fastgi response because it doesn't have the permission to read the cachetool generated file.

I'm not sure if this is really solvable without changing selinux configuration, but i do wonder if the stdin option of the fastcgi client would fix it.

Can you think of a quick hack to try that out?

primary script unknown

When i run "php cachetool.phar opcache:reset --fcgi=127.0.0.1:9000"
throw exception follow
[RuntimeException]
Error: Primary script unknown
Status: 404 Not Found
X-Powered-By: PHP/7.1.9
Content-type: text/html; charset=UTF-8
File not found.

File paths are relative to current working directory (opcache:status:scripts)

Is there any specific reason why the file paths in the output of opcache:status:scripts are made relative to the current working directory (see processFilename() here and here)?

This leads to the strange situation that one has to use different parameters depending on the current working directory when using opcache:invalidate:scripts, eg:

# cwd is /var/www/
$ cachetool.phar opcache:invalidate:scripts /var/www/test.php # this does not work
$ cachetool.phar opcache:invalidate:scripts ./test.php # this works

I would expect to see an absolute path in the output of opcache:status:scripts. Maybe we could add an option --absolute to the relevant commands?

Unknown: open_basedir restriction in effect

When i run cachetool opcache:status --fcgi=/var/run/php-fpm.sock, it returns error:

[RuntimeException] Error: PHP message: PHP Warning: Unknown: open_basedir restriction in effect. File(/dev/shm/cachetool-572717ff2f3de.php) is not within the allowed path(s): (/var/www/:/tmp) in Unknown on line 0 PHP message: PHP Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0 Unable to open primary script: /dev/shm/cachetool-572717ff2f3de.php (Operation not permitted) Status: 404 Not Found X-Powered-By: PHP/7.0.5 Content-type: text/html; charset=UTF-8 No input file specified.

How to solve this issue?

Use it without PHP-FPM?

Hello, is it possible to use this library without PHP-FPM?
I have a server with just Apache and mod-php, how can I make it work?
Do I have to create a dummy php page which just executes apc_clear_cache and call it using file_get_contents?

Thanks.

php-fpm pool

Hi, is there an easy way to use this with multiple php-fpm servers?

Can't install version 2.1.0 as composer dependency

If I try to install "gordalina/cachetool": "2.1.0" as required dependency in composer the package can't be found.

Composer stops at: Resolving dependencies through SAT

If I try it with "gordalina/cachetool": "*" it downloads only version 1.11.0

--version option return wrong version

Hi, I found that --version option return wrong version.

You can reproduce

$ curl -sO http://gordalina.github.io/cachetool/downloads/cachetool-3.1.0.phar
$ chmod +x cachetool-3.1.0.phar
$ ./cachetool-3.1.0.phar --version
CacheTool 3.0.0-20-g8b40e86

$ curl -sO http://gordalina.github.io/cachetool/downloads/cachetool-3.2.1.phar
$ chmod +x cachetool-3.2.1.phar
$ ./cachetool-3.2.1.phar --version
CacheTool 3.1.0-1-ga8bed42

$ curl -sO http://gordalina.github.io/cachetool/downloads/cachetool-4.0.0.phar
$ chmod +x cachetool-4.0.0.phar
$ ./cachetool-4.0.0.phar --version
CacheTool 3.2.1-2-ga819a69

Thanks 👍

Machine output

I'd like to monitor Memory free every two minutes.

It would be nice to have cachetool opcache:status --format=json

In WP-CLI there are:

– table
– csv
– json
– yaml

cachetool via fcgi doesn't work if php-fpm starts with systemd unit set to PrivateTmp=true

If the php-fpm systemd unit file has PrivateTmp=true and you run cachetool with this:

cachetool  opcache:status -vvv --fcgi /var/run/php-fpm/php-fpm.sock

then you see this in the logs (snipped to the relevant part):

[2015-01-06 20:55:05] cachetool.DEBUG: Executing code: return extension_loaded('Zend OPcache'); [] []
[2015-01-06 20:55:05] cachetool.INFO: FastCGI: Dumped code to file: /tmp/cachetool-54ac91f90c03f.php [] []
object(CacheTool\Code)#82 (1) {
  ["code":protected]=>
  array(1) {
    [0]=>
    string(40) "return extension_loaded('Zend OPcache');"
  }
}
[2015-01-06 20:55:05] cachetool.DEBUG: FastCGI: Response: {"statusCode":404,"headers":{"status":"404 Not Found","content-type":"text\/html; charset=UTF-8"},"body":"File not found.","stderr":"Primary script unknown\n"} [] []



  [RuntimeException]      
  Primary script unknown  

Restore apcu compatibility when storing NULL

Storing NULL values is a value use case for apcu:

php > apcu_store('a', null); var_dump(apcu_fetch('a'));
php shell code:1:
NULL

However, the ApcuProxy is throwing an exception in this case, which breaks the compatibility with the underlying function we are proxying to:

public function apcu_store($key, $var = null, $ttl = 0)
{
    if (is_string($key) && $var === null) {
        throw new \InvalidArgumentException('When $key is set $var cannot be null');
    }

    $code = new Code();
    $code->addStatement(sprintf(
        'return apcu_store(%s, %s, %s);',
        var_export($key, true),
        var_export($var, true),
        var_export($ttl, true)
    ));

    return $this->adapter->run($code);
}

It might make sense to throw an exception in a different use case, when $key is an array of key-value pairs and $val is ignored:

if (is_array($key) && $var !== null) {
    throw new \InvalidArgumentException('When $key is an array $var must be null');
}

But even in this case, I don't think it is the role of a proxy to enforce such rules. So I would suggest to remove the exception altogether.

Fixed in #54.
@gordalina what do you think?

Multi-format output

Allow users to specify output with a given format, e.g.: table, csv, json, yaml

Example:

cachetool opcache:status --format=json

See: #66 (initially suggested by @szepeviktor)

Current Version does not work with PHP 7.0.x

Hi,

we use your tool in our automated deployment pipeline. The current PHP version of the project where the error occurs is 7.0.30.

Install

curl -sO http://gordalina.github.io/cachetool/downloads/cachetool.phar
chmod +x cachetool.phar

Execute

/usr/bin/php cachetool.phar

Error

PHP Parse error:  syntax error, unexpected '?' in phar://*/cachetool.phar/vendor/symfony/yaml/Parser.php on line 499

Your documentation specifies the minimum version to 5.5.9+.

Any advice?

Syntax Error with php 5.4

Hi,

despite of saying that it requires PHP 5.3 it does not work with PHP 5.4, PHP 5.5 is okay.
Perhaps this should be updated in the Readme and on the website. Or is there a version that does still work with PHP 5.4/5.3?

$ php -v
PHP 5.4.36 (cli) (built: Dec 20 2014 14:09:43)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
$ php cachetool.phar opcache:status
PHP Parse error:  syntax error, unexpected '{' in phar:///var/www/cachetool.phar/vendor/symfony/dependency-injection/Container.php on line 280

3.1.0 doesn't work with php 5.6.30

Current release cachetool 3.1.0 running on php 5.6.30 shows error

PHP Fatal error:  Default value for parameters with a class type hint can only be NULL in phar:///opt/util/cachetool.phar/vendor/symfony/console/Application.php on line 83
PHP Stack trace:
PHP   1. {main}() /opt/util/cachetool.phar:0
PHP   2. require() /opt/util/cachetool.phar:10
PHP   3. spl_autoload_call() /opt/util/cachetool.phar:9
PHP   4. Composer\Autoload\ClassLoader->loadClass() /opt/util/cachetool.phar:9
PHP   5. Composer\Autoload\includeFile() phar:///opt/util/cachetool.phar/vendor/composer/ClassLoader.php:322
PHP   6. include() phar:///opt/util/cachetool.phar/vendor/composer/ClassLoader.php:444
PHP   7. spl_autoload_call() phar:///opt/util/cachetool.phar/vendor/composer/ClassLoader.php:32
PHP   8. Composer\Autoload\ClassLoader->loadClass() phar:///opt/util/cachetool.phar/vendor/composer/ClassLoader.php:32
PHP   9. Composer\Autoload\includeFile() phar:///opt/util/cachetool.phar/vendor/composer/ClassLoader.php:322

Maintain a changelog

It would be really nice if there was a changelog in this repository, either as separate file or in the README. As usual, git log output doesn't count. ;-)

`PHP Fatal error` with config file in `/etc/cachetool.yml`

Thank you for this very useful tool!

I have an error when I try to use a configuration file in /etc/cachetool.yml. Is it a bug?

PHP Fatal error:  Uncaught TypeError: Argument 1 passed to CacheTool\Console\Config::__construct() must be of the type array, string given, called in phar:///usr/bin/cachetool/bin/cachetool on line 24 and defined in phar:///usr/bin/cachetool/src/CacheTool/Console/Config.php:22
Stack trace:
#0 phar:///usr/bin/cachetool/bin/cachetool(24): CacheTool\Console\Config->__construct('/etc/cachetool....')
#1 phar:///usr/bin/cachetool/bin/cachetool(31): loadConfig()
#2 /usr/bin/cachetool(10): require('phar:///usr/bin...')
#3 {main}
  thrown in phar:///usr/bin/cachetool/src/CacheTool/Console/Config.php on line 22

The content of /etc/cachetool.yml:

adapter: fastcgi
fastcgi: /var/run/php/php7.0-fpm.sock

Connect to remote host

Very nice tool you've created!

It works just fine on localhost, where I am running PHP7-FPM, but when I try to connect to remote host, the script assumes local shm, and if I run a command like this ./cachetool.phar --fcgi=www2:9001 opcache:invalidate:scripts /var/data/gfs/www/magento/, it throws exceptions of such kind:

[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.

Can you look into possibility to execute

Using ApcIterator instead of loading all cache_info into memory

Hello!
Did you consider switching from apc_cache_info way to APC[U]Iterator on some commands like apcu:regexp:delete. Iterator would allow to significally descrease memory consumption, especially on servers with low php.memory_limit and large apc cache size.
For now (using 1.11.0 version with php 5.4.45) I can`t even clear cache by regexp if php.memory_limit = 128M and apc.shm_size = 1G because of size of apcu_cache_info's data.
And this logic still remain in 2.* versions as I see.
image

Issues running commands with composer-installed version 3.2.1

Running CLI commands on the composer-installed version 3.2.1 of cachetool runs into some errors, I think something is broken with regards to the new config features merged in #69

Reverted to using 3.0.0 for now, which is running fine.

root@fcf03b73b83d:/var/www/html# php vendor/gordalina/cachetool/bin/cachetool opcache:status 

Warning: in_array() expects parameter 2 to be array, null given in /var/www/html/vendor/gordalina/cachetool/src/CacheTool/Console/Application.php on line 65

Call Stack:
    0.0009     352760   1. {main}() /var/www/html/vendor/gordalina/cachetool/bin/cachetool:0
    0.0595    2586840   2. CacheTool\Console\Application->__construct() /var/www/html/vendor/gordalina/cachetool/bin/cachetool:10
    0.0595    2586840   3. CacheTool\Console\Application->__construct() /var/www/html/vendor/gordalina/cachetool/src/CacheTool/Console/Application.php:50
    0.0704    2859920   4. CacheTool\Console\Application->getDefaultCommands() /var/www/html/vendor/symfony/console/Application.php:89
    0.0740    2969752   5. in_array() /var/www/html/vendor/gordalina/cachetool/src/CacheTool/Console/Application.php:65


Warning: in_array() expects parameter 2 to be array, null given in /var/www/html/vendor/gordalina/cachetool/src/CacheTool/Console/Application.php on line 79

Call Stack:
    0.0009     352760   1. {main}() /var/www/html/vendor/gordalina/cachetool/bin/cachetool:0
    0.0595    2586840   2. CacheTool\Console\Application->__construct() /var/www/html/vendor/gordalina/cachetool/bin/cachetool:10
    0.0595    2586840   3. CacheTool\Console\Application->__construct() /var/www/html/vendor/gordalina/cachetool/src/CacheTool/Console/Application.php:50
    0.0704    2859920   4. CacheTool\Console\Application->getDefaultCommands() /var/www/html/vendor/symfony/console/Application.php:89
    0.0745    2969784   5. in_array() /var/www/html/vendor/gordalina/cachetool/src/CacheTool/Console/Application.php:79


Warning: in_array() expects parameter 2 to be array, null given in /var/www/html/vendor/gordalina/cachetool/src/CacheTool/Console/Application.php on line 91

Call Stack:
    0.0009     352760   1. {main}() /var/www/html/vendor/gordalina/cachetool/bin/cachetool:0
    0.0595    2586840   2. CacheTool\Console\Application->__construct() /var/www/html/vendor/gordalina/cachetool/bin/cachetool:10
    0.0595    2586840   3. CacheTool\Console\Application->__construct() /var/www/html/vendor/gordalina/cachetool/src/CacheTool/Console/Application.php:50
    0.0704    2859920   4. CacheTool\Console\Application->getDefaultCommands() /var/www/html/vendor/symfony/console/Application.php:89
    0.0757    2969784   5. in_array() /var/www/html/vendor/gordalina/cachetool/src/CacheTool/Console/Application.php:91

                                                                  
  [Symfony\Component\Console\Exception\CommandNotFoundException]  
  There are no commands defined in the "opcache" namespace. 

Dependency conflict due to Symfony v2.x

This package can't be installed in any project that uses Symfony 3.x packages. I suggest you bump the Symfony component dependencies to ~3.0.

Reference:

composer require gordalina/cachetool
You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
Using version ^1.10 for gordalina/cachetool
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for gordalina/cachetool ^1.10 -> satisfiable by gordalina/cachetool[1.10.0].
    - Conclusion: remove symfony/yaml v3.0.3
    - Conclusion: don't install symfony/yaml v3.0.3
    - gordalina/cachetool 1.10.0 requires symfony/yaml ~2.1 -> satisfiable by symfony/yaml[v2.1.0, v2.1.1, v2.1.10, v2.1.11, v2.1.12, v2.1.13, v2.1.2, v2.1.3, v2.1.4, v2.1.5, v2.1.6, v2.1.7, v2.1.8, v2.1.9, v2.2.0, v2.2.1, v2.2.10, v2.2.11, v2.2.2, v2.2.3, v2.2.4, v2.2.5, v2.2.6, v2.2.7, v2.2.8, v2.2.9, v2.3.0, v2.3.1, v2.3.10, v2.3.11, v2.3.12, v2.3.13, v2.3.14, v2.3.15, v2.3.16, v2.3.17, v2.3.18, v2.3.19, v2.3.2, v2.3.20, v2.3.21, v2.3.22, v2.3.23, v2.3.24, v2.3.25, v2.3.26, v2.3.27, v2.3.28, v2.3.29, v2.3.3, v2.3.30, v2.3.31, v2.3.32, v2.3.33, v2.3.34, v2.3.35, v2.3.36, v2.3.37, v2.3.38, v2.3.39, v2.3.4, v2.3.5, v2.3.6, v2.3.7, v2.3.8, v2.3.9, v2.4.0, v2.4.1, v2.4.10, v2.4.2, v2.4.3, v2.4.4, v2.4.5, v2.4.6, v2.4.7, v2.4.8, v2.4.9, v2.5.0, v2.5.1, v2.5.10, v2.5.11, v2.5.12, v2.5.2, v2.5.3, v2.5.4, v2.5.5, v2.5.6, v2.5.7, v2.5.8, v2.5.9, v2.6.0, v2.6.1, v2.6.10, v2.6.11, v2.6.12, v2.6.13, v2.6.2, v2.6.3, v2.6.4, v2.6.5, v2.6.6, v2.6.7, v2.6.8, v2.6.9, v2.7.0, v2.7.1, v2.7.10, v2.7.2, v2.7.3, v2.7.4, v2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9, v2.8.0, v2.8.1, v2.8.2, v2.8.3].
    - Can only install one of: symfony/yaml[v2.1.0, v3.0.3].
    - Can only install one of: symfony/yaml[v2.1.1, v3.0.3].
    - Can only install one of: symfony/yaml[v2.1.10, v3.0.3].
    - Can only install one of: symfony/yaml[v2.1.11, v3.0.3].
    - Can only install one of: symfony/yaml[v2.1.12, v3.0.3].
    - Can only install one of: symfony/yaml[v2.1.13, v3.0.3].
    - Can only install one of: symfony/yaml[v2.1.2, v3.0.3].
    - Can only install one of: symfony/yaml[v2.1.3, v3.0.3].
    - Can only install one of: symfony/yaml[v2.1.4, v3.0.3].
    - Can only install one of: symfony/yaml[v2.1.5, v3.0.3].
    - Can only install one of: symfony/yaml[v2.1.6, v3.0.3].
    - Can only install one of: symfony/yaml[v2.1.7, v3.0.3].
    - Can only install one of: symfony/yaml[v2.1.8, v3.0.3].
    - Can only install one of: symfony/yaml[v2.1.9, v3.0.3].
    - Can only install one of: symfony/yaml[v2.2.0, v3.0.3].
    - Can only install one of: symfony/yaml[v2.2.1, v3.0.3].
    - Can only install one of: symfony/yaml[v2.2.10, v3.0.3].
    - Can only install one of: symfony/yaml[v2.2.11, v3.0.3].
    - Can only install one of: symfony/yaml[v2.2.2, v3.0.3].
    - Can only install one of: symfony/yaml[v2.2.3, v3.0.3].
    - Can only install one of: symfony/yaml[v2.2.4, v3.0.3].
    - Can only install one of: symfony/yaml[v2.2.5, v3.0.3].
    - Can only install one of: symfony/yaml[v2.2.6, v3.0.3].
    - Can only install one of: symfony/yaml[v2.2.7, v3.0.3].
    - Can only install one of: symfony/yaml[v2.2.8, v3.0.3].
    - Can only install one of: symfony/yaml[v2.2.9, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.0, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.1, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.10, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.11, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.12, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.13, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.14, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.15, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.16, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.17, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.18, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.19, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.2, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.20, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.21, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.22, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.23, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.24, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.25, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.26, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.27, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.28, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.29, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.3, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.30, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.31, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.32, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.33, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.34, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.35, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.36, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.37, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.38, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.39, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.4, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.5, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.6, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.7, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.8, v3.0.3].
    - Can only install one of: symfony/yaml[v2.3.9, v3.0.3].
    - Can only install one of: symfony/yaml[v2.4.0, v3.0.3].
    - Can only install one of: symfony/yaml[v2.4.1, v3.0.3].
    - Can only install one of: symfony/yaml[v2.4.10, v3.0.3].
    - Can only install one of: symfony/yaml[v2.4.2, v3.0.3].
    - Can only install one of: symfony/yaml[v2.4.3, v3.0.3].
    - Can only install one of: symfony/yaml[v2.4.4, v3.0.3].
    - Can only install one of: symfony/yaml[v2.4.5, v3.0.3].
    - Can only install one of: symfony/yaml[v2.4.6, v3.0.3].
    - Can only install one of: symfony/yaml[v2.4.7, v3.0.3].
    - Can only install one of: symfony/yaml[v2.4.8, v3.0.3].
    - Can only install one of: symfony/yaml[v2.4.9, v3.0.3].
    - Can only install one of: symfony/yaml[v2.5.0, v3.0.3].
    - Can only install one of: symfony/yaml[v2.5.1, v3.0.3].
    - Can only install one of: symfony/yaml[v2.5.10, v3.0.3].
    - Can only install one of: symfony/yaml[v2.5.11, v3.0.3].
    - Can only install one of: symfony/yaml[v2.5.12, v3.0.3].
    - Can only install one of: symfony/yaml[v2.5.2, v3.0.3].
    - Can only install one of: symfony/yaml[v2.5.3, v3.0.3].
    - Can only install one of: symfony/yaml[v2.5.4, v3.0.3].
    - Can only install one of: symfony/yaml[v2.5.5, v3.0.3].
    - Can only install one of: symfony/yaml[v2.5.6, v3.0.3].
    - Can only install one of: symfony/yaml[v2.5.7, v3.0.3].
    - Can only install one of: symfony/yaml[v2.5.8, v3.0.3].
    - Can only install one of: symfony/yaml[v2.5.9, v3.0.3].
    - Can only install one of: symfony/yaml[v2.6.0, v3.0.3].
    - Can only install one of: symfony/yaml[v2.6.1, v3.0.3].
    - Can only install one of: symfony/yaml[v2.6.10, v3.0.3].
    - Can only install one of: symfony/yaml[v2.6.11, v3.0.3].
    - Can only install one of: symfony/yaml[v2.6.12, v3.0.3].
    - Can only install one of: symfony/yaml[v2.6.13, v3.0.3].
    - Can only install one of: symfony/yaml[v2.6.2, v3.0.3].
    - Can only install one of: symfony/yaml[v2.6.3, v3.0.3].
    - Can only install one of: symfony/yaml[v2.6.4, v3.0.3].
    - Can only install one of: symfony/yaml[v2.6.5, v3.0.3].
    - Can only install one of: symfony/yaml[v2.6.6, v3.0.3].
    - Can only install one of: symfony/yaml[v2.6.7, v3.0.3].
    - Can only install one of: symfony/yaml[v2.6.8, v3.0.3].
    - Can only install one of: symfony/yaml[v2.6.9, v3.0.3].
    - Can only install one of: symfony/yaml[v2.7.0, v3.0.3].
    - Can only install one of: symfony/yaml[v2.7.1, v3.0.3].
    - Can only install one of: symfony/yaml[v2.7.10, v3.0.3].
    - Can only install one of: symfony/yaml[v2.7.2, v3.0.3].
    - Can only install one of: symfony/yaml[v2.7.3, v3.0.3].
    - Can only install one of: symfony/yaml[v2.7.4, v3.0.3].
    - Can only install one of: symfony/yaml[v2.7.5, v3.0.3].
    - Can only install one of: symfony/yaml[v2.7.6, v3.0.3].
    - Can only install one of: symfony/yaml[v2.7.7, v3.0.3].
    - Can only install one of: symfony/yaml[v2.7.8, v3.0.3].
    - Can only install one of: symfony/yaml[v2.7.9, v3.0.3].
    - Can only install one of: symfony/yaml[v2.8.0, v3.0.3].
    - Can only install one of: symfony/yaml[v2.8.1, v3.0.3].
    - Can only install one of: symfony/yaml[v2.8.2, v3.0.3].
    - Can only install one of: symfony/yaml[v2.8.3, v3.0.3].
    - Installation request for symfony/yaml == 3.0.3.0 -> satisfiable by symfony/yaml[v3.0.3].


Installation failed, reverting ./composer.json to its original content.

PHP syntax error on centos 7 with php 7 running cachetool

I've got a problem running cachetool using php7:

PHP 7.0.14 (cli) (built: Dec 22 2016 14:17:52) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies

OS is centos 7.

I am downloading the cachetool-binary from github like mentioned in the docs.

[root@server]# /usr/local/bin/cachetool opcache:reset
PHP Parse error:  syntax error, unexpected '{' in phar:///usr/local/bin/cachetool/vendor/symfony/dependency-injection/Container.php on line 280

Migrated from #41

The helper "table" is not defined

With a recent version of cachetool (2.0.1) I get this error:

$  /home/andrewmcnaughton/bin/cachetool.phar opcache:status


  [Symfony\Component\Console\Exception\InvalidArgumentException]  
  The helper "table" is not defined.                              


opcache:status

I've got an old 1.10.0 version of cachetool which runs fine on the same system without showing the error.

http://symfony.com/doc/current/components/console/helpers/tablehelper.html says that "The Table Helper was deprecated in Symfony 2.5 and removed in Symfony 3.0. You should now use the Table class instead which is more powerful."

Self update error

After installing v4.0.0 I see an error on self-update:

PHP Fatal error:  Uncaught Error: Class 'Herrera\Phar\Update\Manifest' not found in phar:///home/longman/projects/web/domains/myproject/bin/cachetool.phar/src/CacheTool/Command/SelfUpdateCommand.php:43
Stack trace:
#0 phar:///home/longman/projects/web/domains/myproject/bin/cachetool.phar/vendor/symfony/console/Command/Command.php(251): CacheTool\Command\SelfUpdateCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#1 phar:///home/longman/projects/web/domains/myproject/bin/cachetool.phar/vendor/symfony/console/Application.php(865): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#2 phar:///home/longman/projects/web/domains/myproject/bin/cachetool.phar/src/CacheTool/Console/Application.php(149): Symfony\Component\Console\Application->doRunCommand(Object(CacheTool\Command\SelfUpdateCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Co in phar:///home/longman/projects/web/domains/myproject/bin/cachetool.phar/src/CacheTool/Command/SelfUpdateCommand.php on line 43

Cache info compatibility with APCu

From what I read in the code, this tool is not compatible with APCu.

Env

  • PHP Version 7.0.7
  • APC Compatibility 1.0.3
  • APCu Version 5.1.4
  • cachetool 2.0.6 (because I use Symfony 2) but master have the same issue

The issue

The apc:cache:info command fails:

$ ./bin/cachetool apc:cache:info --fcgi=/var/run/php-fpm.sock

Fatal error: Uncaught TypeError: Argument 1 passed to CacheTool\Command\ApcCacheInfoCommand::normalize() must be of the type array, null given, called in vendor/gordalina/cachetool/src/CacheTool/Command/ApcCacheInfoCommand.php on line 60 and defined in vendor/gordalina/cachetool/src/CacheTool/Command/ApcCacheInfoCommand.php:101

This is because this statement return null:

$this->getCacheTool()->apc_cache_info('system');

I'm not sure why exactly but the fact is that signatures for this method are different between APC and APCu, but the CacheTool always tries to call the old signature.

        $code->addStatement(sprintf(
            'return apc_cache_info(%s, %s);',
            var_export($cache_type, true),
            var_export($limited, true)
        ));

As the command expect both a "user" and a "system" cache infos from APC, maybe it should be fixed with a new command apcu:cache:info, because APCu only expose user cache. WDYT?

APCu

http://php.net/manual/fr/function.apcu-cache-info.php

array apcu_cache_info ([ bool $limited = false ] )

APC

http://php.net/manual/en/function.apc-cache-info.php

array apc_cache_info ([ string $cache_type = "" [, bool $limited = false ]] )

opcache:status:scripts

hello,

we've got servers with a lots of scripts, and opcache:status:scripts can return enormous amount of data, and some of the time, the fastcgi call returns this error :

  [RuntimeException]
  Could not unserialize data from adapter.

with verbose options, we can see the serialized data seems to be truncated à 300k data. We've tried to replace all serialize / unserialize by gzcompress(serialize / unserialize(gzuncompress without success.

Any idea of what could cause this pb ?

multiple php-fpm pools

Hi, I'm wondering. I thought it was possible to clear the opcache for the whole php-fpm master processes, but it seems with cachetool it's need to precise which .sock to clear? Any way to force the clearance of all the pools? Or is there something I'm missing/misunderstanding? Thanks.

Support for FCGIWrapper?

Is it possible to also support setups which use FCGIWrapper to invoke PHP? There is obviously no process like FPM running here which could receive Opcache reset requests.

Wrong version in the latest phar

I've tried to download cachetool.phar and cachetool-4.0.0.phar and they both give me the same output.

$ php cachetool.phar -V
CacheTool 3.2.1-2-ga819a69

$ php cachetool-4.0.0.phar -V 
CacheTool 3.2.1-2-ga819a69

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.