www.webdeveloper.com
Results 1 to 15 of 15

Thread: Fatal error: Class 'SoapClient' not found

  1. #1
    Join Date
    Jun 2008
    Posts
    207

    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.

  2. #2
    Join Date
    Jul 2009
    Location
    Falls Church, Va.
    Posts
    780
    Did you restart Apache in MAMP so changes to php.ini are picked up?

    If still error, post relevant code please.

    -jim

  3. #3
    Join Date
    Jun 2008
    Posts
    207
    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

  4. #4
    Join Date
    Jan 2009
    Posts
    3,346
    Do you have two php.ini versions perhaps?

  5. #5
    Join Date
    Jun 2008
    Posts
    207
    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.
    Last edited by coldscooter; 12-16-2009 at 01:53 PM.

  6. #6
    Join Date
    Jul 2009
    Location
    Falls Church, Va.
    Posts
    780
    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
    Last edited by SrWebDeveloper; 12-16-2009 at 02:06 PM. Reason: clarification

  7. #7
    Join Date
    Jun 2008
    Posts
    207
    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'?

  8. #8
    Join Date
    Jun 2008
    Posts
    207
    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?
    Last edited by coldscooter; 12-16-2009 at 02:16 PM.

  9. #9
    Join Date
    Jul 2009
    Location
    Falls Church, Va.
    Posts
    780
    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.

  10. #10
    Join Date
    Jun 2008
    Posts
    207
    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.
    Last edited by coldscooter; 12-16-2009 at 02:34 PM.

  11. #11
    Join Date
    Jul 2009
    Location
    Falls Church, Va.
    Posts
    780
    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.

    If they confirm that...

    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
    Last edited by SrWebDeveloper; 12-16-2009 at 02:47 PM.

  12. #12
    Join Date
    Jun 2008
    Posts
    207
    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...dbe7181d4302a1

    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.
    Last edited by coldscooter; 12-16-2009 at 03:07 PM.

  13. #13
    Join Date
    Jul 2009
    Location
    Falls Church, Va.
    Posts
    780
    Quote Originally Posted by coldscooter View Post
    But I can run php files from the terminal without mamp even running. Just don't have any mysql then...
    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'
    You can also use php -m to list compiled in versions to double check what's in your CLI or not.

    -jim

  14. #14
    Join Date
    Jun 2008
    Posts
    207
    So I guess my revised question is how do i modify the 'Configure Command' for the terminal?

  15. #15
    Join Date
    Jul 2009
    Location
    Falls Church, Va.
    Posts
    780
    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...

    Warning: 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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles