6

I am trying to get the xmlrpc extension to work for php5 in MAMP (1.8.4).

I checked what version of PHP 5 was installed:

$ /Applications/MAMP/bin/php5/bin/php -v
PHP 5.2.11 (cli) (built: Dec 12 2009 13:19:08) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
    with Zend Extension Manager v1.2.2, Copyright (c) 2003-2007, by Zend Technologies
    with Zend Optimizer v3.3.9, Copyright (c) 1998-2009, by Zend Technologies

I downloaded the PHP 5.2.11 source bundles, and built a shared library for xmlrpc:

$ LIBS=-lresolv ./configure --prefix=/opt --with-xmlrpc=shared
$ make
$ ls modules
xmlrpc.a    xmlrpc.la   xmlrpc.so

I copied these files into MAMP:

$ cp modules/* /Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20060613/

I added the extension setting to the ini file:

$ vi /Applications/MAMP/conf/php5/php.ini
  extension=xmlrpc.so

I restarted MAMP:

$ ./bin/stop.sh
$ ./bin/start.sh

When I do a phpinfo the only reference to xmlrpc I find is in the PHP Core section:

xmlrpc_error_number => 0 => 0
xmlrpc_errors => Off => Off

I am trying to install Moodle and it still tells me that the xmlrpc extension is not available.

I'm a PHP novice, so if someone could tell me how to confirm the extension is available or not that would be great, or at least some pointers on how to debug this further.

Thanks.

UPDATE: I found the PHP log file and it has the following entry:

[08-Jan-2010 23:37:52] PHP Warning:  PHP Startup: Unable to load dynamic \
    library '/Applications/MAMP/bin/php5/lib/php/extensions/ \
    no-debug-non-zts- 20060613/xmlrpc.so' - (null) in Unknown on line 0
John Keyes
  • 5,479
  • 1
  • 29
  • 48

4 Answers4

4

This way worked for me:

  • Downloaded Moodle4Mac (Moodle is a software that needs PHP and xmlrpc, and it comes with a built-in XAMPP);
  • Copied xmlrpc.so from that package (mine was under /Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626) to MAMP's PHP extension folder (mine is /Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/);
  • Added extension=xmlrpc.so to PHP.INI.

Restarted MAMP and that was it. Hope it helps! :-)

chesterbr
  • 2,940
  • 3
  • 29
  • 26
  • Thanks Chester, was hoping to build it myself though. – John Keyes Jan 27 '11 at 17:15
  • Yeah, it would be the best solution. But after pulling lots of my nearly non-existent hair trying to do it, I gave up and started digging for a ready-made. If you find out how to build it, please let us know! – chesterbr Feb 08 '11 at 02:08
  • Can you share the single xmlrpc.so file? It should be a few KB and it will be helpful for slow connections, since Moodle is 142MB. Thanks. – Tom Roggero Jul 02 '12 at 05:05
  • I've tried this solution and didn't work. Still waiting for the .so file as an alternative solution – Tom Roggero Jul 02 '12 at 05:22
  • I tried this solution and it didn't work. I assume it has something to do with both programs updating. Moodle4Mac now uses php 5.3.2 and MAMP uses php 5.4.4. I can't download the old xmlrpc.so file so here's the [xmlrpc.so file](http://www.filedropper.com/xmlrpc) I just created from Moodle4Mac. – BFTrick Mar 12 '13 at 16:32
  • Previous links are dead, a new one: [xmlrpc.so](https://www.mediafire.com/?0ryh0x8fznhvv46) – brasofilo Jun 07 '14 at 18:12
  • I tried the steps above with PHP 5.5.10 and MAMP on OSX Mavericks, but xmlrpc_encode_request method is still not returning anything. I've tried using xmlrpc_encode_request method on a standard Apache install and it works fine. Does the steps above work with PHP 5.5.10? – Josh Aug 04 '14 at 19:58
  • Most likely not. The build version should match the minor PHP version number, and Moodle is unlkely to have upgraded to PHP 5.5. You could try to find another app that has xmlrpc.so packed in and uses PHP 5.5 - although the best solution would be to actually build it... :-( – chesterbr Aug 06 '14 at 19:50
0

Are you using the MAMP bundle package from moodle website? http://download.moodle.org/download.php/macosx/Moodle4Mac-XAMPP-20.dmg This one should work.

The reason PHP failed to load extension may cause by architecture type, PHP and its extension must use the same architecture type parameter in CFLAG.

I was having similar problem, but I wasn't using MAMP, I compiled PHP using static linking, sometimes, Mac OS X has weired problem to load dynamic library.

dcai
  • 2,557
  • 3
  • 20
  • 37
  • I already had MAMP on my machine so wanted to install into it. I don't know anything about CFLAGS, but is there a way to find out what CFLAG was used to build the version of PHP shipped with MAMP? (Maybe I should ask on a MAMP list). – John Keyes Jan 09 '10 at 13:32
  • Yeah. I'm having the '/Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/xmlrpc.so: no matching architecture in universal wrapper in Unknown on line 0' creepy error... How did you figure out to fix it? – Tom Roggero Jul 02 '12 at 05:23
  • Any solution on this? Im getting same problem as you :S – chifliiiii Aug 06 '12 at 18:25
  • I tried to use this solution but PHP gave me an error : "no matching architecture in universal wrapper in Unknown on line 0". But I could make this work using a compiled extension by tim st.clair. Can be downloaded at this link, attached to the message: [link](https://moodle.org/mod/forum/discuss.php?d=244879) A important detail is that MAMP have a lot of php.ini files that make me confused about wich one should be edited. In my case, what works for me was in the path : /Applications/MAMP/conf/php5.3.27. Hope this help. – Lano Jul 15 '14 at 21:36
0

Just be sure to move the xmlrpc.so file to the location /Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/ (PHP version could be also 5.4 or 5.5) Then restart MAMP Then in your moodle install just click continue, it will still say that you should check the installation just continue. It will start installing and will finish installing all modules and components, when all installed press Command F (MAC) or Control F (Win) and search for xmlrpc.so You will see that is succeed, so don't worry, it will work.

Wcatter
  • 127
  • 1
  • 1
  • 10
0
  1. Download MAMP components from sourceforge http://sourceforge.net/projects/mamp/files/mamp/2.1.2/
  2. Extract the zip file
  3. Inside the extracted folder you will see several php archives. Extract the one corresponding to your installed version. (In my case, my installed version was 5.5.9, but the highest version available from mamp components was 5.4.4 so I used that since I was going to build the source myself anyway).
  4. From terminal cd into the ext folder of the php folder you extracted and then cd into the xmlrpc folder.
  5. Run the following commands from terminal

    ./configure

    make

  6. If successful, copy xmlrpc.so from the builds folder to the extensions folder of your php installation.
  7. Add extension=xmlrpc.so to php.ini
Omoloro
  • 342
  • 1
  • 3
  • 9