Coder Social home page Coder Social logo

opcache-status's Introduction

OPcache Status Packagist

A one-page opcache status page for the PHP 5.5 opcode cache.

You don't need the opcode cache installed to help out with this. See the data-sample.php file for a dump of the data.

I know it is rather ugly, so please spruce it up. But I would like to keep it relatively small and to a single file so it is easy to drop into a directory anywhere without worrying about separate css/js/php files.

Screenshot

TODO

  • The ability to sort the list of cached scripts by the various columns
  • A better layout that can accommodate more of the script data without looking cluttered
  • A tuning suggestion tab (need to add a couple of things to the opcache output first though)

opcache-status's People

Contributors

ck99 avatar cviebrock avatar drussilla avatar jamesrwhite avatar jeffery avatar krakjoe avatar krisxoofoo avatar pborreli avatar remicollet avatar rlerdorf avatar swarajgiri avatar tessus avatar till avatar xakki 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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-status's Issues

Warnings on scripts tab when empty

PHP 5.6.11

Warning: asort() expects parameter 1 to be array, null given in /srv/opcache.php on line 109
Warning: Invalid argument supplied for foreach() in /srv/opcache.php on line 122

Cannot redeclare opcache_get_status()

php --syntax-check /opcache/data-sample.php
PHP Fatal error: Cannot redeclare opcache_get_status() in /opcache/data-sample.php on line 446

PHP 5.5.22 (cli) (built: Mar 5 2015 23:04:39)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies

High cpu usage on tab switch

Firefox console displays warning:
mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create

...{Yi=r}var Ii=[].proto?function(t,n){t.proto=n}:function(t,n){for(var e i...
in file d3.v3.min.js.

and indead when you click on a tab cpu spikes to 10-16%, just to switch a tab. on a Quad core i7 CPU.
I don't think that much cpu is needed just to hide and show a div, it should be snappy and fast.

'opcache.max_wasted_percentage' wrong units

Setting opcache.max_wasted_percentage to 5 seems to display 0.05 in the script, presumably because that's how PHP stores the value. I think multiplying it by 100 to restore the original meaning would be a good idea.

Slashes problem in Windows

Currently I use the windows 10 x64 OpenServer and I have a problem with slashes in JSON.parse().

VM444:1 Uncaught SyntaxError: Unexpected token D in JSON at position 10
    at JSON.parse (<anonymous>)
    at (index):477

Page source:

root = JSON.parse('{"name":"\\D:\\OpenServer\\domains\\opcache-status","children":[{"name":"vendor","children":[{"name":"rlerdorf","children":[{"name":"opcache-status","children":[{"name":"opcache.php","size":54152}]}]}]},{"name":"index.php","size":712}]}');

My solution:

root = JSON.parse('<?php echo json_encode(str_replace('\\', '/', $dataModel->getD3Scripts())); ?>');

Result:

root = JSON.parse('{"name":"\/D:\/OpenServer\/domains\/opcache-status","children":[{"name":"vendor","children":[{"name":"rlerdorf","children":[{"name":"opcache-status","children":[{"name":"opcache.php","size":54464}]}]}]},{"name":"index.php","size":712}]}');

Add metadata and make releases

Please add some notes in the single php file:

/**
 * opcache-status
 * 1.0
 * A one-page opcache status page for the PHP 5.5 opcode cache.
 * https://github.com/rlerdorf/opcache-status
 */

Or you can go php-doc.

Order scripts

Would be great if the scripts tab allowed you to order it by memory or hits.

It shows Scripts (1), what does it mean?

I copied the file on the root of my magento site, but all i see
Scripts (1)
/home/mystore/public_html/opcache.php
Does it mean opcache is not working? i checked the phpinfo and it shows it's up & running!

Notice during opcache restart

The following function in the opcache.php script generates a PHP notice during an OpCache restart:

public function getScriptStatusCount() {
return count($this->_status["scripts"]);
}

The 'scripts' key is not set when an opcache restart is pending after calling opcache_reset().

Filter problem

I have an error with a filter function.

Uncaught TypeError: Cannot read property 'filter' of undefined
    at HTMLInputElement.change ((index):412)
    at HTMLInputElement.u [as __onchange] (d3.v3.min.js:1)
function change() {
    // Filter out any zero values to see if there is anything left
    var remove_zero_values = dataset[this.value].filter(function(value) {
        return value > 0;
    });
...

My solution:

if (dataset[this.value] !== undefined) {
    var remove_zero_values = dataset[this.value].filter(function(value) {
        return value > 0;
    });
} else {
    var remove_zero_values = [];
}

PHP-parsed .html files are not listed, are they cached?

Most files on our site are named as .html files but are actually PHP code and parsed as such. The web server is correctly running them through PHP, however, the OpCache status page lists only .php files on its Scripts tab. Is OpCache only listing .php files? Or are .html files not being cached, and if so why not if they are being run through PHP? It's been a long time since I looked but I don't recall APC excluding those on our old server...

[RFC] Show warnings on risky configurations

Today I found out about what opcache.interned_strings_buffer does. Seems there isn't much documentation about this.

It would be great if the status page is able to give the user some warnings about poor/non-optimal configuration parameters. Examples of these warnings could be:

  • Your opcache.memory_consumption is almost out of memory, we suggest to raise it.
  • Your opcache.interned_strings_buffer is almost out of memory, we suggest to raise it.
  • There aren't many free keys, we suggest to raise opcache.max_accelerated_files.
  • You have a lot of wasted memory, maybe you can do to solve it.

Maybe this isn't something the status page should do, but would be great if so.

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.