Installing php-soap on nginx with multiple php versions - php

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!

Related

extension enabled in CLI but not in PHPinfo

I'm trying to enable extenion oci8
I uncommented its line in php.ini and added the required files for it ( oracle instant client).
Now from CMD, when I type: php --ri oci8, it shows :
oci8
OCI8 Support => enabled OCI8 DTrace Support => disabled OCI8 Version
=> 2.1.8 Revision => $Id: 4543974aab26d8a3d85257ab18d0dca4503ff9e7 $ 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.max_persistent => -1 =>
-1 oci8.persistent_timeout => -1 => -1 oci8.ping_interval => 60 => 60 oci8.privileged_connect => Off => Off oci8.statement_cache_size => 20
=> 20 oci8.default_prefetch => 100 => 100 oci8.old_oci_close_semantics => Off => Off oci8.connection_class => no value => no value oci8.events => Off => Off
Statistics => Active Persistent Connections => 0 Active Connections =>
0
So it should working fine.
But when I try to connect to oracle from php I get error :
Call to undefined function Yajra\Pdo\oci_connect()
I opened to PHPINFO page, searched for oci8, the block that must be present to show it's enabled is not present.
What may be the problem?
I'm using xampp 7.2 on windows 10
Solved.
It was that my PC required restart not just Apache for PHP web to load the new enviroment variables, which is important in locating oracle instant client, which is needed by the PHP extension OCI8.
The strange thing is that PHP CLI loaded the new enviroment variables, but the PHP web didn't load it although Apache is restarted.
I noticed that from PHPinfo page, which displays the loaded envirmonment variables showing the old ones before adding oracle.
So just restated my PC and everything is now OK.
Thanks for your advice.
You must edit the php.ini file which is shown in phpinfo ("Loaded Configuration File ") option and apache restart is also required for it to work.

Class 'SoapClient' not found on Google Cloud PHP App

I deployed my php app to Google Cloud and getting currently the following error when i call the line.
$url = "S5WS.wsdl";
$client = new \SoapClient(dirname(__FILE__) . DIRECTORY_SEPARATOR . $url, array('trace' => true, 'soap_version' => SOAP_1_1));
PHP message:
PHP Fatal error: Class 'SoapClient' not found in /app/controllers/TicketController.php on line 211
I opened the terminal in the Google Cloud and typed php -i | grep -i soapso to check the status of the soap and it seemds to be fine.
baltacii#s5-app-****:/$ php -i | grep -i soap
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
baltacii#s5-app-167912:/$
If i call phpinfo(); in the app.It returns me in contrast to my localhost no Soap Section. There are only 2 lines related with the soap.
SOAP Brad Lafountain, Shane Caraveo, Dmitry Stogov
and in the configure command section
'--enable-soap=shared'
EDIT: App runs on PHP Version 5.6
So according to documentation some PHP extensions are compiled as shared, but disabled by default.Soap is one of these extensions.In order to activate it. We should create a php.ini in the base folder of the project.
php.ini
; Enable the Soap extension
extension=soap.so
After new deployment to server soap should be available.

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

Memcached not showing up in phpinfo()

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

Categories