PHP   发布时间:2022-04-04  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了向MAMP添加GMP PHP扩展大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

试图将MAMP 3.4与最新版本的PHP(5.6.10)结合使用,但是我需要PHP扩展GMP.我的理解是,该扩展不是一个单独的模块,而是需要使用–with-gmp完全重新编译PHP.

尝试使用干净的5.6.10源代码遵循the guide linked here,但OP遇到相同的错误

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

解决方法:

原来,您需要来自httpd的一些关键文件才能将PHP构建为Apache模块(如MAMP所要求). MAMP会从安装中忽略那些文件.

>从http://mirror.reverse.net/pub/apache/httpd/下载Apache
确保您下载的版本与MAMP发行版中的版本相同.您可以从命令行键入/ Applications / MAMP / Library / bin / httpd -version来查找.
>解压发行版并CD进入.
>在某处放置一个文件夹以存储构建结果.我们会将文件放在〜/ Desktop / build / httpd之类的桌面上.
>下一步是构建httpd.像./configure –prefix = / Users / [用户名] / Desktop / build / httpd –enable这样的东西应该可以解决.请注意,安装路径必须是绝对路径,因此我们不能在此处使用波浪号字符.
>一旦配置完成且没有任何错误,请进行安装.您现在拥有了从源代码编译的Apache服务器.恭喜!
>从该版本中,我们需要@L_335_54@mAMP安装中缺少的文件.这实际上是一个位于〜/ Desktop / build / httpd / build的目录.将其复制到/ Applications / MAMP / Library中,您现在就可以构建PHP,而不会出现上述错误消息.确保复制目录并且不要移动它.稍后在PHP编译期间将需要它.

下一步是编译PHP本身:

>从http://PHP.net/downloads.PHP下载PHP代码.
确保下载的是您要替换的相@R_848_11197@(您可以在/ Applications / MAMP / bin / PHP中找到MAMP存储的所有版本.在我的情况下,我正在构建5.6.10.
>解压发行版并CD进入.
>在某处放置一个文件夹以存储构建结果.我再次将结果放在〜/ Desktop / build / PHP中的桌面上.
>配置PHP以使用./configure –with-apxs2 = / Applications / MAMP / Library / bin / apxs –prefix = / Users / [用户名] / Desktop / build / PHP –with-构建所需的内容openssl –without-iconv.如果您愿意,可以查看现有的PHPinfo页面以了解要替换的版本,以了解其编译时所用的版本.请记住,某些模块将要求您从其他一些库的源副本中构建.
>进行安装.
>您现在有了一个可与MAMP一起使用的PHP共享对象.@L_641_78@mAMP,将〜/ Dekstop / build / httpd / modules / libPHP5.so复制到/Applications/MAMP/bin/PHP/PHP5.6.10/modules并重新启动.保留以前的libPHP5.so文件的副本并不是一个坏主意,以防万一.

大佬总结

以上是大佬教程为你收集整理的向MAMP添加GMP PHP扩展全部内容,希望文章能够帮你解决向MAMP添加GMP PHP扩展所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: