Jump to content

PrestaShop v1.6 on PHP 5.4 with APC or PHP 5.5 without OPcache?


Recommended Posts

Using PS v.1.6.0.9 I previously had PHP 5.4 with APC enabled in my hosting panel, and just switched to PHP 5.5 without seeing any impact, except that I get a 500 Internal Server Error when enabling the OPcache option.

 

  1. Is there any benefit running PS 1.6 on PHP 5.5?
  2. Does PS take advantage of APC when running PHP 5.4 or is PHP 5.5 without cache extension faster?
  3. Any idea why OPcache is not working with PS?

 

Zend OPcache is new starting with PHP 5.5, however APC is only available up to PHP 5.4, so when going for PHP 5.5 I'd have to use it without cache extension since OPcache doesn't seem to be working with PS.

 

I'm just trying to figure out the best PHP setup for PS.

Edited by Master One (see edit history)
Link to comment
Share on other sites

I was making last weeks also new tests with php 5.5 and 5.6. For my use (shop with about 10.000 products) the best configuration ever is opcodecache + xcache_3. It is a tick faster than the same shop working with apc enabled.

 

I'm not facing any problems with opcodecache and php 5.5. Which errors are you having ? Are you using also another framework on the server ? With zend is running well. With phalcon there are some incompatibility problems with Prestashop cart.

 

By the way APC + opcode never was possible to use together. You was using by this way without any errors ?

Edited by selectshop.at (see edit history)
Link to comment
Share on other sites

opcodecache + xcache_3? Is that a config option, module or what else?

 

