Git Product home page Git Product logo

phpcacheadmin's People

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

phpcacheadmin's Issues

Docker release tags

Thanks for building this! I have created a plugin implementing it for the Lando development environment and am pinning to the latest tag in Docker currently. Do you plan to add version tags to Docker eventually? I'm hoping to be able to pin the Lando plugin to specific release tags instead of latest.

Memcached keys (in list) not shown

What version of phpCacheAdmin are you using?

v1.5.1

Cache system and version

Memcached 1.6.20

Extension or client and version

PHP Memcached extension v3.2.0

PHP Version

7.4.33

Operating System

Linux a5873251612e 5.15.0-70-generic #77-Ubuntu (via Docker)

Describe the issue

In the Memcached view the list with keys is empty. At first I thought, it might be a similar to #15, but in opposite to this bug report, in my case the stats are showing correctly. (Key count is correct, but only the list stays empty. See screenshot.)

image

Additional info:

  • The memcached server runs as Docker container
  • The memcached server runs with -o lru_crawler flag
  • I have a second webserver container (running with PHP 8.2.5 and PHPMem v1.1.0 instead of the Memcached extension). This server points to the same Memcached instance and shows the key list correctly. Thus I assume, that the problem is not related to the Memcached server, but has to do something with either the PHP version (7.4.33) or the PHP Memcached extension.

Question:
How to debug the problem? (In the webbrowser's console nor in my webserver's logs I don't see any errors.)

Display the current server resource usage

Proposal

Can the server items in the sidebar increase the display of hardware resources, such as CPU and memory, similar to probes

Motivation and context

Convenient to view the current server's resource usage

Document connecting to Redis via TLS

Proposal

Add an example of connection to Redis via TLS

Motivation and context

I needed to connect to a DigitalOcean managed Redis, they use TLS. Viewing the config.php I saw that you could give the tls value to the SCHEME field.

PCA_REDIS_0_SCHEME: tls

This is not clear in the current README

Fatal error: RedisDashboard::getType(): Return value must be of type string, null returned

App is started via Docker:

  phpcacheadmin:
    image: robinn/phpcacheadmin:1.1.0
    ports:
      - "8083:80"
    environment:
      - PCA_REDIS_0_HOST=redis
      - PCA_REDIS_0_PORT=6379
    links:
      - redis

Open http://localhost:8083/?type=redis

Expected: Redis UI
Actual:

Warning: Undefined array key 6 in /var/www/html/src/Dashboards/Redis/TypesTrait.php on line 38

Fatal error: Uncaught TypeError: RobiNN\Pca\Dashboards\Redis\RedisDashboard::getType(): Return value must be of type string, null returned in /var/www/html/src/Dashboards/Redis/TypesTrait.php:38
Stack trace:
#0 /var/www/html/src/Dashboards/Redis/RedisTrait.php(225): RobiNN\Pca\Dashboards\Redis\RedisDashboard->getType(6)
#1 /var/www/html/src/Dashboards/Redis/RedisTrait.php(247): RobiNN\Pca\Dashboards\Redis\RedisDashboard->getAllKeys(Object(Redis))
#2 /var/www/html/src/Dashboards/Redis/RedisDashboard.php(199): RobiNN\Pca\Dashboards\Redis\RedisDashboard->mainDashboard(Object(Redis))
#3 /var/www/html/index.php(71): RobiNN\Pca\Dashboards\Redis\RedisDashboard->dashboard()
#4 {main} thrown in /var/www/html/src/Dashboards/Redis/TypesTrait.php on line 38

Sidebar optimization

The version number of the sidebar and the link to the project can be placed at the bottom, which should make the overall visual effect much better。

Suggest pagination load for memcache dashboard

Proposal

Hi,

First, I would like to say thank you for your tool, it's really awesome and helpful for us.

However, we're having a case when memcached server in production which have a lot of key (12295 key) and Memory Usage is 88,40MB. It takes 23-25 seconds to load the dashboard and about same time to perform every action in that dashboard.

When troubleshooting, I see dashboard seems to load all key by every action that leads to this issue. And opcache or apcu not helpful for this case.

Therefore, I think if we have a feature like pagination load + "scan more" or "load more" button for listing and searching, it would be great.

I'm not an expert for PHP so pls correct me if I'm wrong :). If you have better idea for configuration to speedup the loading time, I'm looking forward to hearing about that.

