/    Sign up×
Community /Pin to ProfileBookmark

Fatal error: Class ‘SoapClient’ not found

Hi, Am trying to run a script locally on my mac from the terminal. I am getting this error:

Fatal error: Class ‘SoapClient’ not found in /path/test.php on line 2

I am using Mamp Pro. I have tried adding “extension=php_soap.so” to the php.ini file, but am still getting the error.

Can anyone advise on what i can do, or tell me how I can check to confirm that the Soap library is installed?

Thanks in advance.

to post a comment
PHP

14 Comments(s)

Copy linkTweet thisAlerts:
@SrWebDeveloperDec 16.2009 — Did you restart Apache in MAMP so changes to php.ini are picked up?

If still error, post relevant code please.

-jim
Copy linkTweet thisAlerts:
@coldscooterauthorDec 16.2009 — If i run the php info from MAMP (opens in a browser) i get:

PHP Version 5.2.11

Configure Command

'./configure' '--with-mysql=/Applications/MAMP/Library' '--with-apxs2=/Applications/MAMP/Library/bin/apxs' '--with-gd' '--with-jpeg-dir=/Applications/MAMP/Library' '--with-png-dir=/Applications/MAMP/Library' '--with-zlib' '--with-freetype-dir=/Applications/MAMP/Library' '--prefix=/Applications/MAMP/bin/php5' '--exec-prefix=/Applications/MAMP/bin/php5' '--sysconfdir=/Applications/MAMP/conf/php5' '--with-soap' '--with-config-file-path=/Applications/MAMP/conf/php5' '--enable-track-vars' '--enable-bcmath' '--enable-ftp' '--enable-gd-native-ttf' '--with-bz2=/usr' '--with-ldap' '--with-mysqli=/Applications/MAMP/Library/bin/mysql_config' '--with-sqlite' '--with-ttf' '--with-t1lib=/Applications/MAMP/Library' '--enable-mbstring=all' '--with-curl=/Applications/MAMP/Library' '--enable-dbx' '--enable-sockets' '--enable-bcmath' '--with-imap=shared,/Applications/MAMP/Library/lib/imap-2007e' '--enable-soap' '--with-kerberos' '--enable-calendar' '--with-pgsql=shared,/Applications/MAMP/Library/pg' '--enable-dbase' '--enable-exif' '--with-libxml-dir=/Applications/MAMP/Library' '--with-gettext=shared,/Applications/MAMP/Library' '--with-xsl=/Applications/MAMP/Library' '--with-pdo-mysql=shared,/Applications/MAMP/Library' '--with-pdo-pgsql=shared,/Applications/MAMP/Library/pg' '--with-mcrypt=shared,/Applications/MAMP/Library' '--with-openssl'


But if i run "php -i" from the terminal i get:

PHP Version => 5.2.11

Configure Command => '/SourceCache/apache_mod_php/apache_mod_php-44.4/php/configure' '--prefix=/usr' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-dependency-tracking' '--with-apxs2=/usr/sbin/apxs' '--with-ldap=/usr' '--with-kerberos=/usr' '--enable-cli' '--with-zlib-dir=/usr' '--enable-trans-sid' '--with-xml' '--enable-exif' '--enable-ftp' '--enable-mbstring' '--enable-mbregex' '--enable-dbx' '--enable-sockets' '--with-iodbc=/usr' '--with-curl=/usr' '--with-config-file-path=/etc' '--sysconfdir=/private/etc' '--with-mysql-sock=/var/mysql' '--with-mysqli=/usr/bin/mysql_config' '--with-mysql=/usr' '--with-openssl' '--with-xmlrpc' '--with-xsl=/usr' '--without-pear'

Why does the one opened from MAMP have the --enable-soap but not from the one in the terminal?? And how do I enable soap for the settings when using the terminal?

Cheers
Copy linkTweet thisAlerts:
@criterion9Dec 16.2009 — Do you have two php.ini versions perhaps?
Copy linkTweet thisAlerts:
@coldscooterauthorDec 16.2009 — I actually have 3 php.ini's on my computer for php5. But all have "extension=soap.so", so i can't see why in the terminal it wouldn't be set.
Copy linkTweet thisAlerts:
@SrWebDeveloperDec 16.2009 — Other than MAMP weirdness....