I've already found the problem concerning the mentioned 500 Internal Server Error, which wasn't  because of OPcache, but Ioncube Loader (I had it active for another site on the same hosting account; I've already informed my ISP about that).

 

I haven't used APC + OPcode together, my hosting panel tells that APC is only available up to PHP 5.4 and OPcode starting with PHP 5.5.

 

I don't have access to PHP 5.6, so I guess I'll leave PS running on PHP 5.5 + OPcache now.

Link to comment
Share on other sites

  • 2 weeks later...

Well, I'm still on PHP 5.5.17 with OPcache enabled, but as it seems that's not giving me any advantage, right?

 

In Advanced Parameters >> Performance >> Caching there is only this:

 

cs4hkz56a1bmqimgt.gif

 

So as far as I understand this, without active support by PrestaShop for using OPcache as caching system I'm stuck here with either no cache or File System, because APC is only available up to PHP 5.4, Memcached is not available from my ISP, and Xcache is a Lighttpd extension (and the server my site is running on obviously is using Apache).

 

What are my options here? Should I

  • stick with PHP 5.5.17 and Use cache: NO
  • stick with PHP 5.5.17 and Caching system: File System
  • go back to PHP 5.4 and Caching system: APC

?

Edited by Master One (see edit history)
Link to comment
Share on other sites

Well, I'm still on PHP 5.5.17 with OPcache enabled, but as it seems that's not giving me any advantage, right?

 

In Advanced Parameters >> Performance >> Caching there is only this:

 

cs4hkz56a1bmqimgt.gif

 

So as far as I understand this, without active support by PrestaShop for using OPcache as caching system I'm stuck here with either no cache or File System, because APC is only available up to PHP 5.4, Memcached is not available from my ISP, and Xcache is a Lighttpd extension (and the server my site is running on obviously is using Apache).

 

What are my options here? Should I

  • stick with PHP 5.5.17 and Use cache: NO
  • stick with PHP 5.5.17 and Caching system: File System
  • go back to PHP 5.4 and Caching system: APC

?

 

Ah, I've been through this some time ago, and can understand the confusion.

 

The Prestashop "Use cache" option has nothing to do with the PHP OPcache, only about caching database query results.

 

PHP 5.4 and earlier does not contain neither an OPcache nor the APIs needed by the Prestashop "Use cache" option. If you install the APC extension it provides both of these.

 

PHP 5.5 and later contains an OPcache builtin, but not the APIs needed by the Prestashop "Use cache" option. If you install the APCu extension it provides this API.

 

So your options are one of:

PHP 5.4 + APC

PHP 5.5 + APCu

Both of these allow you to configure Prestashop "Use cache" Yes, and then choose APC as caching system.

 

Cheers, Robert.

  • Like 2
Link to comment
Share on other sites

Thanks for the explanation, Robert. I have just submitted a support request to our ISP, because the APCu module is not available in their PHP configuration.

 

I can't tell if they are going to provide it, so if not, should I stick with PHP 5.5 + OPcache and Advanced Parameters >> Performance >> Caching disabled, should I use it with File System as caching system, or should I go back to PHP 5.4 + APC ?

Link to comment
Share on other sites

Thanks for the explanation, Robert. I have just submitted a support request to our ISP, because the APCu module is not available in their PHP configuration.

 

I can't tell if they are going to provide it, so if not, should I stick with PHP 5.5 + OPcache and Advanced Parameters >> Performance >> Caching disabled, should I use it with File System as caching system, or should I go back to PHP 5.4 + APC ?

 

You would have to run benchmarks using your own setup to be sure. My guess is PHP 5.4 + APC will perform best.

 

Cheers, Robert.

  • Like 1
Link to comment
Share on other sites

I just received the following feedback from my ISP's support:

 

The question is irrelevant, because APC User Cache is not compatible with PHP as FastCGI anyway (not even with PHP <= 5.4 - see https://bugs.php.net/bug.php?id=57825)

 

I guess that means I'll just have to stick with PHP 5.4.33 + APC anyway, but then again I'm wondering what the future for PHP 5.5 holds.

Edited by Master One (see edit history)
Link to comment
Share on other sites

And one more thing:

Your PrestaShop Store is twice as fast with Zend OPcache @ PrestaShop Blog

This is very confusing, especially because the configuration for that test by Damien Metzger has not really been explained in that blog post, and as said, I can not really find any more info about this matter.

 

What's a proper way to test the performance difference between PHP 5.4 + APC and PHP 5.5 + OPcache ?

Link to comment
Share on other sites

I just received the following feedback from my ISP's support:

 

 

I guess that means I'll just have to stick with PHP 5.4.33 + APC anyway, but then again I'm wondering what the future for PHP 5.5 holds.

 

Ouch, FastCGI, it was years ago since PHP-FPM became the recommended way, and with PHP-FPM the shared user cache works fine. I use PHP-FPM so never stumbled across that problem.

 

Sounds like you cannot enable the Prestashop "Use cache" option with neither APC nor APCu then.

 

Moving forward to PHP 5.5 and 5.6 you really need to get your host to move over to PHP-FPM.

 

Cheers, Robert.

Link to comment
Share on other sites

Ouch, FastCGI, it was years ago since PHP-FPM became the recommended way, and with PHP-FPM the shared user cache works fine. I use PHP-FPM so never stumbled across that problem.

 

Sounds like you cannot enable the Prestashop "Use cache" option with neither APC nor APCu then.

 

Moving forward to PHP 5.5 and 5.6 you really need to get your host to move over to PHP-FPM.

 

Thanks again, Robert, I've forwarded your provided info to the tech support of our ISP.

 

Now I'm really confused, because their hosting panel allows enabling the APC extension when selecting PHP 5.4, and I can't believe that this is not functioning because otherwise that option would not be there.

 

Without any better knowledge it looks like I'll have to stick to PHP 5.4 + APC and hope for the best.

Link to comment
Share on other sites

Thanks again, Robert, I've forwarded your provided info to the tech support of our ISP.

 

Now I'm really confused, because their hosting panel allows enabling the APC extension when selecting PHP 5.4, and I can't believe that this is not functioning because otherwise that option would not be there.

 

Without any better knowledge it looks like I'll have to stick to PHP 5.4 + APC and hope for the best.

 

The control panel allows APC because the OPcache part of APC works fine also using FastCGI.

 

Its the user cache part of APC  and of APCu, the functionality used by the Prestashop "Use cache" option, that does not work using FastCGI. The host would need to switch to PHP-FPM to get that bit working.

Cheers, Robert.

Link to comment
Share on other sites

And one more thing:

Your PrestaShop Store is twice as fast with Zend OPcache @ PrestaShop Blog

This is very confusing, especially because the configuration for that test by Damien Metzger has not really been explained in that blog post, and as said, I can not really find any more info about this matter.

 

What's a proper way to test the performance difference between PHP 5.4 + APC and PHP 5.5 + OPcache ?

 

Benchmarking is complicated. Take all benchmarks performed on anything but your own application with a grain of salt.

 

With that is said most benchmarks I've seen put PHP 5.5 + builtin OPcache in the area 5-10% faster than PHP 5.4 + APC.

 

Cheers, Robert.

Link to comment
Share on other sites

The info I just got back (may not be entirely accurate because I translated it from German to English):

 

 

PHP-FPM may be useful on one-user-systems, but not on systems with more users/domains due to security, and security comes first (at least with us).

 

Generally you can use APC, each FastCGI-PHP worker process then gets his own cache, but from these processes there are more at the same time. As soon as you put value on consistency there (which is mostly expected with a User Cache) it will end without results - each of the processes has other values. With bytecode-caching the efficiency is lower, but consistency only plays a minor role with that. In principle it is the same with OPcache - but without User Cache.

 

I'm totally lost with this.

 

So do you think that PHP 5.5 + OPcache with Advanced Parameters >> Performance >> Caching disabled is nevertheless my best option?

Link to comment
Share on other sites

The info I just got back (may not be entirely accurate because I translated it from German to English):

 

 

I'm totally lost with this.

 

So do you think that PHP 5.5 + OPcache with Advanced Parameters >> Performance >> Caching disabled is nevertheless my best option?

 

Yes, that would be the correct and best performing setup in your FastCGI-based host setup.

 

PHP 5.4 + APC should also work fine, but probably with slightly worse performance.

 

Regardless, as long as your host is using FastCGI, you should *not* enable the Prestashop "Use cache"/APC option as that will only risk data inconsistency and lots of trouble.

 

The Prestashop documentation could use some improvements in this area.

Link to comment
Share on other sites

  • 1 month later...

Hi guys, my setup contains a VPS with plesk installed and via the control panel i found that:

- I run on PHP 5.4.33.

- PHP memory_limit set on 512Mb

- PHP support (run as FastCGI application ) enabled

- FastCGI support (required for Ruby on Rails) enabled

- Perl support enabled

- Python support enabled 

 

- I have installed APC with 128Mb

 

- Advanced Parameters >> Performance >> Caching is DISABLED

- Smarty cache enabled

- I use a module called Express Cache 2 .

 

Unfortunatly i face several MYSQL connections losts.

My host provider says mysql gets terminated because there arent any more resources available (ram) so i just had to upgrade from 

3600 MHz4 CPU Cores, 1256 MB RAM 256 MB Swap

to

4800 MHz6 CPU Cores 2048 MB RAM384 MB Swap

 

I think these resources are way too much for cached paged when the max cocnurent users i reach is 10-15 .

Is there anything that you would advice me to do in order to do better resource management?

 

Thanks in advance,

C

Link to comment
Share on other sites

  • 8 months later...

Aha, reboot server and it's working.

 

Are there any special settings I should be using? Currently I just have:

extension=apcu.soapc.enabled=1apc.write_lock=1apc.shm_size=100Mapc.slam_defense=0apc.enable_cli=1

Plus I added to php.ini the following:

 

[uPCu}

apc.enabled=1

apc.shm_size=256M

 

Is there anything else I should do?

 

Cheers

 

Nick

  • Like 1
Link to comment
Share on other sites

×
×
  • Create New...