Skip to content

Commit 06ddd7d

Browse files
authored
Improved advanced jit output (#80)
* Use `DateTimeImmutable` rather than `date` * A few minor tidy-ups * Bump of version in preparation * Expands on the JIT value * Updated readme
1 parent 5ddcf95 commit 06ddd7d

File tree

7 files changed

+118
-45
lines changed

7 files changed

+118
-45
lines changed

README.md

+38-11
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,27 @@ A clean and responsive interface for Zend OPcache information, showing statistic
44

55
This interface uses ReactJS and Axios and is for modern browsers and requires a minimum of PHP 7.1.
66

7-
[![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=acollington&url=https://github.com/amnuts/opcache-gui&title=opcache-gui&language=&tags=github&category=software)
8-
If you like this software or find it helpful then maybe you'll consider supporting my efforts in some way by [signing up to Flattr and leaving a micro-donation](https://flattr.com/@acollington).
7+
# License
8+
9+
MIT: http://acollington.mit-license.org/
10+
11+
# Sponsoring this work
12+
13+
If you're able and would like to sponsor this work in some way, then feel free to do so through the [GitHub Sponsorship](https://github.com/sponsors/amnuts) page.
14+
15+
Alternatively, if you'd just like to give me a [shout-out on Twitter](https://twitter.com/acollington) to say you use it, that'd be awesome, too! (Any one else miss postcardware?)
16+
17+
# Using the opcache-gui
918

10-
### Using the opcache-gui
19+
## Installing
1120

1221
There are two ways to getting started using this gui:
1322

14-
#### Copy/clone this repo
23+
### Copy/clone this repo
1524

1625
The easiest way to start using the opcache-gui is to clone this repo, or simply copy/paste/download the `index.php` file to a location which your web server can load. Then point your browser to that location, such as `https://www.example.com/opcache/index.php`.
1726

18-
#### Install via composer
27+
### Install via composer
1928

2029
You can include the files with [Composer](https://getcomposer.org/) by running the command `composer require amnuts/opcache-gui`.
2130

@@ -58,7 +67,7 @@ ln -s /var/www/vendor/amnuts/opcache-gui/index.php /var/www/html/opcache.php
5867

5968
Basically, there are plenty of ways to get the interface up and running - pick whichever suits your needs.
6069

61-
### Configuration
70+
## Configuration
6271

6372
The default configuration for the interface looks like this:
6473

@@ -94,7 +103,7 @@ $opcache = (new Service([
94103
]))->handle();
95104
```
96105

97-
### Changing the look
106+
## Changing the look
98107

99108
The interface has been split up to allow you to easily change the colours of the gui, or even the core components, should you wish.
100109

@@ -115,6 +124,8 @@ The build process will create a compiled css file at `build/interface.css` and t
115124

116125
The core PHP template used in the build process, and that acts to pass various bits of data to the ReactJS side of things, is located at `build/template.phps`. If you wanted to update the version of ReactJS used, or how the wrapper html is structured, then this would be the file you'd want to update.
117126

127+
## The interface
128+
118129
### Overview
119130

120131
The overview will show you all the core information. From here you'll be able to see what host and platform you're running on, what version of OPcache you're using, when it was last reset, the functions and directives available (with links to the php.net manual), and all the statistics associated with the OPcache (number of hits, memory used, free and wasted memory, and more).
@@ -159,7 +170,13 @@ When the real-time updates are active, the interface will automatically update a
159170

160171
Also, if you choose to invalidate any files or reset the cache it will do this without reloading the page, so the search term you've entered, or the page to which you've navigated do not get reset. If the real-time update is not on then the page will reload on any invalidation usage.
161172

162-
## Releases
173+
# Releases
174+
175+
**Version 3.3.1**\
176+
Just a few minor tweaks:
177+
* Added more of an explanation to the JIT value
178+
* Replaced date functions with \DateTime and related classes
179+
* Updated README with troubleshooting and sponsorship info (and refined header levels)
163180

164181
**Version 3.3.0**\
165182
Mostly added JIT information for PHP 8:
@@ -250,7 +267,7 @@ Releases of the GUI are available at:
250267

251268
https://github.com/amnuts/opcache-gui/releases/
252269

253-
### Making is compatible with PHP 7.0
270+
# Making is compatible with PHP 7.0
254271

255272
The script requires PHP 7.1 or above. I'm not tempted to downgrade the code to make it compatible with version 7.0, and hopefully most people would have upgraded by now. But I really do appreciate that sometimes people just don't have the ability to change the version of PHP they use because it's out of their control. So if you're one of the unlucky ones, you can make the following changes to `index.php` (or `Service.php` and run the build script). For the lines:
256273

@@ -264,6 +281,16 @@ public function resetCache(?string $file = null): bool
264281

265282
It'll just be a case of removing the `?` from each of the params.
266283

267-
# License
284+
# Troubleshooting
268285

269-
MIT: http://acollington.mit-license.org/
286+
## Use of PHP-FPM
287+
288+
A number of people have questioned whether the opcache-gui is working on their instance of PHP-FPM, as the files shown don't appear to be everything that's cached, and that's different to what Apache might show.
289+
290+
Essentially, that's expected behaviour. And thanks to a great comment from contributor [Michalng](https://github.com/amnuts/opcache-gui/issues/78#issuecomment-1008015099), this explanation should cover the difference:
291+
292+
> The interface can only show what it knows about the OPcache usage of its own OPcache instance, hence when it's accessed through Apache with mod_php, then it can only see the OPcache usage of that Apache webserver OPcache instance. When it's accessed with classic CGI, it can only see itself being cached as a new PHP and OPcache instance is created, in which case OPcache itself often doesn't make sense.
293+
>
294+
> To be able to monitor and manage the OPcache for all web applications, all need to use the same FastCGI, i.e. PHP-FPM instance.
295+
>
296+
> In case of Apache, one then often needs to actively configure it to not use it's internal mod_php but send PHP handler requests to the shared PHP-FPM server via mod_proxy_fcgi, which also requires using the event MPM. That is generally seen as the preferred setup nowadays, especially for high traffic websites. This is because every single incoming request with MPM prefork + mod_php creates an own child process taking additional time and memory, while with event MPM and dedicated PHP-FPM server a (usually) already waiting handler thread is used on Apache and on PHP end, consuming nearly no additional memory or time for process spawning.

build/_frontend/interface.jsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,9 @@ function Directives(props) {
337337
return (
338338
<ul className="directive-list">{
339339
directive.v.map((item, key) => {
340-
return <li key={key}>{item}</li>
340+
return Array.isArray(item)
341+
? <li key={"sublist_" + key}>{directiveList({v:item})}</li>
342+
: <li key={key}>{item}</li>
341343
})
342344
}</ul>
343345
);

build/_frontend/interface.scss

+4
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,10 @@ $footer-border-color: #CCC;
260260
&:last-child {
261261
margin-bottom: 0;
262262
}
263+
264+
ul {
265+
margin-top: 1.5em;
266+
}
263267
}
264268
}
265269

build/build.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* OPcache GUI - build script
55
*
66
* @author Andrew Collington, andy@amnuts.com
7-
* @version 3.3.0
7+
* @version 3.3.1
88
* @link https://github.com/amnuts/opcache-gui
99
* @license MIT, https://acollington.mit-license.org/
1010
*/

build/template.phps

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Amnuts\Opcache;
88
* A simple but effective single-file GUI for the OPcache PHP extension.
99
*
1010
* @author Andrew Collington, andy@amnuts.com
11-
* @version 3.3.0
11+
* @version 3.3.1
1212
* @link https://github.com/amnuts/opcache-gui
1313
* @license MIT, https://acollington.mit-license.org/
1414
*/

0 commit comments

Comments
 (0)