Memcached not showing up in phpinfo() - php

I've installed libmemcached and memcached pecl extension for php and for some reason it's not installing correctly? i've got memcached.so in /usr/lib64/php/ with the right permissions and libmemcache.so in /usr/local/lib/
Everything seemed to build correctly without error, and I restarted apache?
i also have the daemon installed.
I somehow easily got the Memcache class easily installed for php before, but I realized what i wanted was the Memcached (note the d) class. let me know if more info is needed!
EDIT: I previously had memcache (without the d) working in php so I know i was manipulating the correct php.ini!
EDIT 2: there WAS indeed an apache error!
Unable to load dynamic library '/usr/lib64/php/modules/memcached.so' - /usr/lib64/php/modules/memcached.so: undefined symbol: php_json_encode in Unknown on line 0

I've solved it in centos5 using the yum installer instead of the pecl install memcached
THIS way --> yum install php-pecl-memcached
then, service httpd restart and it shows up in phpinfo()

I have the similar error few days ago. Instaling of new version(2.0) of memcached helped me.
yum -y install gcc-c++
wget http://launchpad.net/libmemcached/1.0/0.50/+download/libmemcached-0.50.tar.gz
tar xzf libmemcached-0.50.tar.gz
cd libmemcached-0.50
./configure
make
make install
wget http://pecl.php.net/get/memcached-2.0.0b2.tgz
pecl install memcached-2.0.0b2.tgz
echo 'extension=memcached.so' > /etc/php.d/memcached.ini
service php-fpm restart
cd ..
rm -r libmemcached-0.50*
rm -r memcached-

I don't know if it's the same problem but after struggling with this for hours I manage to have PHP properly installed with Memcached on CentOS using the command bellow:
yum --enablerepo=remi-php73 install php-memcached
Test installation:
php -i | grep -i memcache
Should show something like:
/etc/php.d/50-memcached.ini
memcached
memcached support => enabled
libmemcached version => 1.0.18
memcached.compression_factor => 1.3 => 1.3
memcached.compression_threshold => 2000 => 2000
memcached.compression_type => fastlz => fastlz
memcached.default_binary_protocol => Off => Off
memcached.default_connect_timeout => 0 => 0
memcached.default_consistent_hash => Off => Off
memcached.serializer => igbinary => igbinary
memcached.sess_binary_protocol => On => On
memcached.sess_connect_timeout => 0 => 0
memcached.sess_consistent_hash => On => On
memcached.sess_consistent_hash_type => ketama => ketama
memcached.sess_lock_expire => 0 => 0
memcached.sess_lock_max_wait => not set => not set
memcached.sess_lock_retries => 5 => 5
memcached.sess_lock_wait => not set => not set
memcached.sess_lock_wait_max => 150 => 150
memcached.sess_lock_wait_min => 150 => 150
memcached.sess_locking => On => On
memcached.sess_number_of_replicas => 0 => 0
memcached.sess_persistent => Off => Off
memcached.sess_prefix => memc.sess.key. => memc.sess.key.
memcached.sess_randomize_replica_read => Off => Off
memcached.sess_remove_failed_servers => Off => Off
memcached.sess_sasl_password => no value => no value
memcached.sess_sasl_username => no value => no value
memcached.sess_server_failure_limit => 0 => 0
memcached.store_retry_count => 2 => 2
Registered save handlers => files user memcached

add
extension=memcache.so
in php.ini then restart apache

Related

Installing php-soap on nginx with multiple php versions

I am running a few sites that has different php versions running (7.0 and 7.4)
For one of the sites, when I try to run soap code, I get:
Uncaught Error: Class 'SoapClient' not found
When I run
php -i | grep -i soap
i get the following output:
/etc/php/7.4/cli/conf.d/20-soap.ini,
soap
Soap Client => enabled
Soap Server => enabled
soap.wsdl_cache => 1 => 1
soap.wsdl_cache_dir => /tmp => /tmp
soap.wsdl_cache_enabled => 1 => 1
soap.wsdl_cache_limit => 5 => 5
soap.wsdl_cache_ttl => 86400 => 86400
I need to install the soap for php 7.0 and I am not that familiar with linux so I would love to get some step by step instructions.
Thanks!

OPCache is enabled, but php -i shows it is disabled

