Git Product home page Git Product logo

opcache-gui's Introduction

+-----------------------------------------------------------------------------+
     README - README - README - README - README - README - README - README
              Introductory information for the Amnuts talker code
+-----------------------------------------------------------------------------+

Welcome to the Amnuts talker code!  Or, if you have already used Amnuts, then
welcome back - it's good to still have you with us. :-)

It has been 20 years - yup, two whole decades - since this README was last
updated, and, honestly, not much has changed in the world of Amnuts Talkers.
The Golden Age of talkers has long past, though it's still awesome to see some
die-hard fans still out there and keeping talkers alive (Marado's TalkerNode,
for example).

As for Amnuts, as you're undoubtedly aware, it's now available from GitHub.
You can get there from:

    https://amnuts.net/
 or https://github.com/amnuts/Amnuts

You can submit issues and post up on the discussion board there.  Please feel
free to fork and submit pull requests.

To get started with Amnuts you'll need either a linux environment or you can
use docker.  For further details, see the docs/docker and and other related
files in the docs directory.

Lots of the documentation and files here haven't been updated for those same
two decades, but hopefully one day they will be revived and revamped.  Until
then, just head towards the wind and push on as best you can. ;-)

Thanks for using Amnuts, and as you're here you must be interested in talkers,
so thanks also for keeping those alive!  Enjoy!

                                                             Andrew Collington
                                                   The Amnuts Development Team
                                                                February, 2023
+-----------------------------------------------------------------------------+

opcache-gui's People

Contributors

alexandre-abrioux avatar amnuts avatar andypost avatar avindra avatar bbalet avatar c4ne avatar compilenix avatar firassziedan avatar jackwh avatar jkrehm avatar m-falken avatar niklasbr avatar phizev avatar stevemoretz avatar tessus avatar toonspinisaac avatar yourpropertyexpert 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

opcache-gui's Issues

[new PHP user] file location for index.php for OpCache?

Hi -

I'm new to PHP (have mostly used Java previously) and I would like to use opcache-gui to monitor a PrestaShop ecommerce app which I'm running using PHP 5.6.7 with nginx + php-fpm on Debian.

The nginx server is serving the PrestaShop app from the following folder (which already contains its own index.php file):

/var/www/shop1.mysite.com/public_html/prestashop

So my question is: Where should I place the index.php file for opcache-gui?

Should I simply create another nginx server and put the index.php file for opcache-gui in that server's top-level public folder?

If so, will opcache-gui also "see" what's happening on the other server (the main one, serving my PrestaShop app)?

Thanks for any help!

array_merge(): Argument #1 is not an array

Hi.

I currently experience the following error:
Warning: array_merge(): Argument #1 is not an array in /homepages/[....]/opcache.php on line 198

And no data is shown on the dashboard

Any ideas?

Kind regards,
Andreas

OPCache GUI does not load in Moodle's Behat environment

Hi Andrew,

as you know, we have packaged your great OPCache GUI into a Moodle plugin on https://github.com/moodleuulm/moodle-tool_opcache.

Today, I had to see that, while the plugin works perfectly in my browsers, OPCache GUI is not working anymore in Moodle's Behat environment.

When I watch the Behat tests, the step where the test goes to the Moodle OPCache settings page fails as the OPCache GUI does not load there:
grafik

The same happens when I take over manual command over the testing browser and open the OPCache GUI file directly without the Moodle wrapper:
grafik

Clicking on the error message in the web inspector console, I get this line:
grafik

It might be important to say that the testing browser is a really old Firefox 47, but there are reasons for the Moodle developers to use this old browser:
grafik

Do you have any idea what could cause OPCache not to load in this environment, Andrew?

If you need any more details from me, please let me know.

Cheers,
Alex

Excessive load time, file usage tab

Hello,
when cache is empty or you have a few files the script is fast but if you have something like eg.
used memory: 676.69MB
number of cached files: 65,856

it takes too much to load the page, even 2 minutes or more
I didn't take a look at the code but in my opinion the issue is the number of files because you don't paginate and you load all the cached files references at once. File usage tab? So, it's really slow to invalidate a file in this situation. Can you fix it, please?

