简体   繁体   English

PHP xmlrpc扩展和MAMP

[英]PHP xmlrpc extension and MAMP

I am trying to get the xmlrpc extension to work for php5 in MAMP (1.8.4). 我试图让xmlrpc扩展适用于MAMP(1.8.4)中的php5。

I checked what version of PHP 5 was installed: 我检查了安装了什么版本的PHP 5:

$ /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: 我下载了PHP 5.2.11源代码包,并为xmlrpc构建了一个共享库:

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

I copied these files into MAMP: 我将这些文件复制到MAMP中:

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

I added the extension setting to the ini file: 我将扩展设置添加到ini文件中:

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

I restarted MAMP: 我重启了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: 当我执行phpinfo ,我发现的唯一对xmlrpc引用是在PHP Core部分中:

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. 我正在尝试安装Moodle,它仍然告诉我xmlrpc扩展名不可用。

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. 我是一个PHP新手,所以如果有人可以告诉我如何确认扩展是否可用,那将是非常好的,或者至少有一些关于如何进一步调试的指针。

Thanks. 谢谢。

UPDATE : I found the PHP log file and it has the following entry: 更新 :我找到了PHP日志文件,它有以下条目:

[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

This way worked for me: 这种方式对我有用:

  • Downloaded Moodle4Mac (Moodle is a software that needs PHP and xmlrpc, and it comes with a built-in XAMPP); 下载的Moodle4Mac (Moodle是一个需要PHP和xmlrpc的软件,它带有一个内置的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/ ); 从该软件包(我的/Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626 )复制xmlrpc.so到MAMP的PHP扩展文件夹(我的是/Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/ );
  • Added extension=xmlrpc.so to PHP.INI . extension=xmlrpc.so添加到PHP.INI

Restarted MAMP and that was it. 重启MAMP,就是这样。 Hope it helps! 希望能帮助到你! :-) :-)

Are you using the MAMP bundle package from moodle website? 您是否正在使用moodle网站的MAMP捆绑包? http://download.moodle.org/download.php/macosx/Moodle4Mac-XAMPP-20.dmg This one should work. http://download.moodle.org/download.php/macosx/Moodle4Mac-XAMPP-20.dmg这个应该可行。

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. PHP无法加载扩展的原因可能是由于体系结构类型,PHP及其扩展必须在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. 我有类似的问题,但我没有使用MAMP,我使用静态链接编译PHP,有时,Mac OS X已经遇到了加载动态库的问题。

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. 只需确保将xmlrpc.so文件移动到/Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/(PHP版本也可以是5.4或5.5)然后重新启动MAMP然后在你的moodle安装中点击继续,它仍然会说你应该继续检查安装。 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. 它将开始安装并将完成所有模块和组件的安装,当所有安装时按下命令F(MAC)或控制F(Win)并搜索xmlrpc.so您将看到成功,所以不用担心,它会工作。

  1. Download MAMP components from sourceforge http://sourceforge.net/projects/mamp/files/mamp/2.1.2/ 从sourceforge下载MAMP组件http://sourceforge.net/projects/mamp/files/mamp/2.1.2/
  2. Extract the zip file 解压缩zip文件
  3. Inside the extracted folder you will see several php archives. 在解压缩的文件夹中,您将看到几个php档案。 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). (在我的例子中,我安装的版本是5.5.9,但是mamp组件提供的最高版本是5.4.4,所以我使用它,因为我打算自己构建源代码)。
  4. From terminal cd into the ext folder of the php folder you extracted and then cd into the xmlrpc folder. 从终端cd进入你解压缩的php文件夹的ext文件夹,然后cd进入xmlrpc文件夹。
  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. 如果成功,请将xmlrpc.so从builds文件夹复制到php安装的extensions文件夹中。
  7. Add extension=xmlrpc.so to php.ini 将extension = xmlrpc.so添加到php.ini

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM