can not find SoapClient in php - php

I got this error saying:
Fatal error: Class 'SoapClient' not found in ....php file. Do I have to install/include the SoapClient manually? Isn't it a builtin php module?
Update:
If I am using wordpress, how can I get soapclient installed?
Thanks.

It depends on how you installed PHP.
If PHP was built from source, you have to rebuild it with the --enable-soap option per http://php.net/manual/en/soap.installation.php.
If you installed a binary package via a package manager in your distro, check if you can find any php5-soapclient-packages or similar and install those.
Tested on Debian wheezy, php5-cli includes SoapClient() by default.

No, it isn't installed by default. You need to install PHP with --enable-soap option.
Read more here http://php.net/manual/en/soap.installation.php

Related

Call to undefined function Symfony\Polyfill\Mbstring\iconv_strlen()

My project works fine on localhost but not working online and this is the error:
Fatal error: Call to undefined function Symfony\Polyfill\Mbstring\iconv_strlen() in /home/stram/public_html/vendor/symfony/polyfill-mbstring/Mbstring.php on line 338
I googled it and I found that I need to install the PHP extension iconv. The problem that I'm using a VPS and when I went to the list of available PHP extensions I didn't found this extension !
Thnx in advance.
Symfony provides an iconv-polyfill for cases like that. Just add it as requirement to your project, and you should be fine:
composer require symfony/polyfill-iconv
It may also happen that you are using an outdated version of PHP, or one that was compiled without iconv.
To check that, run php --ri iconv with any SSH software, like Putty, etc.
If it shows Extension 'iconv' not present., your problem is in PHP. Then you have a few options:
Run php -v to check your PHP version, and update it if necessary
Or compile PHP again with iconv
Or enable iconv on WHM/cPanel, if you use them
Or ask your hosting company for support
Here is a solution to your problem (command line is for CentOS) :
If you use WHM with the CentOS 7 operating system you will encounter errors like this when typing "composer" on the console:
Fatal error: Uncaught Error: Call to undefined function Symfony\Polyfill\Mbstring\iconv() in phar:///opt/cpanel/composer/bin/composer/vendor/symfony/polyfill-mbstring/Mbstring.php:661
Stack trace:
0 phar:///opt/cpanel/composer/bin/composer/vendor/symfony/polyfill-mbstring/bootstrap.php(48): Symfony\Polyfill\Mbstring\Mbstring::mb_strwidth('help', 'ASCII')
......
The solution is to install the iconv package using WHM:
Enter to your WHM then type "EasyApache 4" then click "EasyApache 4" and click "Customize". you can see in the picture
EasyApache 4
Select PHP Extensions, type "iconv" in the search and check the version of php that you will use to install the iconv package. see in the picture
PHP Extensions
Choose Review
Review
Click Provision
Provision
To ensure that the iconv package is installed you can use this command "php --ri iconv" if the results are like this in the picture. then the iconv package has succeeded. try typing the composer again so you don't get any more errors
php --ri iconv
Solved: If you are using Cpanel/WHM STACK then follow:
Go to WHM >> EasyApache4 >> Current Installed Packages >> customize
Now Select php extensions and search for iconv and debug install both of them and try to install again.. enjoy :)
I had the same error message when I installed Mbstring extension but did not restart Apache.
All that needed is to do
$ sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper restart
Yeah, I have a long path here, but it is just for me. It is because I use MacPorts
To find your Apache location use
$ ps ax | grep apache
P.S.
I don't have iconv extension installed too. At list it is not listed when I call php info like so:
die(phpinfo());
BTW
it is really easy to install extension with MacPorts, For my PHP 5.6 I have done just:
$ sudo port install php56-mbstring

How to configure option --with-libdir with PHP5.5