About our version:

  • PHP version: 8.2.9
  • PHP-Memcache version: 8.2 (have a problem with php-memcached to connect gcp memcache, so we had to switch to php-memcache)
  • PHP OPCache extension v8.2.9
  • PHP APCu extension v5.1.22

Motivation and context

If this change can be implemented, It would be helpful to manage large memcache server.

Redis: gz decode key/item

Hello,
We faced an issue viewing the key where the info is gunzipped/encoded. Would be very nice if you support some decompress/decode methods by default. I see some desktop software support that.
Uploading an example. If you like I can also upload the redis key.
Just for your information, that's a stored key from Magento 2.4 redis backend cache.
image

Redis: Return back to the searched string with Back button

Hey,
Would be nice to have that.
When I go Redis and search something in the search filed, for example GENERAL -> I click on some of the results.
The 'Back' button returned me only to the selected DB. 's=GENERAL' is missing.

The same when you're editing an item using "Edit" and then click "Back". You were returned to selected DB, not the selected key.
Thanks for the great and fast support :)

Memcached keys not showing

phpCacheAdmin Version: v1.1.0
PHP Version: PHP 7.4.30 (cli)

Memcached keys & count key value is not showing like this img
https://imgur.com/0NZrCJO

But changing the code, count all key value is showing
https://imgur.com/lHmkAWE

    private function serverInfo(array $servers): array {
        try {
            $memcached = $this->connect($servers[Http::get('panel', 'int')]);
            $server_info = $memcached->getServerStats();

            return [
                'Version'          => $server_info['version'],
                'Open connections' => $server_info['curr_connections'],
                'Uptime'           => Format::seconds((int) $server_info['uptime']),
                'Cache limit'      => Format::bytes((int) $server_info['limit_maxbytes']),
                'Used'             => Format::bytes((int) $server_info['bytes']),
                //'Keys'             => Format::number(count($memcached->getKeys())),
                'Keys'             => Format::number(count($memcached->getallKeys())),
            ];
        } catch (DashboardException $e) {
            return [
                'error' => $e->getMessage(),
            ];
        }
    }

how to solve this problem..? I want to manage my Memcached key list by this dashboard. :'(

Redis server cannot be connected

phpCacheAdmin Version:
v1.5.1
Cache:

PHP Version:
php 8.0.28
Operating System:
Rocky Linux release 8.7 (Green Obsidian)
Describe the issue

Redis 5.0.3-5

Blank page after i clicked on Redis. Memcached and OPCache are ok

My config file

'redis'         => [
    [
        'name' => 'localhost', // The server name (optional).
        'host' => '127.0.0.1', // Optional when a path is specified.
        'port' => 6379, // Optional when the default port is used.
        //'database'  => 0, // Default database (optional).
        //'username'  => '', // ACL - requires Redis >= 6.0 (optional).
        //'password'  => '', // Optional.
        //'authfile'  => '/run/secrets/file_name', // File with a password, e.g. Docker secrets (optional).
        //'path'      => '/var/run/redis/redis-server.sock', // Unix domain socket (optional).
        //'databases' => 16, // Number of databases, use this if the CONFIG command is disabled (optional).
        //'scansize'  => 1000, // Number of keys, the server will use the SCAN command instead of KEYS (optional).
    ],
],

I only changed Localhost to localhost

phpCacheAdmin not compatible with PHP 7.4 (str_starts_with();)