I installed NextCloud and in the summary window it keeps telling me that my OPCache is not enabled. I have enabled it and I am seeing conflicting information about if it really is enabled or not.
Ubuntu 18.04.1 | PHP 7.2.11-2
$ sudo cat /etc/php/7.2/apache2/php.ini | grep opcache
[opcache]
opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
;opcache.max_wasted_percentage=5
;opcache.use_cwd=1
;opcache.validate_timestamps=1
opcache.revalidate_freq=1
;opcache.revalidate_path=0
opcache.save_comments=1
;opcache.enable_file_override=0
;opcache.optimization_level=0xffffffff
;opcache.inherited_hack=1
;opcache.dups_fix=0
;opcache.blacklist_filename=
;opcache.max_file_size=0
;opcache.consistency_checks=0
;opcache.force_restart_timeout=180
;opcache.error_log=
;opcache.log_verbosity_level=1
;opcache.preferred_memory_model=
;opcache.protect_memory=0
;opcache.restrict_api=
;opcache.mmap_base=
;opcache.file_cache=
;opcache.file_cache_only=0
;opcache.file_cache_consistency_checks=1
; Implies opcache.file_cache_only=1 for a certain process that failed to
;opcache.file_cache_fallback=1
;opcache.huge_code_pages=1
;opcache.validate_permission=0
;opcache.validate_root=0
;opcache.opt_debug_level=0
Here is my output of php -i:
$ php -i
Zend OPcache
Opcode Caching => Disabled
Optimization => Disabled
SHM Cache => Enabled
File Cache => Disabled
Startup Failed => Opcode Caching is disabled for CLI
Directive => Local Value => Master Value
opcache.blacklist_filename => no value => no value
opcache.consistency_checks => 0 => 0
opcache.dups_fix => Off => Off
opcache.enable => On => On
opcache.enable_cli => Off => Off
opcache.enable_file_override => Off => Off
opcache.error_log => no value => no value
opcache.file_cache => no value => no value
opcache.file_cache_consistency_checks => 1 => 1
opcache.file_cache_only => 0 => 0
opcache.file_update_protection => 2 => 2
opcache.force_restart_timeout => 180 => 180
opcache.huge_code_pages => Off => Off
opcache.inherited_hack => On => On
opcache.interned_strings_buffer => 8 => 8
opcache.lockfile_path => /tmp => /tmp
opcache.log_verbosity_level => 1 => 1
opcache.max_accelerated_files => 10000 => 10000
opcache.max_file_size => 0 => 0
opcache.max_wasted_percentage => 5 => 5
opcache.memory_consumption => 128 => 128
opcache.opt_debug_level => 0 => 0
opcache.optimization_level => 0x7FFFBFFF => 0x7FFFBFFF
opcache.preferred_memory_model => no value => no value
opcache.protect_memory => 0 => 0
opcache.restrict_api => no value => no value
opcache.revalidate_freq => 2 => 2
opcache.revalidate_path => Off => Off
opcache.save_comments => 1 => 1
opcache.use_cwd => On => On
opcache.validate_permission => Off => Off
opcache.validate_root => Off => Off
opcache.validate_timestamps => On => On
Then finally, looking at a phpinfo() generated page, I see it loading the php.ini file from the correct one I have edited from the first block. The only additional .ini file it is loading is from the mods-available folder:
$ sudo cat /etc/php/7.2/mods-available/opcache.ini
; configuration for php opcache module
; priority=10
zend_extension=/usr/lib/php/20170718/opcache.so
There isn't any of the settings in that file, so the only file I see those settings in is the php.ini file, which is the same one being loaded from phpinfo(). These settings have been set for a while too, I am just now noticing they weren't taking affect. So the apache server has been rebooted with these settings saved. What am I missing here?
Edit:
Here are some screenshots of the phpinfo() screen for further clarification:
Well after playing around for a few hours, I think I figured it out. In par with what #Sammitch said. When I was doing an apt-get update, it was installing 7.3 php files for some reason. So I purged those and verified my config for php was set to default to 7.2 and then did another update and autoremove. That seemed to clear that confusion up. Not sure how that happened though.

No oci8 module in phpinfo()