I'm building PHP5.5 with ldap support.
I've a 64bits system, so my libs are into /usr/lib64
So when I build PHP I add the following option: --with-libdir=/usr/lib64
But When I run the configure tool, I get the following error:
configure: error: Cannot find ldap libraries in /usr//usr/lib64
Anybody know how absolute path works for these options?
If you already have libraries in right dir, and you set the right --with-libdir
Try install -devel version
You can kind of see the issue from the error. It's already looking in /usr, so you just need to put:
--with-libdir=lib64

Fatal Error: ezSQL_mysql requires mySQL Lib to be compiled and or linked in to the PHP engine

I'm attempting to get the link shortening PHP scripts YOURLS working on my basic web server running Lubuntu 12.04.
I have a MySQL database created and PHP5 installed. When I attempt to access the administration interface for YOURLS in a browser, I am presented with the following message:
Fatal Error: ezSQL_mysql requires mySQL Lib to be compiled and or linked in to the PHP engine
I'm very new to MySQL and PHP, so I don't know how to approach this problem. Could you point me in the right direction on this?
(For a quick guide to setting up YOURLS, you can see this video to get the general idea.)
You need to ensure that the MySQL extension is loaded into PHP.ini, and has been compiled into PHP as well.
Install mysql-devel and php-mysqli packages
yum install mysql-devel php-mysqli
Names can change a bit as Ernest show's in his answer.
If you have installed your php server and mysql through yum, try to use yum to search for the relevant package.
For example, if you used "yum install php55", try "yum search php55", then look for something like "php55-mysqld". If found, install it "yum install php-mysqld". That will install the required module for PHP to interact with your mysql.
Installing all php packages and its dependencies worked for me.
yum install php-*
finnaly i Found the solution
just change this line > class ezSQL_mysql extends ezSQLcore in ez_sql_mysql.php
to class ezSQL_mysqlx extends ezSQLcore
:)

pcntl and posix

I keep getting the following error
Fatal error: Uncaught System_Daemon_Exception: PHP is compiled without --enable-pcntl directive in
I have used the PEAR Daemon program to create a daemon but I keep getting the error above.
I'm guessing I need the posix and pcntl extensions, but how do I install/enable pcntl and posix for PHP without recompiling PHP?
also I used the yum command but no package was found.
I'm on a CENTOS Linux server.
CentOS 5.7 does not ship with those packages.
Installing php-posix: How does one easily add posix support to PHP using yum?
Installing php-pcntl: https://serverfault.com/q/158113/75968
pcntl does not seem to be available, so either compile it yourself or use an additional repository, e.g. EPEL. We used it to get current php versions.
I was trying to do the same thing, and the only way that worked was compiling the pcntl extension itself -- at least it wasn't recompiling the whole php source. The method I used I mentioned in my answer at the serverfault question cweiske linked to.
I managed to adapt the instructions there to also work for the posix module, by just performing the same steps with "pcntl" replaced with "posix".

How to add Solr PECL extension into lampp (xampp) stack

Is it possible to add PECL extensions into a lampp stack? If so, how can it be done?
I am specifically interested in http://www.php.net/manual/en/book.solr.php extension.
EDIT: when installing this extension using:
/opt/lampp/bin/pecl install -f solr
everything seams to go as it should except at the end:
checking for cURL support... yes, shared
checking for cURL in default path... not found
configure: error: Please reinstall the libcurl distribution -
easy.h should be in <curl-dir>/include/curl/
ERROR: `/tmp/pear/temp/solr/configure --enable-solr=yes --enable-solr-debug=no --with-curl=/opt/lampp/bin --with-libxml-dir=/usr' failed
From what I understand this should mean that it simply needs to find the correct curl location which I specify in the install when it asks as 'opt/lampp/bin'
Does this mean that it can't be done without recompiling php using a different curl package? Is this even possible with a lampp stack or do I have to now build my own?
Any ideas?
see PHP: Installation of PECL extensions.
Also take a look at the requirements of the SOLR extension module: http://docs.php.net/solr.requirements

Categories