Opache gui update and now on Packagist

I’ve just pushed to github a big overhaul of the opcache gui script. It comes with a sweeping set of changes which also includes using react.js to power some of the interface to really enhance the real-time updates. (OK, it was really just an excuse for me to learn a little about react.js but I think it was worth it!)

I’ve also put the opcache gui and the php error log gui up on packagist – my first packages on there!  Check ’em out:


Did you like this? Share it:

Create video thumbnail previews for JW Player

JWPlayer is a fantastic video player for the web. One of the great features it provides is the ability to show thumbnail previews of the video as you slide along the toolbar timeline, much the same way that YouTube and the like allow.

Generating the thumbnail images is not quite so easy unless you have ffmpeg installed and know a bit about the command line options. I got a little frustrated myself having to come up the with the command line magic whenever I needed it, and so the JW Player thumbnail preview generator was born!

It’s a simple command line tool, written in PHP, that allows you to whip up the thumbnails and generate the required VTT file with a command as simple as:

php thumbnails.php -i "/input/video.mp4"

OK, so you still need to have ffmpeg installed on your machine – not much I can do about that one, sorry! – but at least generating the files is now much easier!

You can generate the individual thumbnails or have them coalesced into  sprite sheet, and generate a random poster image. Full instructions are on my GitHub account; so go, fork, improve, and feel free to give any feedback.

Did you like this? Share it:

Effective, clean UI for viewing the PHP error log

Example usage

Recently at work I found myself trawling through the PHP error log file and found that all the lines of text were starting to blur after a while. Thinking there had to be a better way over viewing the log file, and following on from my single-file opcache viewer gui, I decided to knock out something for viewing the error log file as well.

With this single-file error log gui it will only show the error once and then tell you how many times it appears in the log. It will allow you to narrow down your search of errors by being able to hide the different types or sort in different ways, and it will also allow you to search results based on particular file paths.

I’ve pushed the code up to my GitHub account, so please feel free to fork and improve and/or give feedback.

Did you like this? Share it:

Zend OPcache – some info and a GUI

I’ve just started to use Zend OPcache in place of APC in a few places and so far it’s great!

Because documentation seems a little scarce right now, I’ve decided to jot down the methods available (mainly so I don’t forget).

Should be pretty obvious given the name – resets the opcache

This will return an array with three indices, one for the directives that have been set, one for version information and one for any blacklisted paths. For example:

    [directives] => Array
            [opcache.enable] => 1
            [opcache.enable_cli] => 1
            [opcache.use_cwd] => 1
            [opcache.validate_timestamps] => 1
            [opcache.inherited_hack] => 1
            [opcache.dups_fix] => 
            [opcache.revalidate_path] => 
            [opcache.log_verbosity_level] => 1
            [opcache.memory_consumption] => 134217728
            [opcache.max_accelerated_files] => 4000
            [opcache.max_wasted_percentage] => 0.05
            [opcache.consistency_checks] => 0
            [opcache.force_restart_timeout] => 180
            [opcache.revalidate_freq] => 2
            [opcache.preferred_memory_model] => 
            [opcache.blacklist_filename] => 
            [opcache.max_file_size] => 0
            [opcache.error_log] => 
            [opcache.protect_memory] => 
            [opcache.save_comments] => 1
            [opcache.load_comments] => 1
            [opcache.fast_shutdown] => 1
            [opcache.enable_file_override] => 
            [opcache.optimization_level] => 2147483647

    [version] => Array
            [version] => 7.0.2-dev
            [opcache_product_name] => Zend OPcache

    [blacklist] => Array


This will return that holds information about whether the opcache is turned on or not, whether it’s in a restart phase, the memory usage and hit statistics, and any files that have been cached along with hit and memory details. For example:

    [opcache_enabled] => 1
    [cache_full] => 
    [restart_pending] => 
    [restart_in_progress] => 
    [memory_usage] => Array
            [used_memory] => 9395880
            [free_memory] => 121987104
            [wasted_memory] => 2834744
            [current_wasted_percentage] => 2.1120488643646

    [opcache_statistics] => Array
            [num_cached_scripts] => 353
            [num_cached_keys] => 1546
            [max_cached_keys] => 7963
            [hits] => 27055
            [start_time] => 1365412384
            [last_restart_time] => 0
            [oom_restarts] => 0
            [hash_restarts] => 0
            [manual_restarts] => 0
            [misses] => 509
            [blacklist_misses] => 0
            [blacklist_miss_ratio] => 0
            [opcache_hit_rate] => 98.153388477725

    [scripts] => Array
            [/http/includes/libs/ZF-1.12.2/Zend/Loader/Autoloader.php] => Array
                    [full_path] => /http/libs/ZF-1.12.2/Zend/Loader/Autoloader.php
                    [hits] => 175
                    [memory_consumption] => 63320
                    [last_used] => Mon Apr  8 16:21:14 2013
                    [last_used_timestamp] => 1365434474
                    [timestamp] => 1343660895

            [/http/www-includes/libs/ZF-1.12.2/Zend/Db/Adapter/Oracle.php] => Array
                    [full_path] => /http/libs/ZF-1.12.2/Zend/Db/Adapter/Oracle.php
                    [hits] => 17
                    [memory_consumption] => 60600
                    [last_used] => Mon Apr  8 16:21:14 2013
                    [last_used_timestamp] => 1365434474
                    [timestamp] => 1325795702

            [/http/libs/ZF-1.12.2/Zend/View/Helper/Placeholder/Container.php] => Array
                    [full_path] => /http/libs/ZF-1.12.2/Zend/View/Helper/Placeholder/Container.php
                    [hits] => 175
                    [memory_consumption] => 2744
                    [last_used] => Mon Apr  8 16:21:14 2013
                    [last_used_timestamp] => 1365434474
                    [timestamp] => 1325795702



APC did have a GUI which was quite handy to see what had been cached, settings and memory usage but Zend OPcache doesn’t (currently as far as I could see) have anything similar.

It is possible to get information from looking at the output of phpinfo() which contains all of the key information.

However, I’ve just pushed the start of a GUI to GitHub. If you want to make changes and improvements then please feel free! It’s only had a very little amount of work done on it so far so is pretty raw.

Did you like this? Share it:

My CodeMagic fork (a TinyMCE plugin for code editing)

I’ve used TinyMCE for a while – it’s an excellent WYSIWYG editor for web applications. However, the code editor in it is really simplistic. Enter CodeMagic, a plugin that allows you to replace the standard code editor with one that used the excellent CodeMirror library for syntax highlighting. So I started to use CodeMagic but found a number of issues with it. For example, it used CodeMirror 2 and not 3, had issues with using IE and the word wrapping functionality and the window resizing was never great. But with the joy of things being on GitHub and up for a bit of a forking, that’s exactly what I did.

Check out my CodeMagic fork on GitHub and feel free to give me any feedback, or fork it yourself and make it better.

Did you like this? Share it: