PHP 5.5 and 5.6 comes with OPCache. OPCache speeds up PHP execution by storing precompile bytecode of PHP in shared memory. Taking advantage of fast memory operations compared to hard disk operation, OPCache eliminates the process of having to read PHP scripts from the disk each time whenever a script must be executed.
In short, OPCache saves the time needed to serve PHP-powered websites!
How to enable OPCache?
This tutorial is written from Ubuntu 14.04 LTS standpoint – using php5-fpm, but it should also work for other Linux distro.
- First edit ‘/etc/php5/fpm/php.ini‘ file.
- Find “opcache” section in the PHP ini.
- Uncomment and change opcache.enable to opcache.enable=1
- Do the same for >opcache.memory_consumption, changed its value from 64 to 128 (or 256)
- Change opcache.interned_strings_buffer from 4 to 16
- Changed the opcache.max_accelerated_files to 8192
Activate OPCache with php5enmod command.
sudo php5enmod opcache
Save file and restart php5-fpm.
sudo service php5-fpm restart
PHP OPCache should be running on your server now. Here’s a reference of /etc/php/fpm/php.ini file in Ubuntu 14.04 LTS.
; Determines if Zend OPCache is enabled
; Determines if Zend OPCache is enabled for the CLI version of PHP
; The OPcache shared memory storage size.
; The amount of memory for interned strings in Mbytes.
; The maximum number of keys (scripts) in the OPcache hash table.
; Only numbers between 200 and 100000 are allowed.
BONUS: How to verify whether PHP OPCache is running ??
You can verify whether OPCache is running by using opcache-status by Rasmus Lerdorf. Just drop the script in one of your web directory and browse. If you’re not a Git fan, I’ve also have taken the liberty of mirroring the download: opcache-status.zip
Although Google has announce to drop SPDY support by early February 2016 in favor of HTTP/2, SPDY remains the best HTTP protocol extension to maximize compression and reduce webpage load latency.
The current and final SPDY implementation supported by Mozilla Firefox and Google Chrome is SPDY/3.1.
In order to check if your webserver supports SPDY 3.1, just simply:
- Go to your website, eg: https://blog.mypapit.net/
- Using Chrome, type – “chrome://net-internals/#spdy” at the addressbar
- You should see your website name and spdy/3.1 protocol listed, refer to Screenshot below
Additionally, you could go to spdycheck.org to check if your web server supports SPDY.
Secured Shell or SSH is a great way to enable a secure login for your UNIX / Linux Box. However there are precaution that you should take in order to properly secure SSH daemon from being scanned or attacked by script kiddies or automated bots.
This week I’m going to write a series of article on securing SSH on Ubuntu Linux Box (VPS) and I’m going to link to this post from time to time.
- Disable Root login, enable SSH login for a handful of users only
- Install and configure Fail2Ban
- Limit access with Firewall Rules (limit by ip block, or ip address)
- Limit connection rate to SSH port
- Disable keyboard interactive login, Use public-key login
- Security Security through obscurity: Hiding SSH version
- Security Security through obscurity: Change default SSH ports
Hope this will help in securing your Linux Box / Linux VPS
I haven’t had much time since I migrated my blog to a new VPS server. However, here is a little treat for all my readers out there. The top 5 things I do with my Ubuntu Linux:
- Surfing the internet
Pretty obvious – I usually surf the internet using my Ubuntu Linux on my Desktop computer. I’ve a dual-monitor setup computer with Intel Core i5 CPU (12GB RAM), It is not a gaming pc, but I do occasionally play DOSBox games as well as Need For Speed: World from another operating system. The seamless Unity integration with the web intrigues me though, wished I had touchscreen monitor
- Developing Android Application
The qemu-based Android device emulator runs nicely on Ubuntu, with no sign of lagging presents in other operating systems. Plus with 12GB of RAM, I can say that I could study and do mobile application with relative comfort. For Android 4.x development, I prefer to use the x86 images, because put less contraint on the CPU for skipping ARM-related code translation.
Usually this is being done in parallel with other works. My current favorite bittorent client is Deluge. For some reason, I find Azureus/Vuze too cumbersome and I haven’t got around to use Transmission. I used to study bittorrent protocol in my spare time, but has since abandoned it when I realise that I’ve not much time to spend on side-projects anymore.
- Writing Manual
I’m now in the process of writing a Lab Manual for those who just begining to learn about Mobile Computing. Although I wouldn’t call myself as an expert, I think every little bit of knowledge-sharing helps. I’ll promise I’ll share my progress with all of you sometimes at the end of the year. Though, I usually prepare my academic papers using Latex (IEEE templates), I choose to write my manual in LibreOffice, for reasons that I’m more familiar with WYSIWYG word-processor, plus, the publisher would prefer to receive the written manuscript in OpenDocument or Microsoft OpenXML file.
- Internet Radio
Though I rarely if ever listen to MP3 in portable devices, I do listen to internet radio station from Rhythmbox. There are sizeable collection of preset Internet Radio station in Rhythmbox according to genre and age-group. I prefer to listen to trance or easy-listening radio stations.
There you go, the top 5 things that I usually do with my Ubuntu Linux. Nothing fancy, just that I prefer to use Ubuntu for reasons of application development. I’m a terminal-emulator typed guy. I prefer to switch/change the environmental settings using terminal emulator, something I find very easy to do in Ubuntu (or any GNU/Linux distribution for that matter).
Until next time…
Previously as an effort to promote Ubuntu and Free Software, Canonical has made pre-pressed CD/DVD available for LoCo team to be distributed during release party or promo events.
But starting from Ubuntu 13.04 (Raring Ringtail), pre-pressed Ubuntu CD/DVD will only be made available only for LTS release (the next one will be 14.04 LTS ) from this point forward. This is in-line with Canonical policy to only concentrate on supporting Ubuntu LTS.
In the mean time, Canonical will continue to provide pre-pressed Ubuntu 12.04 LTS CD/DVD to Ubuntu LoCo until 14.04 LTS release in 2014.
source: Ubuntu Loco Council
Here’s an easy way to generate a new uuid:
Here’s how to change uuid of a block device / hard drive partitions.
tune2fs -U 550e8400-e29b-41d4-a716-446655440000 /dev/sd**