Hello,
README says that phpCacheAdmin is compatible with PHP >= 7.4, but it uses str_starts_with() function which is available only on PHP >= 8.0 (https://www.php.net/manual/en/function.str-starts-with.php).

That causes error 500 on Redis page:

Screenshot 2022-06-30 at 13-43-15 Redis - phpCacheAdmin

Log from the event:

2022/06/30 12:35:56 [error] 1927039#1927039: *33150 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function RobiNN\Pca\Dashboards\Redis\str_starts_with() in /usr/local/share/phpcacheadmin/src/Dashboards/Redis/RedisTrait.php:55
Stack trace:
#0 /usr/local/share/phpcacheadmin/src/Dashboards/Redis/RedisDashboard.php(121): RobiNN\Pca\Dashboards\Redis\RedisDashboard->serverInfo()
#1 /usr/local/share/phpcacheadmin/index.php(36): RobiNN\Pca\Dashboards\Redis\RedisDashboard->ajax()
#2 {main}
  thrown in /usr/local/share/phpcacheadmin/src/Dashboards/Redis/RedisTrait.php on line 55" while reading response header from upstream, client: XX.XX.XX.XX, server: XXX, request: "GET /phpcacheadmin/?type=redis&db=1&ajax&panel=0 HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.4-fpm-pma.sock:", host: "XXX", referrer: "https://XXX/phpcacheadmin/?type=redis&db=1"

Undefined Array Key in /src/Dashboards/OPCache/OPCacheTrait.php:108

What version of phpCacheAdmin are you using?

v1.6.2

Cache system and version

No response

Extension or client and version

PHP OPCache extension v8.1.2-1ubuntu2.14

PHP Version

8.1.2-1ubuntu2.14

Operating System

Ubuntu 22.04.3 LTS

Describe the issue

I got lots of warnings:

E_WARNING: Undefined array key "timestamp" in /var/www/cacheadm.dietz.digital/src/Dashboards/OPCache/OPCacheTrait.php on line 108

I ultimatively run into a fatal error - see below.

My workaround looks like this, it seems that the timestamp was renamed:

                    $cached_scripts[] = [
                        'key'   => $script['full_path'],
                        'items' => [
                            'title'          => $full_path,
                            'number_hits'    => $script['hits'],
                            'bytes_memory'   => $script['memory_consumption'],
                            'time_last_used' => $script['last_used_timestamp'],
                            'time_created'   => (empty ($script['timestamp']) ) ? $script['last_used_timestamp'] : $script['timestamp'],
                        ],
                    ];
Fatal error: Uncaught TypeError: RobiNN\Pca\Format::time(): Argument #1 ($time) must be of type int, null given, called in /var/www/cacheadm.dietz.digital/tmp/1b/1b6e8da384b3268893718f80cd4f05a0.php on line 165 and defined in /var/www/cacheadm.dietz.digital/src/Format.php:88 Stack trace: #0 /var/www/cacheadm.dietz.digital/tmp/1b/1b6e8da384b3268893718f80cd4f05a0.php(165): RobiNN\Pca\Format::time() #1 /var/www/cacheadm.dietz.digital/vendor/twig/twig/src/Template.php(394): __TwigTemplate_10079ab895f75fff0c7781e3d6ac5515->doDisplay() #2 /var/www/cacheadm.dietz.digital/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling() #3 /var/www/cacheadm.dietz.digital/vendor/twig/twig/src/Template.php(379): Twig\Template->display() #4 /var/www/cacheadm.dietz.digital/vendor/twig/twig/src/TemplateWrapper.php(40): Twig\Template->render() #5 /var/www/cacheadm.dietz.digital/vendor/twig/twig/src/Extension/CoreExtension.php(1349): Twig\TemplateWrapper->render() #6 /var/www/cacheadm.dietz.digital/tmp/85/85f8b59c510ffbd1eb22dd8839b71cd0.php(72): twig_include() #7 /var/www/cacheadm.dietz.digital/vendor/twig/twig/src/Template.php(394): __TwigTemplate_e42da5762703c4eb803012a289d27196->doDisplay() #8 /var/www/cacheadm.dietz.digital/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling() #9 /var/www/cacheadm.dietz.digital/vendor/twig/twig/src/Template.php(379): Twig\Template->display() #10 /var/www/cacheadm.dietz.digital/vendor/twig/twig/src/TemplateWrapper.php(40): Twig\Template->render() #11 /var/www/cacheadm.dietz.digital/vendor/twig/twig/src/Environment.php(280): Twig\TemplateWrapper->render() #12 /var/www/cacheadm.dietz.digital/src/Template.php(100): Twig\Environment->render() #13 /var/www/cacheadm.dietz.digital/src/Dashboards/OPCache/OPCacheTrait.php(131): RobiNN\Pca\Template->render() #14 /var/www/cacheadm.dietz.digital/src/Dashboards/OPCache/OPCacheDashboard.php(68): RobiNN\Pca\Dashboards\OPCache\OPCacheDashboard->mainDashboard() #15 /var/www/cacheadm.dietz.digital/index.php(87): RobiNN\Pca\Dashboards\OPCache\OPCacheDashboard->dashboard() #16 {main} thrown in /var/www/cacheadm.dietz.digital/src/Format.php on line 88

Back button doesn't keep the selected redis DB

Hello,
there's an issue when you select Redis DB (simulate it with DB 1, not 0) and you select to view a key -> Back button goes to index.php?type=redis instead of index.php?type=redis&db=1

Memcached stored as orgin type.

phpCacheAdmin Version: v.1.1.0
Cache: Memcahced 1.6.16

PHP Version: PHP 7.4.30 (cli)

Operating System:
CentOS Linux release 7.9.2009 (Core)

Describe the issue

I found the Remark "In Memcache(d) everything is stored as a string." and fixed as string type in the codes.
but when I try below code in php and try to view the keys' value, its show fatal error.

--test.php --
$mcd = new Memcached;
$mcd->addServer('127.0.0.1',11211);
$checks = array(
     123,
     4542.32,
     'a string',
    true,
     array(123, 'string'),
    (object)array('key1' => 'value1'),
 );
 foreach ($checks as $i => $value) {
     $mcd->set("cachetest$i", $value);
 }

I changed some of the code to make sure it was really stored as a string.

    private function getAllKeys($memcached): array {
        static $keys = [];

        foreach ($memcached->getKeys() as $key_data) {
            $keys[] = [
                'key'  => $key_data['key'],
                'ttl'  => $key_data['exp'],
                //'type' => 'string', // In Memcache(d) everything is stored as a string.
                'type' => gettype($memcached->get($key_data['key'])),
            ];
        }

        return $keys;
    }

it appears that it saves the original type.
the result img is https://i.imgur.com/vYFDDi3.png

so when I try to view the value of the "string" types key in the result image, show below error.

/phpCacheAdmin/config.dist.php (Line: 69)
gzuncompress(): data error

and try to view not "string" types key, show below errors

PHP message: PHP Fatal error:  
Uncaught TypeError: Argument 1 passed to RobiNN\Pca\Value::format() must be of the type string, int given, 
called in /phpCacheAdmin/src/Dashboards/Memcached/MemcachedTrait.php on line 197
and defined in /phpCacheAdmin/src/Value.php:25

...
Uncaught TypeError: Argument 1 passed to RobiNN\Pca\Value::format() must be of the type string, object given
...

Did I use memcached to store data(in test.php) in the wrong way?

Error on Ubuntu 20.04

Discussed in #6

Originally posted by sethadam1 July 5, 2022
phpCacheAdmin threw an error on my server (Ubuntu 20.04 focal / Linux 5.4.0-110-generic x86_64)

PHP Fatal error: require_once(): Failed opening required '/var/www/path/to/phpcacheadmin/src/Dashboards\\Server\\ServerDashboard.php' (include_path='.:/usr/share/php') in /var/www/path/to/phpcacheadmin/index.php on line 23

I was able to fix it with this modification to index.php line 23:

require_once __DIR__.'/src/'.str_replace("\\","/",str_replace('RobiNN\\Pca\\', '', $class)).'.php';

Not sure if this is something you'd want to add, but if you make this change, add a cache directory and chmod it to 777 (if you run as www-data and the webfoot is not writable, you need to setup the cache directory), it works as a drop-in with no additional configuration.

// Report issues in the Issues section, not in Discussion.

Could not initialize random number generator (OS doesn't support the latest Apache)

I have Synology DS1513+ running the latest Docker v.20.10.3 and docker-compose v2.6.1. When I run the container as advised, I get this error for the PCA container:

today at 21:44:38[Mon Jul 18 11:44:38.534724 2022] [:crit] [pid 7] (38)Function not implemented: AH00141: Could not initialize random number generator today at 21:45:12Container stopped

Unable to find template "components/paginate.twig" on update

Hello,
I've pulled latest changes and got error on Redis and Memcache:
"Unable to find template "components/paginate.twig" (looked into: /usr/local/share/phpcacheadmin/src/../templates). in /usr/local/share/phpcacheadmin/templates/partials/keys_table.twig at line: 64 "

Here's the log of pull:
emote: Enumerating objects: 213, done.
remote: Counting objects: 100% (213/213), done.
remote: Compressing objects: 100% (86/86), done.
remote: Total 167 (delta 113), reused 133 (delta 79), pack-reused 0
Receiving objects: 100% (167/167), 148.57 KiB | 4.95 MiB/s, done.
Resolving deltas: 100% (113/113), completed with 35 local objects.
From https://github.com/RobiNN1/phpCacheAdmin
17342b8..38e08d7 master -> origin/master
Updating 17342b8..38e08d7
Fast-forward
.github/workflows/static-analysis.yml | 30 +++++++++++
README.md | 24 +++------
assets/css/src.css | 4 ++
assets/css/styles.css | 8 +--
composer.json | 6 ++-
index.php | 20 ++++++-
phpstan.neon | 2 +-
src/Admin.php | 4 +-
src/Config.php | 2 +-
src/Dashboards/DashboardInterface.php | 4 +-
src/Dashboards/Memcached/MemcacheCompatibility/Memcache.php | 12 +++--
src/Dashboards/Memcached/MemcacheCompatibility/MemcacheInterface.php | 4 +-
src/Dashboards/Memcached/MemcacheCompatibility/Memcached.php | 4 +-
src/Dashboards/Memcached/MemcachedDashboard.php | 20 +++----
src/Dashboards/Memcached/MemcachedTrait.php | 90 +++++++++++++++----------------
src/Dashboards/OPCache/OPCacheDashboard.php | 6 +--
src/Dashboards/OPCache/OPCacheTrait.php | 23 ++++----
src/Dashboards/Redis/GetValueTrait.php | 105 ------------------------------------
src/Dashboards/Redis/RedisDashboard.php | 22 ++++----
src/Dashboards/Redis/RedisFormTrait.php | 123 ------------------------------------------
src/Dashboards/Redis/RedisTrait.php | 208 ++++++++++++++++++++++++++++++----------------------------------------
src/Dashboards/Redis/TypesTrait.php | 240 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/Dashboards/Server/ServerDashboard.php | 4 +-
src/Helpers.php | 20 +++----
src/Http.php | 10 ++--
src/Paginator.php | 154 +++++++++++++++++++++++++++++++++++-----------------
src/Template.php | 6 +--
templates/components/input.twig | 3 +-
templates/components/{paginate.twig => paginator.twig} | 19 +++----
templates/dashboards/memcached/form.twig | 11 ++--
templates/dashboards/opcache.twig | 6 +--
templates/dashboards/redis/form.twig | 4 +-
templates/partials/keys_table.twig | 4 +-
templates/partials/view_key.twig | 28 ++++++----
twig.phar | Bin 0 -> 671823 bytes
35 files changed, 656 insertions(+), 574 deletions(-)
create mode 100644 .github/workflows/static-analysis.yml
delete mode 100644 src/Dashboards/Redis/GetValueTrait.php
delete mode 100644 src/Dashboards/Redis/RedisFormTrait.php
create mode 100644 src/Dashboards/Redis/TypesTrait.php
rename templates/components/{paginate.twig => paginator.twig} (60%)
create mode 100644 twig.phar

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.