Can I use APC (Alternative PHP Cache) in my Bluemix PHP environment?
I added { "PHP_EXTENSIONS": ["apc"] } to my options.json file but when I tried that to deploy a message said that apc wasn't included in the buildpack. I need PHP 5.5 so I'm using php-buildpack#v4.3.2. Can you suggest a buildpack that includes APC?
I need an in-memory cache to replace Laravel's file cache. If I can't use APC, can anyone suggest anything else?
The Bluemix default PHP buildpack, which is listed in the admin catalog, is v4.1.5. This version supports both PHP 5.5 and APC. So you can bring your local environment to be compatible with PHP buildpack 4.1.5 to develop app on this version of buildpack.
PHP 5.5 and later come bundled with the OpCache, which supercedes the APC.
If you have code that uses the APC functions, you can continue using them in PHP 5.5 by using the APCu extension. APCu is APC, but with the opcache part removed (so that you can use the built-in OpCache instead), just leaving the memory cache and PHP functions to access it.
References:
http://jessesnet.com/development-notes/2014/php-55-opcache-apcu/
http://php.net/manual/en/migration55.new-features.php
http://php.net/manual/en/book.apcu.php
https://pecl.php.net/package/APCu
To close things out: I used php-buildpack#v4.1.5 which includes apc though it's based on PHP 5.4 so I had to down-level my guzzle to 5.3.0 which meant I needed to modify my guzzle code since I was using the guzzle 6 apis. I then changed my Laravel cache calls to use apc. Surprisingly, after all that the app still works, though whether it's really any faster is hard to tell
Related
This isn't particularly a coding question.
I have a script running locally (PHP V5.6) and it's absolutely perfect.
However, I FTPd it to our dev server to run as a cron and it failed. Our server has php v5.5 running for dependancy issues. Is there any way I can user composer require to install phpspreadsheet on a machine running PHP 5.5?
PHPSpreadsheet was deliberately written for PHP >=5.6.0 because I was fed up with the way people had made death threats to me for even suggesting that the minimum version of PHP required to run its predecessor (PHPExcel) should be increased from PHP 5.2 to take advantage of newer features of the language to reduce the codebase and memory footprint, and make it more performant
PHPSpreadsheet uses features of PHP that are only available in PHP 5.6 or above, and will soon drop support for even that version when Security support ends for that version of PHP on 31 Dec 2018, and require a minimum of PHP 7.1.0
If you need to create spreadsheets using older unsupported versions of PHP, then you can't use PHPSpreadsheet, and can only use its predecessor PHPExcel
No, PhpSperadsheet requires v5.6 or above.
In the docs # https://phpspreadsheet.readthedocs.io/en/develop/
Software requirements
The following software is required to develop using PhpSpreadsheet:
**PHP version 5.6 or newer**
PHP extension php_zip enabled
PHP extension php_xml enabled
PHP extension php_gd2 enabled (if not compiled in)
Try upgrading PHP.
We need to upgrade the php version from 5.3 to 5.5 of one project that´s using APC. So, as I´ve seen in php 5.5 there is a new cache library to use instead of apc, opcache. I have read the docs and I have a few doubts.
Actually, in one specific part of the project we are using the apc store and fetch functions to store some data, but I haven´t seen any similar functions to do the same task with opcache. The question is simple, is it possible to do the same with opcache?
Thanks in advance.
You can restore the store and fetch functions by installing APCu
sudo apt-get install php5-apcu
By installing APCu extension_loaded('apc') will return true as well
and you don't need to rename any of the old functions used.
I'm using this on a debian with PHP5.6 with OPCache enabled
source
No you can not do it with OPCache. This module makes OPCode Caching only.
I want to functions like apc_store() and apc_fetch() in my PHP application (I never used APC before). However, my understanding is that APC cannot be installed on PHP 5.5+ because PHP 5.5+ has its own opcode cache. If I plan on upgrading to PHP 5.5+ in the future, should I use apc_* functions? If I shouldn't, are there "future safe" alternatives to APC?
As of 5.5 and onward I replaced on my setups APC with APCu. APCu is APC without the opcode caching. It also provides the apc_ functions and passes checks for extension_loaded('apc').
Make sure you use at least v4.0.2 of this extension. Prior releases had a bug in which the apc_ functions were not available even when the APC compat mode was turned on.
Also see the answers to this question.
The variable storage part of APC has been left in the APCU package. It's APC, without the code cache.
I have been using ZF2 with PHP 5.3 and APC cache, and now I upgraded to PHP 5.5, and it seems there is no support for APC on PHP 5.5, I read that PHP5.5 have OpCache out of the box, but is it an alternative for APC? If yes How can I configure a Cache Storage Adapter for OpCache? if it is not to replace APC what can I use for PHP5.5? and how to configure an Adapter for it.
AFAIK OpCache differs from APC in that it's purely for caching scripts. You might want to take a look at the zf2 memcache adapter or hand roll your own with redis by implementing this interface. There are instructions here for implementing the interface, so it shouldn't be hard.
I use both memcache and redis extensively. I find memcache simpler but redis to have more functionality. If you only need a key-value store, i'd go with memcache as the adapter is pre-written.
Use the APCu like #ziollek's said. Starting from Php 5.5 Apc removed in favor of Opcache but APCu is a drop-in replacement for APC and it runs fully compatible with the good old APC.
So, Zend's APC cache storage adapter should work with APCu too.
See: https://github.com/krakjoe/apcu/issues/7
I'm working on Win7(x64), using PHP 5.3.
I had installed memcached, and the this service is running with port 11211 . And the *php_memcache.dll* had been copy into ext folder and added this extension into the ini file properly. But application always report the error 'The Memcache Extension must be loaded to use Memcached Cache' and Memcache can not be used.
I knew the difference between Memcache and Memcached, and I have tried many types of memcache and php extensions, finally, it's not working as always.
The error you're getting is typically caused due to an incompatible version (Possible duplicate).
You could upgrade from 5.3 to 5.4.6 here and either build memcache yourself or try this dll.
Alternatively you can try this dll for your current installation of PHP.
It's unfortunate but there is no maintained version of PECL binaries for windows. You should consider joining us privileged ones on a *nix environment :)