├── LICENSE
├── README.md
├── composer.json
├── opcache.php
├── thumbnail-1.png
├── thumbnail-2.png
├── thumbnail-3.png
└── thumbnail-4.png
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2013 Carlos Buenosvinos
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | OPcache Dashboard
2 | =================
3 | Set up properly and monitor your Zend OPcache with this dashboard that will help you checking memory, hits and status, configuring for optimal performance (warning you when cache full, validation, etc.) and reseting one or all scripts with one click.
4 |
5 | Installation
6 | ============
7 |
8 | Composer installation:
9 | ```
10 | composer require carlosio/opcache-dashboard
11 | ```
12 | Then you can symlink it to your public folder or require it from another php file.
13 |
14 | Or just copy and paste ```opcache.php``` anywhere in your public folder. You can use something such as:
15 | ```wget https://raw.github.com/carlosbuenosvinos/opcache-dashboard/master/opcache.php```
16 |
17 | **Try to keep it safe for non authorized users.**
18 |
19 | Screenshots
20 | ===========
21 | 
22 | 
23 | 
24 | 
25 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "carlosio/opcache-dashboard",
3 | "description": "Set up properly and monitor your Zend OPcache with this dashboard that will help you checking memory, hits and status, configuring for optimal performance (warning you when cache full, validation, etc.) and reseting one or all scripts with one click.",
4 | "keywords": ["opcache"],
5 | "license": "MIT",
6 | "authors": [
7 | {
8 | "name": "Carlos Buenosvinos",
9 | "email": "hi@carlos.io"
10 | }
11 | ]
12 | }
13 |
--------------------------------------------------------------------------------
/opcache.php:
--------------------------------------------------------------------------------
1 | 1048576) {
28 | return sprintf("%.2f MB", $bytes/1048576);
29 | } elseif ($bytes > 1024) {
30 | return sprintf("%.2f kB", $bytes/1024);
31 | } else {
32 | return sprintf("%d bytes", $bytes);
33 | }
34 | }
35 |
36 | function getOffsetWhereStringsAreEqual($a, $b)
37 | {
38 | $i = 0;
39 | while (strlen($a) && strlen($b) && strlen($a) > $i && $a{$i} === $b{$i}) {
40 | $i++;
41 | }
42 |
43 | return $i;
44 | }
45 |
46 | function getSuggestionMessage($property, $value)
47 | {
48 | switch ($property) {
49 | case 'opcache_enabled':
50 | return $value ? '' : ' You should enabled opcache';
51 | break;
52 | case 'cache_full':
53 | return $value ? ' You should increase opcache.memory_consumption' : '';
54 | break;
55 | case 'opcache.validate_timestamps':
56 | return $value ? ' If you are in a production environment you should disabled it' : '';
57 | break;
58 | }
59 |
60 | return '';
61 | }
62 |
63 | function getStringFromPropertyAndValue($property, $value)
64 | {
65 | if ($value === false) {
66 | return 'false';
67 | }
68 |
69 | if ($value === true) {
70 | return 'true';
71 | }
72 |
73 | switch ($property) {
74 | case 'used_memory':
75 | case 'free_memory':
76 | case 'wasted_memory':
77 | case 'opcache.memory_consumption':
78 | return size_for_humans($value);
79 | break;
80 | case 'current_wasted_percentage':
81 | case 'opcache_hit_rate':
82 | return number_format($value, 2).'%';
83 | break;
84 | case 'blacklist_miss_ratio':
85 | return number_format($value, 2);
86 | break;
87 | }
88 |
89 | return $value;
90 | }
91 |
92 | ?>
93 |
94 |
95 |