I try to set up connection with oracle database, but I still can't even set up the module. I have rhel 7. 2 server, and I followed whole tutorial for setting up oracle instantclient and configured it with php. One thing I completely don't understand is that oci8 module displays after php -i execution:
oci8
OCI8 Support => enabled
OCI8 DTrace Support => disabled
OCI8 Version => 2.1.3
Revision => $Id: 59f993160cf983dd24bb391b68a65a17303d2dba $
Oracle Run-time Client Library Version => 12.1.0.2.0
Oracle Compile-time Instant Client Version => 12.1
Directive => Local Value => Master Value
oci8.connection_class => no value => no value
oci8.default_prefetch => 100 => 100
oci8.events => Off => Off
oci8.max_persistent => -1 => -1
oci8.old_oci_close_semantics => Off => Off
oci8.persistent_timeout => -1 => -1
oci8.ping_interval => 60 => 60
oci8.privileged_connect => Off => Off
oci8.statement_cache_size => 20 => 20
But there is no such module in phpinfo() inside the script. How to fix it?
PHP Version 7.0.13
Server Apache (httpd)
LD library path:
[![enter image description here][2]][2]
The common problem would be that LD_LIBRARY_PATH isn't set for Apache.
Try adding it to /etc/sysconfig/httpd like:
LD_LIBRARY_PATH=/full/path/to/oracle-client
If I have my versions right, this version of Apache (i) doesn't like the export keyword for setting variables (ii) requires a full path since it won't expand environment variables. If I'm wrong, try either or both of those.
There is a lot of information about setting the environment in the free Underground Oracle & PHP Manual, see, for example 'Setting Oracle Environment Variables for Apache' on p 108
You say you followed 'whole tutorial'. There are many tutorials. I'd recommend Oracle's installation instructions.
The answer is:
setsebool -P allow_execstack 1
You also can enable executable stack for only oci8.so with:
execstack -c /usr/lib64/php/modules/oci8.so
https://serverfault.com/questions/314336/centos-6-php-can-not-load-gdchart-so-and-oci8-so-compiled-by-me
make sure that the oci8.so is in the php extension folder
in centos is /usr/lib64/php/modules
in ubuntu xammp is /opt/lampp/lib/php/extensions/no-debug-non-zts-20170718
cd <extension folder >
sudo chmod 755 oci8.so
It works for me after
ps ax | grep "fpm"
check the pid of "php-fpm: master process"
sudo kill -9 <pid>
start php-fpm again
sudo service php-fpm start
inspired by https://stackoverflow.com/a/21693610/2538630

oci_connect() only works on cli

Ive installed httpd and httpd-devel packages and installed php and php-devel on a server. I downloaded and installed the basic client and sdk for oracle and then proceeded to use PECL to install OCI8 extension.
When I try running the oci_connect function page on CLI, It works fine. But when I try to load the same php page over http, i get the following error:
Fatal error: Call to undefined function oci_connect() in /var/www/html/index.php on line 10
I have compared the php ini from both and notice that /etc/php.d/oci8.ini file is loaded in the cli and the http version
however, the module details are only available on the cli version:
oci8
OCI8 Support => enabled
OCI8 DTrace Support => disabled
OCI8 Version => 2.0.8
Revision => $Id: f04114d4d67cffea4cdc2ed3b7f0229c2caa5016 $
Oracle Run-time Client Library Version => 12.1.0.2.0
Oracle Compile-time Instant Client Version => 12.1
Directive => Local Value => Master Value
oci8.connection_class => no value => no value
oci8.default_prefetch => 100 => 100
oci8.events => Off => Off
oci8.max_persistent => -1 => -1
oci8.old_oci_close_semantics => Off => Off
oci8.persistent_timeout => -1 => -1
oci8.ping_interval => 60 => 60
oci8.privileged_connect => Off => Off
oci8.statement_cache_size => 20 => 20
I cant for the life of me figure out why only one loads the extension properly when they both have the same configuration file.
Thanks for any help!
I managed to fix this by disabling SELINUX

php libcouchbase exception straight after installation

i have installed couchbase on ubuntu:
$ php -i | grep couchbase
Additional .ini files parsed => /etc/php5/cli/conf.d/couchbase.ini,
couchbase
couchbase support => enabled
libcouchbase version => 2.0.5
couchbase.compression_factor => 1.3 => 1.3
couchbase.compression_threshold => 2000 => 2000
couchbase.compressor => none => none
couchbase.config_cache => no value => no value
couchbase.durability_default_poll_interval => 100000 => 100000
couchbase.durability_default_timeout => 40000000 => 40000000
couchbase.instance.persistent => On => On
couchbase.restflush => On => On
couchbase.serializer => php => php
couchbase.view_timeout => 75 => 75
i have also done this:
$ locate libevent.so
/opt/couchbase/lib/libevent.so
$ export DYLD_LIBRARY_PATH=/opt/couchbase/lib
$ echo $DYLD_LIBRARY_PATH
/opt/couchbase/lib
so now i try and run the following script:
#!/usr/bin/php
<?php
$cb = new Couchbase("127.0.0.1:8091", "", "", "default");
$cb->set("a", 101);
var_dump($cb->get("a"));
?>
but i get the following errors:
PHP Fatal error: Uncaught exception 'CouchbaseLibcouchbaseException' with message 'Failed to create libcouchbase instance' in /tmp/test.php:3
how should i fix this problem?
i took eddie's advice and reinstalled using apt. now everything works fine:
sudo wget -O/etc/apt/sources.list.d/couchbase.list http://packages.couchbase.com/ubuntu/couchbase-ubuntu1204.list
wget -O- http://packages.couchbase.com/ubuntu/couchbase.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install libcouchbase{2,-dev,-dbg}

Categories