amnuts / opcache-gui Goto Github PK
View Code? Open in Web Editor NEWA clean, effective and responsive interface for Zend OPcache
A clean, effective and responsive interface for Zend OPcache
+-----------------------------------------------------------------------------+ 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 +-----------------------------------------------------------------------------+
Very minor, but be nice to correct so people aren't confused about the version they're running.
Thanks for this gui, it's very lovely.
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!
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
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:
The same happens when I take over manual command over the testing browser and open the OPCache GUI file directly without the Moodle wrapper:
Clicking on the error message in the web inspector console, I get this line:
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:
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
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
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
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) {
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?
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.
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
Hi @amnuts ,
I saw on https://github.com/amnuts/opcache-gui/blob/master/index.php#L393-L394 that you are using the development libraries of React even in your built release.
Is there any reason for this or would you want to change that to the minified production versions?
Cheers,
Alex
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
I know is a minor thing but if possible please provide an update for missing variables such as "opcache.file_update_protection" thanks.
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.
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?
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?
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;
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).
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:
Apart from that, everything seems to be OK ๐
I set allow_invalidate to false in the options, and indeed I no longer can invalidate specific files.
However, when I enter some filter in the search, I get the "Invalidate all matching files" link.
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.
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.
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!
I think these suggestions would also easie calculating the bitmask to make changes to the opcache configuration.
Thanks.
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:
Let me know if you have any questions or want me to review an updated version.
Best regards,
Michael Milette
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 ) )
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
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 ? :)
How would I securely deploy this to a production server running on nginx?
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
If you run this code through PHPDocumentor, it generates 29 errors (which is a tiny number.)
I'd be happy to "fix them" by adding comments to the code...
... but I only want to spend time on this if it's actually of interest and something you'd be happy to merge if I did...
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/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
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!
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!
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 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
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.
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?
Due to JIT opcache options available in PHP 7.4, adding JIT stats such as opcache_get_status()['jit'] would be very nice.
There are a few macros for opcache.git:
Would be nice if opcache-gui could expand any of these values showing also is description. For instance tracing will be:
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
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.
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
Please, can you add chart of keys usage?
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.