Thanks

OpCache guy does only show

Using the OpCache gui in Moodle I only can see very limited information/links on the screen instead of the nice information that you present on your site.

Any idea why the details are missing for me?

image

memory_consumption not in MB

Great script!
I would like to suggest one change:
Under the

Directives: memory consumption

This is not reporting in MB as I would expect.
I have 128MB as the value in my php.ini settings and it is reporting 134217728 which is the value in bytes. It would make more sense to have it display in MB since that is how it is entered with opcache.memory_consumption=128

Notice for file_cache_only

Hello, I saw many notices like this in logs:

PHP Notice: Undefined index: opcache.file_cache_only in /var/www/smart/opcache.php on line 187

In my opcache there isn't this option, so I modified line 187, from:

if ($config['directives']['opcache.file_cache_only']) {

to:

if (isset($config['directives']['opcache.file_cache_only']) && $config['directives']['opcache.file_cache_only'] == 1) {

2.0.1 release

Would you consider doing a 2.0.1 release (git tag) so the most recent changes will be available via Composer without having to use "dev-master" as the dependency?

GUI misrepresents zero as "no value"

Certain OPcache settings, such as opcache.revalidate_freq, are integers for which can make sense if they equal zero. However, the OPcache GUI currently shows "no value" instead of "0" if the integer value is zero. This has caused us quite a bit of worry, thinking PHP ini settings weren't getting picked up, before we realized that the problem is in this application.

The problem is a JavaScript comparison that uses == instead of ===. I am making a pull request that fixes this issue.

offline installation not possible

Hi,
before anything else, thanks for the great tool! it has helped me a lot already.
the problem is, I have to use this tool on a machine which has no internet access, most of the features seem to fail as they are dependent on JS code loaded from //cdn.jsdelivr.net/; which of course, is not available. I intend to resolve the issue by downloading the resources and rewriting this part of the code, but it would be great if this problem would be resolved in the main repository too. but maybe you don't see it that way, which would also be fine! :)

Thanks again

Best Wishes

memory negative

Hi,

on the latest version we get an negative memory usage:

memory usage
total memory: 64.00MB
used memory: -4263336.00b
free memory: 68.07MB
wasted memory: 0.00b (0%)

B

updates for new variables

I know is a minor thing but if possible please provide an update for missing variables such as "opcache.file_update_protection" thanks.

invalidate by path

Hi,

thanks a lot for this amazing tool, which I'm using on 2 servers.

I don't see how I could invalidate files by path rather than individually, E.G. invalidating all files below /var/www/foo/bar/

For instance when I commit some files, or worse a Drupal security update with a bunch of files, on various sites, it's a pain to invalidate each file separately ...

Thank you.

PS : Resetting whole cache is a huge performance hit, so I'd prefer to use a more progressive solution.

multi-server support

I'm running several php-fpm servers for balancing purposes.
could you suggest how to setup the GUI as a separate service and then check each server separately, or have a quick overview for all at once?

./opcache-gui-3.3.0/index.php only shows itself as being cached, but no other files

I downloaded version 3.3.0, copied all the files into a ./opcache-gui-3.3.0 subdirectory of my web application and then created a link to the ./opcache-gui-3.3.0/index.php file in the top folder of my web application.

When pointing my browser to the ./opcache-gui-3.3.0/index.php file via that link everything seemed to work as expected, but then I noticed that it only shows a single file as being cached which is the ./opcache-gui-3.3.0/index.php file itself. None of the other application files are shown as being cached although I can see all the xyz.php.bin files in the opcache folder together with ./opcache-gui-3.3.0/index.php.bin.

What am I missing here?

Undefined index: memory_usage on line 191

The following line only catches the scenario, if the memory cache was disabled explicitly via settings:

        if ($config['directives']['opcache.file_cache_only']) {
            $overview = false;

However, it fails to catch the scenario where the memory cache is dynamically disabled due to file cache fall-back. These settings were active:

opcache.file_cache_fallback = 1
opcache.file_cache_only = 0

and during startup, OpCache triggered the fallback with the message:
"Warning Opcode handlers are unusable due to ASLR (fall-back to file cache)"

In that case, the $status only contains:

array (size=3)
  'opcache_enabled' => boolean false
  'file_cache' => string 'C:\Windows\Temp\PHP\OpCache' (length=27)
  'file_cache_only' => boolean true

FIX
By also checking the $status['file_cache_only'], the GUI will proceed correctly:

        if ($config['directives']['opcache.file_cache_only'] or !empty( $status['file_cache_only'] ) ) {
            $overview = false;

Add a Test if opcache extension is working

Hi,

You test if the extension is loaded, but you don't test if it is working or not. If the extension is not working, the functions opcache_get_status() and opcache_get_configuration() would return FALSE. This causes an error in compileState function when you try to merge the various status arrays (they would be boolean values instead of arrays).

Gauge charts not updated by real-time update

Hi,
Nice little code you have there. Thanks for sharing.

The gauge charts do not seem to be updated by the real-time update. From what I can see, the real-time update really gets a detailed array, but it seems like only the following variables are updated when the AJAX call returns:

  • number of cached files
  • number of hits
  • number of misses
  • number of cached keys
  • max cached keys
    The gauges, the percentage in the middle, the used memory and the free memory do not seem to be updated.
    Also, I find it weird that the used memory and free memory are rounded at the nearest MB, when it clearly shows "33.00MB", which suggests the precision is at the percent of MB (i.e. 10KB).

Apart from that, everything seems to be OK ๐Ÿ‘

More of a question then an issue

Hi, thanks for your tool!

Not sure if this is the correct place to ask but I can't find a comments section.

The start time you have listed there, what does this actually mean?
Every page refresh I do, the start time changes, shouldn't this stay the same?

Sorry if it sounds a noobish question but Google doesn't really have the answer and its not only your tool that does this.

Thanks again.

file_cache_only=1 improvements

I am forced to use file_cache_only=1 due to PHP being run as FastCGI without any multi-process management such as (PHP-FPM). In other words no shared memory cache for me. It would be great if in this case your tool could show the files that have been cached on disk, how many these are, and allow invalidation/removal of individual files. I don't think there is a possibility to glean some cache stats like hits, etc., as is the case for the shared memory situation, but if there is those would be great.

If anybody has an idea how to evaluate how well a file only opcache is working, I would love to hear ideas. All I can do right now is to check if opcode files are being written to disk. There is no information if they are actually being used or how often they have been used, etc.

Slow filter refresh

Hello Amnuts and thank you for this nice contribution!

I was wondering if there is any good alternative to keyup() in this case.

        $('#frmFilter').bind('keyup', function(event){
            $('span.pathname').each(function(index){
                if ($(this).text().toLowerCase().indexOf($('#frmFilter').val().toLowerCase()) == -1) {
                    $(this).closest('tr').addClass('hide');
                } else {
                    $(this).closest('tr').removeClass('hide');
                }
            });
            $('#filelist table tbody').trigger('paint');
        });

Indeed, while dealing with large amounts of paths, I'd rather it refresh the filtered entries only if both the filter field has changed and there has not been a keyup event for the last second or so.
The letter-by-letter refresh is taking a long time (since it freezes the input field) for only about 5k paths on a quite powerful laptop with Chrome.

Best regards!

A couple suggestions for the optimization level

  1. Optimizations should be shown with a bulleted list (or putting them inside a table), so it should be easier to read them (especially on smaller resolution screen, when the lines may break).
  2. To have a better understanding of the optimizations, it would be nice to also show the disabled ones (eventually with different colors), in the order of the bitmask for configuring them.

I think these suggestions would also easie calculating the bitmask to make changes to the opcache configuration.

Thanks.

CSS conflicting with Moodle themes

Hi @amnuts ,

Thank you for sharing this really useful tool with the global Moodle community.

In case you were not aware, I would like to bring to your attention that when viewing Opcache management pages, some of its CSS appears to be affecting the theme. Some 3rd party themes are more affected than others.
Here is an example where it is affecting the display of the Navigation Drawer. Here is a screenshot of how it is affecting the Navigation Drawer in Moodle 3.8.2 using the Boost theme:

image

Let me know if you have any questions or want me to review an updated version.

Best regards,

Michael Milette

One line prevents this working on php 5.4

Only one line prevents this could work on php < 5.5 versions:

if( empty( ini_get('opcache.enable') )

that can be changed by something like this and the code will work again:

$myvar = ini_get('opcache.enable');
if( empty ( $myvar ) )

Information when a file has been cached or modified in the cache

Hello,

first of all thank you very much for your tool. This is really useful!

I'd like to ask if it would be possible to add a timestamp to every file in the cached file list with the information when the file has been cached or modified in the cache (because the file on disk changed). As far as I know, currently only the last use time is displayed in the GUI file list.

If I remember right, the time of adding the file to the cache should be available via opcache_get_status(). The returned file list should include a key "timestamp" which contains the UNIX timestamp when that file was added to the cache.

Could this information be added to opcache-gui?

Thank you very much!

Best regards,
je-mos

How to access (under which URL) ?

Hi there,

thanks for putting work into this project, I highly adore this.
However, I could not find any information in the README that shows how to access the GUI when installing via Composer, even when working through the docs multiple times and even reading most of the code.

Can you please add this extremely essential info ? :)

Fatal error: Namespace declaration

Fatal error: Namespace declaration statement has to be the very first statement or after any declare call in the script in /public_html/op.php on line 3

APCU

Just found this and I really like it!

Any thoughts on adding APCU functionality? I'm currently using the gui script provided by https://github.com/krakjoe/apcu but it is pretty ugly...

Enable Realtime Update: Enhancement

Enable/Disable realtime update based on cookies,
Set a client side cookie if Enable/Disable button clicked
Then when next time opcache page is loaded auto Enable realtime update or Disable it with saved cookie
This is a simple javascript implement if i am not wrong Thanks

what is the essence?

Hi!

Thank you very much for tool, which is real convenient in use.
(sorry for my English...)

For my website I have noticed very useful moment that if in the browser I switch on real-time update then files in a cache are saved long time and if no visitors some time a cache isn't nullified and php the code is always compiled.

I have thought to make same effect through cron, however, as I can see, your script contains javascript that makes run on cron impossible...

What is the essence of your script which can be started from php? (I watched your code and I did attempts to realize it, but I am not the real programmer)

PS may be it will be interesting to expand possibilities of the script, having complemented it with the file which users can start on cron.

Thanks in advance! Creative achievements!

Gui shows only info of domain where it is installed

Greetings!

On one server (Centos 8 php-fpm 7.4 apache) all is okay. I installed the GUI on one domain and it shows the full info of cached files on all domains on the server.

But on another server (Centos 7 php-FCGId 7.4 apache), the GUI shows only the opcache info for the domain where it is uploaded! Global info (memory, keys etc) and cached files are only those of the domain.
If I upload the GUI on another domain, it also shows the data of the considered domain, though the "global options" that are entered in the 10-opcache.ini are correct.

Though it doesn't hurt for good working, it is a problem when we need to check the values. Any suggestion to solve this?

Thank you and warm wishes for the new year!

Undefined index: interned_strings_usage

I just downloaded version 2.3.0 and when I access it, I get this error:

Notice: Undefined index: interned_strings_usage in /home/xxxx/public_html/opcache-gui-2.3.0/index.php on line 190

I have display_errors set to on and error_reporting is set to E_ALL in php. It seems that a check must first be done before accessing this attribute.

When chart is false there are no big numbers

When charts = false, big numbers are not displayed.
Seems like last commit changed the expected behaviour.

Test by changing config from true to false:
'charts' => false, // show gauge chart or just big numbers

Feature request: boolean to hide files

I'm making my cache statics for APCu and OPcache public; the Files tab is an information leak of parts of your server you don't want showing up (paths to files restricted and/or hidden from users, private applications, etc.). There isn't a good, clean way to stop this...

The easiest hack I did was to the compileState() function and re-used the allow_invalidate option like so:

        $files = [];
        if ($this->getOption('allow_invalidate') && !empty($status['scripts'])) {

The use of the Files tab is so embedded in the code there isn't really a nice way without a ton of refactoring to make it disappear. My hack works though, maybe in spirit it's good enough (i.e. add a new option 'allow_files' and use it discreetly) without a ton of code change.

Server Software: Wrong value when using PHP-FPM

I am using Apache (with local PHP installed (PHP 5.4) so that I can use php_admin_value inside Apache.

I am also using a remote PHP-FPM server which actually servers the files (PHP 5.6).

On the index page it shows:

General info
Zend OPcache 7.0.6-dev
PHP 5.6.27
Host 7d14eb61f4fe
Server Software Apache/2.4.6 (CentOS) PHP/5.4.16
Start time 2016-10-16 03:55:05
Last reset never

Is this intended?

JIT stats

Due to JIT opcache options available in PHP 7.4, adding JIT stats such as opcache_get_status()['jit'] would be very nice.

jit expansion

There are a few macros for opcache.git:

  • disable: Completely disabled, cannot be enabled at runtime. Equals to 0.
  • off: Disabled, but can be enabled at runtime. Equals to 0
  • tracing/on: Use tracing JIT. Enabled by default and recommended for most users: Equals to 1254
  • function: Use function JIT. Equals to 1205

Would be nice if opcache-gui could expand any of these values showing also is description. For instance tracing will be:

  • 1: Enable use of AVX, if the CPU supports it (CPU-specific optimization)
  • 2: Perform global register allocation (Register allocation)
  • 5: Use tracing JIT. Profile on the fly and compile traces for hot code segments (Trigger)
  • 4: Use call graph

Not comply with psr-4 autoloading standard

After updating to composer version ^1.10.1 I get the following error message and autoloading isn't working anymore. Could you please have a look.

Deprecation Notice: Class OpcacheGui\OpCacheService located in ./vendor/amnuts/opcache-gui/index.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:201

Feature: Sorting scripts

I really love the OpCache GUI since it came out. It has helped me a lot searching and cleaning out only changed files. So thank you for that!!!

I was wondering, is it possible to add sorting to the scripts? I would really like to see which scripts are largest in cache. It may help me find "infected" files and huge files that could potentially be removed from caching system.

split class and html render

Hello,

I'd like that the OpcacheGui\OpcacheService class and html render are split in two different files.
That will allow to re-used the class with another renderer than the default provided, and include it in our custom design.

Currently i must to the trick as follow :

ob_start();
require_once 'vendor/amnuts/opcache-gui/index.php';
$html = ob_get_clean();

// specify your options (see next section)
$options = [/* ... */];

// setup the class
$opcache = \OpcacheGui\OpCacheService::init($options);

$version = $opcache->getData()['version'];
$overview = $opcache->getData()['overview'];
$files = $opcache->getData()['files'];

Thanks
Laurent

keys chart

Please, can you add chart of keys usage?

The script not show any data

The script does not show any data.
If it detects Opcache because if I reset it the counter is set to 0
but the web doesn't show anything.

Plesk Onyx + Ubuntu 18 + Apache + FPM + Opcache
opcache
opcache running

PHP 8.0 compatibility issues

With PHP 8.0 the "Overview" tab throws this date() function related warning:

Strict Standards: date(): We selected 'Europe/Berlin' for 'CET/1.0/no DST' instead in /REDACTED/index.php on line 343

A "Reset cache" throws:

Strict Standards: date(): We selected 'Europe/Berlin' for 'CET/1.0/no DST' instead in /REDACTED/index.php on line 343
Strict Standards: date(): We selected 'Europe/Berlin' for 'CET/1.0/no DST' instead in /REDACTED/index.php on line 343
Warning: Cannot modify header information - headers already sent by (output started at /REDACTED/index.php:343) in /REDACTED/index.php on line 163

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.