我试图建造 php-5.3
关于arch linux
使用phpenv
+ php-build
。问题bison
太新了:
$ phpenv install 5.3.29
[Info]: Loaded apc Plugin.
[Info]: Loaded pyrus Plugin.
[Info]: Loaded xdebug Plugin.
[Info]: Loaded xhprof Plugin.
[Info]: php.ini-production gets used as php.ini
[Info]: Building 5.3.29 into /home/yuri/.phpenv/versions/5.3.29
[Downloading]: http://php.net/distributions/php-5.3.29.tar.bz2
[Preparing]: /tmp/php-build/source/5.3.29
-----------------
| BUILD ERROR |
-----------------
Here are the last 10 lines from the log:
-----------------------------------------
configure: warning: bison versions supported for regeneration of the Zend/PHP parsers: 1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1 2.4.2 2.4.3 2.5 2.5.1 2.6 2.6.1 2.6.2 2.6.4 (found: 3.0.2).
configure: warning: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
-----------------------------------------
The full Log is available at '/tmp/php-build.5.3.29.20141005234955.log'.
[Warn]: Aborting build.
所以我正在考虑bison
从源头构建并将其提供给php-build
.或者手动构建php
(如果有帮助的话)。有办法吗?
UPD好吧,我现在坚持添加openssl
支持。现在,我正在努力让简单configure
+make
工作,这就是他们的内容说:
$ ./configure --with-openssl && make
...
[1mConfiguring extensions[m
...
checking for OpenSSL support... yes
checking for Kerberos support... no
checking for DSA_get_default_method in -lssl... (cached) no
checking for X509_free in -lcrypto... (cached) yes
checking for pkg-config... (cached) /usr/bin/pkg-config
checking for PCRE library to use... bundled
...
/bin/sh /home/yuri/_/php-5.3.29/libtool --silent --preserve-dup-deps --mode=compile gcc -Iext/standard/ -I/home/yuri/_/php-5.3.29/ext/standard/ -DPHP_ATOM_INC -I/home/yuri/_/php-5.3.29/include -I/home/yuri/_/php-5.3.29/main -I/home/yuri/_/php-5.3.29 -I/home/yuri/_/php-5.3.29/ext/date/lib -I/home/yuri/_/php-5.3.29/ext/ereg/regex -I/usr/include/libxml2 -I/home/yuri/_/php-5.3.29/ext/sqlite3/libsqlite -I/home/yuri/_/php-5.3.29/TSRM -I/home/yuri/_/php-5.3.29/Zend -I/usr/include -g -O2 -fvisibility=hidden -c /home/yuri/_/php-5.3.29/ext/standard/info.c -o ext/standard/info.lo
/bin/sh /home/yuri/_/php-5.3.29/libtool --silent --preserve-dup-deps --mode=compile gcc -Imain/ -I/home/yuri/_/php-5.3.29/main/ -DPHP_ATOM_INC -I/home/yuri/_/php-5.3.29/include -I/home/yuri/_/php-5.3.29/main -I/home/yuri/_/php-5.3.29 -I/home/yuri/_/php-5.3.29/ext/date/lib -I/home/yuri/_/php-5.3.29/ext/ereg/regex -I/usr/include/libxml2 -I/home/yuri/_/php-5.3.29/ext/sqlite3/libsqlite -I/home/yuri/_/php-5.3.29/TSRM -I/home/yuri/_/php-5.3.29/Zend -I/usr/include -g -O2 -fvisibility=hidden -c main/internal_functions.c -o main/internal_functions.lo
/bin/sh /home/yuri/_/php-5.3.29/libtool --silent --preserve-dup-deps --mode=link gcc -export-dynamic -I/usr/include -g -O2 -fvisibility=hidden ext/date/php_date.lo ext/date/lib/astro.lo ext/date/lib/dow.lo ext/date/lib/parse_date.lo ext/date/lib/parse_tz.lo ext/date/lib/timelib.lo ext/date/lib/tm2unixtime.lo ext/date/lib/unixtime2tm.lo ext/date/lib/parse_iso_intervals.lo ext/date/lib/interval.lo ext/ereg/ereg.lo ext/ereg/regex/regcomp.lo ext/ereg/regex/regexec.lo ext/ereg/regex/regerror.lo ext/ereg/regex/regfree.lo ext/libxml/libxml.lo ext/openssl/openssl.lo ext/openssl/xp_ssl.lo ext/pcre/pcrelib/pcre_chartables.lo ext/pcre/pcrelib/pcre_ucd.lo ext/pcre/pcrelib/pcre_compile.lo ext/pcre/pcrelib/pcre_config.lo ext/pcre/pcrelib/pcre_exec.lo ext/pcre/pcrelib/pcre_fullinfo.lo ext/pcre/pcrelib/pcre_get.lo ext/pcre/pcrelib/pcre_globals.lo ext/pcre/pcrelib/pcre_maketables.lo ext/pcre/pcrelib/pcre_newline.lo ext/pcre/pcrelib/pcre_ord2utf8.lo ext/pcre/pcrelib/pcre_refcount.lo ext/pcre/pcrelib/pcre_study.lo ext/pcre/pcrelib/pcre_tables.lo ext/pcre/pcrelib/pcre_valid_utf8.lo ext/pcre/pcrelib/pcre_version.lo ext/pcre/pcrelib/pcre_xclass.lo ext/pcre/php_pcre.lo ext/sqlite3/sqlite3.lo ext/sqlite3/libsqlite/sqlite3.lo ext/ctype/ctype.lo ext/dom/php_dom.lo ext/dom/attr.lo ext/dom/document.lo ext/dom/domerrorhandler.lo ext/dom/domstringlist.lo ext/dom/domexception.lo ext/dom/namelist.lo ext/dom/processinginstruction.lo ext/dom/cdatasection.lo ext/dom/documentfragment.lo ext/dom/domimplementation.lo ext/dom/element.lo ext/dom/node.lo ext/dom/string_extend.lo ext/dom/characterdata.lo ext/dom/documenttype.lo ext/dom/domimplementationlist.lo ext/dom/entity.lo ext/dom/nodelist.lo ext/dom/text.lo ext/dom/comment.lo ext/dom/domconfiguration.lo ext/dom/domimplementationsource.lo ext/dom/entityreference.lo ext/dom/notation.lo ext/dom/xpath.lo ext/dom/dom_iterators.lo ext/dom/typeinfo.lo ext/dom/domerror.lo ext/dom/domlocator.lo ext/dom/namednodemap.lo ext/dom/userdatahandler.lo ext/fileinfo/fileinfo.lo ext/fileinfo/libmagic/apprentice.lo ext/fileinfo/libmagic/apptype.lo ext/fileinfo/libmagic/ascmagic.lo ext/fileinfo/libmagic/cdf.lo ext/fileinfo/libmagic/cdf_time.lo ext/fileinfo/libmagic/compress.lo ext/fileinfo/libmagic/encoding.lo ext/fileinfo/libmagic/fsmagic.lo ext/fileinfo/libmagic/funcs.lo ext/fileinfo/libmagic/is_tar.lo ext/fileinfo/libmagic/magic.lo ext/fileinfo/libmagic/print.lo ext/fileinfo/libmagic/readcdf.lo ext/fileinfo/libmagic/readelf.lo ext/fileinfo/libmagic/softmagic.lo ext/filter/filter.lo ext/filter/sanitizing_filters.lo ext/filter/logical_filters.lo ext/filter/callback_filter.lo ext/hash/hash.lo ext/hash/hash_md.lo ext/hash/hash_sha.lo ext/hash/hash_ripemd.lo ext/hash/hash_haval.lo ext/hash/hash_tiger.lo ext/hash/hash_gost.lo ext/hash/hash_snefru.lo ext/hash/hash_whirlpool.lo ext/hash/hash_adler32.lo ext/hash/hash_crc32.lo ext/hash/hash_salsa.lo ext/iconv/iconv.lo ext/json/json.lo ext/json/utf8_to_utf16.lo ext/json/utf8_decode.lo ext/json/JSON_parser.lo ext/pdo/pdo.lo ext/pdo/pdo_dbh.lo ext/pdo/pdo_stmt.lo ext/pdo/pdo_sql_parser.lo ext/pdo/pdo_sqlstate.lo ext/pdo_sqlite/pdo_sqlite.lo ext/pdo_sqlite/sqlite_driver.lo ext/pdo_sqlite/sqlite_statement.lo ext/phar/util.lo ext/phar/tar.lo ext/phar/zip.lo ext/phar/stream.lo ext/phar/func_interceptors.lo ext/phar/dirstream.lo ext/phar/phar.lo ext/phar/phar_object.lo ext/phar/phar_path_check.lo ext/posix/posix.lo ext/reflection/php_reflection.lo ext/session/session.lo ext/session/mod_files.lo ext/session/mod_mm.lo ext/session/mod_user.lo ext/simplexml/simplexml.lo ext/simplexml/sxe.lo ext/spl/php_spl.lo ext/spl/spl_functions.lo ext/spl/spl_engine.lo ext/spl/spl_iterators.lo ext/spl/spl_array.lo ext/spl/spl_directory.lo ext/spl/spl_exceptions.lo ext/spl/spl_observer.lo ext/spl/spl_dllist.lo ext/spl/spl_heap.lo ext/spl/spl_fixedarray.lo ext/sqlite/sqlite.lo ext/sqlite/sess_sqlite.lo ext/sqlite/pdo_sqlite2.lo ext/sqlite/libsqlite/src/opcodes.lo ext/sqlite/libsqlite/src/parse.lo ext/sqlite/libsqlite/src/encode.lo ext/sqlite/libsqlite/src/auth.lo ext/sqlite/libsqlite/src/btree.lo ext/sqlite/libsqlite/src/build.lo ext/sqlite/libsqlite/src/delete.lo ext/sqlite/libsqlite/src/expr.lo ext/sqlite/libsqlite/src/func.lo ext/sqlite/libsqlite/src/hash.lo ext/sqlite/libsqlite/src/insert.lo ext/sqlite/libsqlite/src/main.lo ext/sqlite/libsqlite/src/os.lo ext/sqlite/libsqlite/src/pager.lo ext/sqlite/libsqlite/src/printf.lo ext/sqlite/libsqlite/src/random.lo ext/sqlite/libsqlite/src/select.lo ext/sqlite/libsqlite/src/table.lo ext/sqlite/libsqlite/src/tokenize.lo ext/sqlite/libsqlite/src/update.lo ext/sqlite/libsqlite/src/util.lo ext/sqlite/libsqlite/src/vdbe.lo ext/sqlite/libsqlite/src/attach.lo ext/sqlite/libsqlite/src/btree_rb.lo ext/sqlite/libsqlite/src/pragma.lo ext/sqlite/libsqlite/src/vacuum.lo ext/sqlite/libsqlite/src/copy.lo ext/sqlite/libsqlite/src/vdbeaux.lo ext/sqlite/libsqlite/src/date.lo ext/sqlite/libsqlite/src/where.lo ext/sqlite/libsqlite/src/trigger.lo ext/standard/crypt_freesec.lo ext/standard/crypt_blowfish.lo ext/standard/crypt_sha512.lo ext/standard/crypt_sha256.lo ext/standard/php_crypt_r.lo ext/standard/array.lo ext/standard/base64.lo ext/standard/basic_functions.lo ext/standard/browscap.lo ext/standard/crc32.lo ext/standard/crypt.lo ext/standard/cyr_convert.lo ext/standard/datetime.lo ext/standard/dir.lo ext/standard/dl.lo ext/standard/dns.lo ext/standard/exec.lo ext/standard/file.lo ext/standard/filestat.lo ext/standard/flock_compat.lo ext/standard/formatted_print.lo ext/standard/fsock.lo ext/standard/head.lo ext/standard/html.lo ext/standard/image.lo ext/standard/info.lo ext/standard/iptc.lo ext/standard/lcg.lo ext/standard/link.lo ext/standard/mail.lo ext/standard/math.lo ext/standard/md5.lo ext/standard/metaphone.lo ext/standard/microtime.lo ext/standard/pack.lo ext/standard/pageinfo.lo ext/standard/quot_print.lo ext/standard/rand.lo ext/standard/soundex.lo ext/standard/string.lo ext/standard/scanf.lo ext/standard/syslog.lo ext/standard/type.lo ext/standard/uniqid.lo ext/standard/url.lo ext/standard/var.lo ext/standard/versioning.lo ext/standard/assert.lo ext/standard/strnatcmp.lo ext/standard/levenshtein.lo ext/standard/incomplete_class.lo ext/standard/url_scanner_ex.lo ext/standard/ftp_fopen_wrapper.lo ext/standard/http_fopen_wrapper.lo ext/standard/php_fopen_wrapper.lo ext/standard/credits.lo ext/standard/css.lo ext/standard/var_unserializer.lo ext/standard/ftok.lo ext/standard/sha1.lo ext/standard/user_filters.lo ext/standard/uuencode.lo ext/standard/filters.lo ext/standard/proc_open.lo ext/standard/streamsfuncs.lo ext/standard/http.lo ext/tokenizer/tokenizer.lo ext/tokenizer/tokenizer_data.lo ext/xml/xml.lo ext/xml/compat.lo ext/xmlreader/php_xmlreader.lo ext/xmlwriter/php_xmlwriter.lo TSRM/TSRM.lo TSRM/tsrm_strtok_r.lo TSRM/tsrm_virtual_cwd.lo main/main.lo main/snprintf.lo main/spprintf.lo main/php_sprintf.lo main/safe_mode.lo main/fopen_wrappers.lo main/alloca.lo main/php_scandir.lo main/php_ini.lo main/SAPI.lo main/rfc1867.lo main/php_content_types.lo main/strlcpy.lo main/strlcat.lo main/mergesort.lo main/reentrancy.lo main/php_variables.lo main/php_ticks.lo main/network.lo main/php_open_temporary_file.lo main/php_logos.lo main/output.lo main/getopt.lo main/streams/streams.lo main/streams/cast.lo main/streams/memory.lo main/streams/filter.lo main/streams/plain_wrapper.lo main/streams/userspace.lo main/streams/transports.lo main/streams/xp_socket.lo main/streams/mmap.lo main/streams/glob_wrapper.lo Zend/zend_language_parser.lo Zend/zend_language_scanner.lo Zend/zend_ini_parser.lo Zend/zend_ini_scanner.lo Zend/zend_alloc.lo Zend/zend_compile.lo Zend/zend_constants.lo Zend/zend_dynamic_array.lo Zend/zend_execute_API.lo Zend/zend_highlight.lo Zend/zend_llist.lo Zend/zend_opcode.lo Zend/zend_operators.lo Zend/zend_ptr_stack.lo Zend/zend_stack.lo Zend/zend_variables.lo Zend/zend.lo Zend/zend_API.lo Zend/zend_extensions.lo Zend/zend_hash.lo Zend/zend_list.lo Zend/zend_indent.lo Zend/zend_builtin_functions.lo Zend/zend_sprintf.lo Zend/zend_ini.lo Zend/zend_qsort.lo Zend/zend_multibyte.lo Zend/zend_ts_hash.lo Zend/zend_stream.lo Zend/zend_iterators.lo Zend/zend_interfaces.lo Zend/zend_exceptions.lo Zend/zend_strtod.lo Zend/zend_gc.lo Zend/zend_closures.lo Zend/zend_float.lo Zend/zend_objects.lo Zend/zend_object_handlers.lo Zend/zend_objects_API.lo Zend/zend_default_classes.lo Zend/zend_execute.lo sapi/cgi/cgi_main.lo sapi/cgi/fastcgi.lo main/internal_functions.lo -lcrypt -lresolv -lcrypt -lrt -lrt -lm -ldl -lnsl -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl -lcrypt -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl -lcrypt -o sapi/cgi/php-cgi
ext/openssl/openssl.o: In function `zm_startup_openssl':
/home/yuri/_/php-5.3.29/ext/openssl/openssl.c:992: undefined reference to `SSL_library_init'
/home/yuri/_/php-5.3.29/ext/openssl/openssl.c:993: undefined reference to `OpenSSL_add_all_ciphers'
/home/yuri/_/php-5.3.29/ext/openssl/openssl.c:994: undefined reference to `OpenSSL_add_all_digests'
/home/yuri/_/php-5.3.29/ext/openssl/openssl.c:995: undefined reference to `OPENSSL_add_all_algorithms_noconf'
/home/yuri/_/php-5.3.29/ext/openssl/openssl.c:997: undefined reference to `ERR_load_ERR_strings'
...
/home/yuri/_/php-5.3.29/ext/openssl/xp_ssl.c:559: undefined reference to `X509_dup'
/home/yuri/_/php-5.3.29/ext/openssl/xp_ssl.c:558: undefined reference to `sk_num'
/home/yuri/_/php-5.3.29/ext/openssl/xp_ssl.c:519: undefined reference to `SSL_shutdown'
ext/openssl/xp_ssl.o: In function `php_openssl_setup_crypto':
/home/yuri/_/php-5.3.29/ext/openssl/xp_ssl.c:397: undefined reference to `SSL_CTX_free'
collect2: error: ld returned 1 exit status
Makefile:243: recipe for target 'sapi/cgi/php-cgi' failed
make: *** [sapi/cgi/php-cgi] Error 1
据说问题出在这一行:
checking for DSA_get_default_method in -lssl... (cached) no
但我实在不知道如何补救。我已经openssl 1.0.1.i-1
安装了软件包,如果有的话。
答案1
诀窍是到安装 最新openssl-0.9.x
版本,显然php-5.3
不适用于openssl-1.x
其中之一。然后:
PHP_BUILD_CONFIGURE_OPTS=--with-openssl=/usr/local/ssl phpenv install 5.3.29
还,可能有必要指定mysqli.default_socket = /run/mysqld/mysqld.sock
在~/.phpenv/versions/5.3.29/etc/php.ini
.否则,php
说:
PHP Warning: mysqli_connect(): [2002] No such file or directory (trying to connect via unix:///tmp/mysql.sock) in /home/yuri/_/1.php on line 2
PHP Stack trace:
PHP 1. {main}() /home/yuri/_/1.php:0
PHP 2. mysql_connect() /home/yuri/_/1.php:2
PHP Warning: mysqli_connect(): (HY000/2002): No such file or directory in /home/yuri/_/1.php on line 2
PHP Stack trace:
PHP 1. {main}() /home/yuri/_/1.php:0
PHP 2. mysqli_connect() /home/yuri/_/1.php:2
bool(false)
剧本:
<?php
$r = mysqli_connect('localhost', '<USER>', '<PASS>');
var_dump($r);
UPD解决此问题的另一种方法是再传递一个选项来配置:
PHP_BUILD_CONFIGURE_OPTS='--with-openssl=/usr/local/ssl --with-mysql-sock' phpenv install 5.3.29