krakjoe / apcu-bc

APCu Backwards Compatiblity Module
Other
33 stars 14 forks source link

Installing PHP Pecl "apcu_bc" #24

Closed Nirjonadda closed 6 years ago

Nirjonadda commented 6 years ago

Please let me know that when goes apcu_bc state "stable"? Can not install beta version.

Failed to download pecl/apcu_bc within preferred state "stable", latest release is version 1.0.3, stability "beta", use "channel://pecl.php.net/apcu_bc-1.0.3" to install install failed
remicollet commented 6 years ago

Just use pecl instal apcu_bc-beta

Nirjonadda commented 6 years ago

@remicollet So its are not goes to apcu_bc stable version?

Not work this the following commands. I am using cPanel CENTOS 7.4

# pecl instal apcu_bc-beta
-bash: pecl: command not found
fireproofsocks commented 6 years ago

@Nirjonadda there was a typo in the command -- should be "install", e.g.

pecl install apcu_bc-beta

However, this still doesn't seem to get the --enable-apcu-bc option working.

php -m | grep apcu

this DOES show apcu installed, but the following script fails:

<?php
if (function_exists('apc_fetch')) {
    print 'bc works';
}
fireproofsocks commented 6 years ago

Ok, I think I've figured this out. It would be hugely helpful if this were added to the README (or if there were a CONTRIBUTING file, users could submit their own updates to the docs). It's not very clear how to get this working on PHP 7 to support legacy apps that rely on the various apc_* functions. PHP.net refers to a different compilation flag than what is required here (but you have to look at the source to see that).

Installing APCu with Backwards compatibility mode

Install using pecl

pecl install apcu_bc-beta
# Or in Dockerfile, to get past the prompt, you can do something like:
printf '' | pecl install apcu_bc-beta
# add the .so to your ini file (adjust for your system's paths):
echo "extension=apcu.so" > /etc/php/7.1/cli/conf.d/apcu.ini

Manual install/build using Git

cd /tmp
git clone https://github.com/krakjoe/apcu-bc
cd apcu-bc
phpize
./configure --enable-apc \
make
make install
# add the .so to your ini file (adjust for your system's paths):
echo "extension=apcu.so" > /etc/php/7.1/cli/conf.d/apcu.ini

Usage

Now you should have functions like apcu_fetch() which should be able to replace the legacy apc_fetch() alternatives.

remicollet commented 6 years ago

Closing as duplicate of #25 About README file, feel free to open a PR