Part of the "php -i" output includes system and build date information. To compare all the PHP's installed on your Mac type in "locate php | grep bin/php" in Terminal to see where all the CLI php's are including path, the compare each as you did before (-i) but using the path for each. BTW, "which php" reveals the path of the one you used when you typed in "php -i" without specifying the path the first time. That's the one found in the system path.

The CLI versions of each may have been built differently.

-jim
Copy linkTweet thisAlerts:
@coldscooterauthorDec 16.2009 — The terminal php -i is saying the exact same date and time as the one coming up from mamp in the browser... So why would it have less under the 'Configure Command'?
Copy linkTweet thisAlerts:
@coldscooterauthorDec 16.2009 — Oops my mistake. No they do have different build dates. The one showing in the terminal is earlier by a month. How can I fix this?
Copy linkTweet thisAlerts:
@SrWebDeveloperDec 16.2009 — Uncommenting the line in the correct php.ini to enable the soap extension in MAMP should be the fix, it sounds like. I wrote earlier, "Did you restart Apache in MAMP so changes to php.ini are picked up?" and you never responded to that.
Copy linkTweet thisAlerts:
@coldscooterauthorDec 16.2009 — Yes i did try that and still the same problem. Also, mamp is showing that soap is enabled when i run phpinfo() from it's interface. It is when executing code from the terminal which is when I'm having the problems.
Copy linkTweet thisAlerts:
@SrWebDeveloperDec 16.2009 — On *nix systems PHP is both installed as an Apache module for HTTP, and also as a separate CLI version used only for shell scripting. Both use the same php.ini. I don't know enough under the hood regarding how MAMP works. Maybe a MAMP guru can join in and confirm it is setup like *nix as I noted.

[B]If they confirm that...[/B]

I doubt your web based script is using the CLI version so any weirdness doesn't matter. If it was, you'd use an exec or system call which seems silly, calling PHP CLI from within PHP! So I know you found weirdness with the CLI version, but simply forget about it. Let's refocus on the real issue at hand, the HTTP version of PHP which shows the extension loaded. If all this is true, at this point you're down to two likely causes:

1) MAMP bug loading SOAP extension

2) Your code

If MAMP is installed differently and a MAMP guru can't help you here, time to visit the MAMP support forum or contact their tech support.

-jim
Copy linkTweet thisAlerts:
@coldscooterauthorDec 16.2009 — Apparently the CLI uses it's own version of PHP separate to MAMP. This link seems like it can help me. http://forum.mamp.info/viewtopic.php?p=2021&sid=acf7ca390a5716d954dbe7181d4302a1

It says to make a symbolic link to the MAMP php version:

[Make the symbollic link]:

$ ln -s /Applications/MAMP/bin/php5/bin/php /usr/bin/php

Problem is, it then says for me: "File exists".. So I am still stuck.
Copy linkTweet thisAlerts:
@SrWebDeveloperDec 16.2009 — But I can run php files from the terminal without mamp even running. Just don't have any mysql then...[/quote]

For the record, I've offered my suggestion for the problem in your OP, what follows is in response to your latest query which is a side issue. If you need to access your database via PHP5 CLI the support can be added during compilation via:

'--with-mysql' '--with-mysqli'[/QUOTE]

You can also use php -m to list compiled in versions to double check what's in your CLI or not.

-jim
Copy linkTweet thisAlerts:
@coldscooterauthorDec 16.2009 — So I guess my revised question is how do i modify the 'Configure Command' for the terminal?
Copy linkTweet thisAlerts:
@SrWebDeveloperDec 16.2009 — Only since you asked...

I wish to emphasize this has nothing to do with MAMP which handles the installation for you, nor does it have anything to do with the advice I offered earlier to resolve MAMP. With that disclaimer noted, to manually compile any Linux source distribution, i.e. PHP source downloaded from php.net, a beginner's guide can be found here:

http://www.tuxfiles.org/linuxhelp/softinstall.html

Step 2 deals with your specific question and the two mysql compile options I listed in the earlier reply are passed as arguments to ./configure if that version of PHP doesn't enable it by default. If you have no idea what I just said you should not be doing this. So I close with...

[B]Warning:[/B] This is a good way to mess up your Mac if you don't know what you're doing. This is not for novices, Linux experience is a must as most guides like this one assume no errors occur during the many steps involved and offer limited to zero help if they do occur.

Need to scoot. Cheers.

-jim
×

Success!

Help @coldscooter spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.25,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...