Support

Admin Tools

#22518 Broken site after Admin Tools recommendation to upgrade to PHP 5.5

Posted in ‘Admin Tools for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
n/a
PHP version
n/a
Admin Tools version
n/a

Latest post by nicholas on Friday, 24 April 2015 01:46 CDT

nemmar
Hi,

When I last updated Admin Tools Pro I got the following warning message in AT Pro:
You are using an obsolete PHP version: Your site is running on PHP 5.3.29 which has stopped receiving security updates since Thursday, 14 August 2014. Using this on a live site is dangerous: unpatched security issues can get your site hacked. Moreover, we will only support obsolete versions of PHP for nine months since their end-of-life date. Therefore we will discontinue support for your PHP version on Thursday, 14 May 2015. We strongly advise you to ask your host to upgrade your site to PHP 5.5 or later.

I have a dedicated server and my sites all use APC cache in the I had the hosting server admins update my server PHP to 5.5 but it broke my sites. Here is the email I got from the hosting server admin with the explanation:
The upgrade to PHP 5.5 broke the site because the websites are hard coded to look for apc. PHP 5.5 has opcahce built in, and it removed the APC instillation. To get the site to load we rolled back the server to PHP 5.3 and reinstalled APC. Before we upgrade to PHP 5.5 you will need to have the developer remove the requirement to look for APC.

In the Joomla Global Configuration there are two options for the Cache Handler setting: "File" or "Alternative PHP Cache". My sites all were set to APC because that is what was setup on the server. Do you know if your other clients with Joomla websites are using "File" instead of "APC" for their Cache settings with PHP 5.5x?

I know most web hosting tech support isn't reliable so I'm hoping you have some advice for me on how to fix this. Also, I'm now getting the following error message in the site backend after the server admin rolled back to PHP 5.3.29:
Error: Your host needs to disable magic_quotes_gpc to run this version of Joomla!

Thanks for any advice!

nicholas
Akeeba Staff
Manager
The APC caching is broken in Joomla! according to my experience. Actually, that's not quite accurate. When you are using a PHP caching mechanism which is not APC itself but provides an APC-compatible interface (e.g. opcache, Zend Data Cache) Joomla!'s APC cache handler is completely broken. I found out the Hard Way™: I'm using Zend Server for development. Once I upgraded to Zend Server 7.0 last year, which was the first release to use PHP 5.5, my dev sites were impossible to log in when using the APC handler for sessions. Oops!

As you figured out, the best way to move forward is to switch the caching of your sites to File and make sure that the session handler is set to Database. Then you can enable PHP 5.5 by default on your server.

A much better alternative which can be implemented after switching to PHP 5.5 is enabling memcache on your server. memcache is an in-memory cache key store, similar to APC but without opcode caching.

OK, let me explain the terms here:

* cache key store. A key is assigned to a value. Each request results in a key value which describes it uniquely. Identical requests have the same key. If the key exists in the store Joomla! doesn't go through page rendering. It retrieves the value of the key from the cache and returns it instead. Keys also have a built in expiration timer. If the key expires it is expunged from the cache, so Joomla! will regenerate the page. The File method stores the key values in the filesystem, inside the cache and administrator/cache directories. APC, memcache and other in-memory caches store these values in the server's RAM. RAM is orders of magnitude faster than the filesystem, therefore increasing performance on busy servers.

* op-code cache. This is what APC and opcache both do. When you "run" a PHP script the .php file has to be loaded from memory, go through the PHP language parser and get converted to an intermediate binary format called op-code. Then the guts of the PHP runtime (Zend Engine) execute this op-code. The .php file text to op-code conversion takes some time which can be as much as 20% of the request time. The op-code cache keeps this parsing result in memory. As long as it detects that the file hasn't changed on disk it will server the op-code stored in memory, therefore shaving off 5% to 20% of the request time. If the file changes on the disk it understands that it needs to parse the file afresh, updating the results of the op-code cache.

Back in PHP 5.3 and lower APC performed a dual role: it was BOTH and op-code cache AND an in-memory key-value cache store. Since PHP 5.5 there is no longer a need for an op-code cache since the very performant opcache (formerly Zend OPcache – it used to be a for-a-fee solution!) is built into PHP itself. This leaves us with the need for an in-memory cache. Since your server doesn't provide the straight-up APC you can switch to memcache. The major differences between APC and memcache are:

* APC only runs inside PHP. memcache is a daemon running on the server itself, outside PHP. APC's contents get lost when the web server daemon is restarted. memcache's contents are not lost in this case.
* APC is strictly single-server. It must run on the server where PHP runs. memcache can be distributed or even remote. If you have a super-busy site you can buy another dedicated server which runs nothing else but memcache itself. You can then off-load caching to that dedicated server. At the scale our typical Joomla! sites operate this is an overkill, but at least you know there's this option.

That's the executive summary of these technologies.

TL;DR – What should I do?

* Set Cache Handler to File
* Set Session Handler to Database
* Switch to PHP 5.5
* Ask your host if they can enable memcache. If they can, change the two handlers to memcache.

As for PHP 5.3, your host merely needs to set
 magic_quotes_gpc=Off
in your server's php.ini file.

Nicholas K. Dionysopoulos

Lead Developer and Director

πŸ‡¬πŸ‡·Greek: native πŸ‡¬πŸ‡§English: excellent πŸ‡«πŸ‡·French: basic β€’ πŸ• My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

nicholas
Akeeba Staff
Manager
One more thing. Would you mind us making this ticket public? It doesn't contain any sensitive information and I think it'd be very useful for other people making the switch to PHP 5.5.

Nicholas K. Dionysopoulos

Lead Developer and Director

πŸ‡¬πŸ‡·Greek: native πŸ‡¬πŸ‡§English: excellent πŸ‡«πŸ‡·French: basic β€’ πŸ• My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

nemmar
Hi Nicholas,

Yes, you can make this ticket public.

Thank you very much for the advice and information! It's a huge help and saves me a lot of wasted time and research!!

nicholas
Akeeba Staff
Manager
You're welcome! Thank you for letting me set this ticket public :)

Nicholas K. Dionysopoulos

Lead Developer and Director

πŸ‡¬πŸ‡·Greek: native πŸ‡¬πŸ‡§English: excellent πŸ‡«πŸ‡·French: basic β€’ πŸ• My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

nemmar
Hi Nicholas,

I had the hosting server admin install the PHP upgrade and this time it works fine since I followed your instructions about the Joomla Global Config settings. But I got an email from the server admin telling me the following about MemCache:

We have upgraded PHP to 5.5.24 again, and I have not seen any issues with your site loading. As far as your request to install MemCache, we can certainly help with that. However, I do want to point out that with PHP 5.5, Zend Opcache is also an option. It actually replaces APC in the newer versions of PHP. We also would not be able to provide much support for MemCache configuration, we would recommend consulting a developer for that.

If I'm clear on what you explained in the "op-code cache" paragraph above, I will still get a benefit to using the Zend Opcache but MemCache would be better. Is that correct?

Is it worth paying a developer to configure MemCache for me and use that instead of the Zend Opcache?

Thanks.

nicholas
Akeeba Staff
Manager
If I'm clear on what you explained in the "op-code cache" paragraph above, I will still get a benefit to using the Zend Opcache but MemCache would be better. Is that correct?


Yes. The OPcache leads to a measurable performance improvement and it's activated anyway. If it's not, ask your host to enable it.

Now, regarding MemCache, do you really need it? If your host is telling you that you're currently NOT experiencing any performance issues there's no point using it. Just enable the file cache. When your site gets to the point of experiencing performance issues you can pay someone to help you configure memcache.

Nicholas K. Dionysopoulos

Lead Developer and Director

πŸ‡¬πŸ‡·Greek: native πŸ‡¬πŸ‡§English: excellent πŸ‡«πŸ‡·French: basic β€’ πŸ• My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!