dq_1984 2015-09-28 19:40
浏览 466
已采纳

将GMP PHP扩展添加到MAMP

Trying to use MAMP 3.4 with the latest version of PHP currently on there (5.6.10) but I need the PHP extension GMP. My understanding is that that extension is not a separate module but requires a complete re-compile of PHP with --with-gmp.

Trying to follow the guide linked here with clean 5.6.10 source code but I get the same error the OP is having:

Didiers-MacBook-Pro:php-5.6.10 didier$ ./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-2006i --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=/Applications/MAMP/Library --with-pdo-pgsql=shared,/Applications/MAMP/Library/pg --with-mcrypt=shared,/Applications/MAMP/Library --with-openssl --with-gmp --without-iconv --prefix=/Users/Didier/Desktop/result
configure: WARNING: unrecognized options: --with-soap, --enable-track-vars, --with-sqlite, --with-ttf, --enable-dbx, --enable-dbase
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking build system type... x86_64-apple-darwin14.5.0
checking host system type... x86_64-apple-darwin14.5.0
checking target system type... x86_64-apple-darwin14.5.0
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking how to run the C preprocessor... cc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether ln -s works... yes
checking for system library directory... lib
checking whether to enable runpaths... yes
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking for bison... bison -y
checking for bison version... invalid
configure: WARNING: This bison version is not supported for regeneration of the Zend/PHP parsers (found: 2.3, min: 204, excluded: 3.0).
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking whether to enable computed goto gcc extension with re2c... no
checking whether cc supports -no-cpp-precomp... yes
checking whether to force non-PIC code in shared modules... no
checking whether /dev/urandom exists... yes
checking for pthreads_cflags... 
checking for pthreads_lib... 

Configuring SAPI modules
checking for AOLserver support... no
checking for Apache 1.x module support via DSO through APXS... no
checking for Apache 1.x module support... no
checking whether to enable Apache charset compatibility option... no
checking for Apache 2.0 filter-module support via DSO through APXS... no
checking for Apache 2.0 handler-module support via DSO through APXS... 

Sorry, I cannot run apxs.  Possible reasons follow:

1. Perl is not installed
2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs
3. Apache was not built using --enable-so (the apxs usage page is displayed)

The output of /Applications/MAMP/Library/bin/apxs follows:
cannot open /Applications/MAMP/Library/build/config_vars.mk: No such file or directory at /Applications/MAMP/Library/bin/apxs line 217.
configure: error: Aborting
  • 写回答

1条回答 默认 最新

  • douqin2108 2015-09-29 05:06
    关注

    Turns out that you need some critical files from httpd in order to build php as a Apache modules (as MAMP requires). MAMP ommits those files from the install.

    1. Download Apache from http://mirror.reverse.net/pub/apache/httpd/ Make sure that the version you're downloading is the same one found in the MAMP distribution. You can type /Applications/MAMP/Library/bin/httpd -version from the command line in order to find out.
    2. Un-tar the distribution and cd into it.
    3. Make a folder somewhere to store the build results. We'll put our files on the desktop, in something like ~/Desktop/build/httpd.
    4. Next step is to build httpd. Something like ./configure --prefix=/Users/[username]/Desktop/build/httpd --enable-so should do the trick. Note the the install path needs to be absolute so we can't use the tilde character here.
    5. Once configuration is finished and without any errors, make and then make install. You now have a Apache server compiled from source. Congrats!
    6. From that build, we need to grab the files missing from our MAMP install. This is actually a single directory located at ~/Desktop/build/httpd/build. Copy this into /Applications/MAMP/Library and you will now be able to build PHP without that aforementioned error message. Make sure that you copy the directory and don't move it. You will need it later during the PHP compilation.

    Next step is to compile PHP itself:

    1. Download the PHP source from http://php.net/downloads.php. Make sure that you are downloading the same version that you're trying to replace (you can find all the versions MAMP has in store in /Applications/MAMP/bin/php. In my case I'm building 5.6.10.
    2. Un-tar the distribution and cd into it.
    3. Make a folder somewhere to store the build results. Once again, I'm putting my results on my desktop in ~/Desktop/build/php.
    4. Configure PHP to build what you need with something like ./configure --with-apxs2=/Applications/MAMP/Library/bin/apxs --prefix=/Users/[username]/Desktop/build/php --with-openssl --without-iconv. If you want you can look at the existing phpinfo page for the version you're replacing to find out what it was compiled with. Keep in mind that some modules will require you to have built from source copies of some other libraries.
    5. make and make install.
    6. You now have a shared object for php that you can use with MAMP. Close MAMP, copy ~/Dekstop/build/httpd/modules/libphp5.so into /Applications/MAMP/bin/php/php5.6.10/modules and restart it. Keeping a copy of the previous libphp5.so file is not a bad idea just in case things go south.
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 这种微信登录授权 谁可以做啊
  • ¥15 请问我该如何添加自己的数据去运行蚁群算法代码
  • ¥20 用HslCommunication 连接欧姆龙 plc有时会连接失败。报异常为“未知错误”
  • ¥15 网络设备配置与管理这个该怎么弄
  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来