Tomohiro NAKAMURA
Tomohiro NAKAMURA

Reputation: 23

Can I use APCu in Lithium of the PHP Framework with no configuration, or should I change the code?

When I setup a lithium project (below process) and start PHP web server, I get an information of Apc disable (Apc ✗) on the framework's welcome page.

But I run sed -ir "s/'apc'/'apcu'/" libraries/lithium/storage/cache/adapter/Apc.php, then I get Apc enabled (Apc ✓).

This code change is correctly? or not?

Environment

Detail:

$ rpm -qa | grep php
php-pdo-7.1.7-1.fc26.x86_64
php-pecl-apcu-devel-5.1.8-2.fc26.x86_64
php-7.1.7-1.fc26.x86_64
php-mysqlnd-7.1.7-1.fc26.x86_64
php-json-7.1.7-1.fc26.x86_64
php-devel-7.1.7-1.fc26.x86_64
php-cli-7.1.7-1.fc26.x86_64
php-pecl-apcu-5.1.8-2.fc26.x86_64
php-common-7.1.7-1.fc26.x86_64

How to setup of the Lithium, and access the framework's welcome page:

$ composer.phar create-project --prefer-dist unionofrad/framework app
Installing unionofrad/framework (v1.1.1)
  - Installing unionofrad/framework (v1.1.1): Loading from cache
Created project in app
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals
  - Installing composer/installers (v1.3.0): Loading from cache
  - Installing unionofrad/lithium (v1.1.0): Loading from cache
Writing lock file
Generating autoload files
$ cd app/
$ php -S 0.0.0.0:8080 -t app/webroot index.php

Setting diff

.orig file is the backup.

Cases

with a -c /etc/php.ini parameter

Run with the parameter, but it no effect,:

$ php -c /etc/php.ini -S 0.0.0.0:8080 -t app/webroot index.php

shows Apc disable (Apc ✗).

Upvotes: 2

Views: 95

Answers (1)

Tomohiro NAKAMURA
Tomohiro NAKAMURA

Reputation: 23

Install php-pecl-apcu-bc package by dnf makes adapting to Apc ✓. But php-pecl-apcu-bc is "APCu Backwards Compatibility Module"... oh.

Before installed:

$ php -m
[PHP Modules]
apcu
bz2
calendar
Core
ctype
curl
date
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
readline
Reflection
session
sockets
SPL
sqlite3
standard
tokenizer
zlib

[Zend Modules]

After installed:

$ php -m
[PHP Modules]
apc
apcu
bz2
calendar
Core
ctype
curl
date
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
readline
Reflection
session
sockets
SPL
sqlite3
standard
tokenizer
zlib

[Zend Modules]

Upvotes: 0

Related Questions