php - 从源代码编译PHP时为OpenSSL出错

标签 php compilation compiler-errors openssl makefile

我曾尝试在Ubuntu Hardy x86_64上从源代码编译PHP 5.3.10和5.6.7(我知道,它很旧)。以下是我使用的configure语句:

./configure  
--prefix=/opt/php5
--with-config-file-path=/opt/php5/etc 
--with-curl 
--with-pear 
--with-gd 
--with-jpeg-dir 
--with-png-dir 
--with-zlib 
--with-xpm-dir 
--with-freetype-dir 
--with-t1lib 
--with-mcrypt 
--with-mhash 
--with-mysql 
--with-mysqli 
--with-pdo-mysql 
--with-xmlrpc 
--with-xsl 
--with-bz2 
--with-gettext 
--with-fpm-user=www-data 
--with-fpm-group=www-data 
--enable-fpm 
--enable-exif 
--enable-wddx 
--enable-zip 
--enable-bcmath 
--enable-calendar 
--enable-ftp 
--enable-mbstring 
--enable-soap 
--enable-sockets 
--enable-sqlite-utf8 
--enable-shmop 
--enable-dba 
--enable-sysvmsg 
--enable-sysvsem 
--enable-sysvshm 
--no-create 
--no-recursion 
--with-openssl 

但是在发出make命令时遇到了一个问题:
/bin/bash /usr/local/src/php-5.6.7/libtool --silent --preserve-dup-deps --mode=compile cc  -Iext/openssl/ -I/usr/local/src/php-5.6.7/ext/openssl/ -DPHP_ATOM_INC -I/usr/local/src/php-5.6.7/include -I/usr/local/src/php-5.6.7/main -I/usr/local/src/php-5.6.7 -I/usr/local/src/php-5.6.7/ext/date/lib -I/usr/local/src/php-5.6.7/ext/ereg/regex -I/usr/include/libxml2 -I/usr/X11 -I/usr/include/freetype2 -I/usr/local/src/php-5.6.7/ext/mbstring/oniguruma -I/usr/local/src/php-5.6.7/ext/mbstring/libmbfl -I/usr/local/src/php-5.6.7/ext/mbstring/libmbfl/mbfl -I/usr/local/src/php-5.6.7/ext/sqlite3/libsqlite -I/usr/local/src/php-5.6.7/ext/zip/lib -I/usr/local/src/php-5.6.7/TSRM -I/usr/local/src/php-5.6.7/Zend    -I/usr/include -g -O2 -fvisibility=hidden  -c /usr/local/src/php-5.6.7/ext/openssl/openssl.c -o ext/openssl/openssl.lo
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:434: error: 'zif_openssl_get_cert_locations' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:437: error: 'zif_openssl_spki_new' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:438: error: 'zif_openssl_spki_verify' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:439: error: 'zif_openssl_spki_export' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:440: error: 'zif_openssl_spki_export_challenge' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:443: error: 'zif_openssl_pkey_free' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:444: error: 'zif_openssl_pkey_new' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:445: error: 'zif_openssl_pkey_export' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:446: error: 'zif_openssl_pkey_export_to_file' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:447: error: 'zif_openssl_pkey_get_private' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:448: error: 'zif_openssl_pkey_get_public' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:449: error: 'zif_openssl_pkey_get_details' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:456: error: 'zif_openssl_x509_read' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:457: error: 'zif_openssl_x509_free' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:458: error: 'zif_openssl_x509_parse' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:459: error: 'zif_openssl_x509_checkpurpose' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:460: error: 'zif_openssl_x509_check_private_key' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:461: error: 'zif_openssl_x509_export' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:462: error: 'zif_openssl_x509_fingerprint' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:463: error: 'zif_openssl_x509_export_to_file' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:466: error: 'zif_openssl_pkcs12_export' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:467: error: 'zif_openssl_pkcs12_export_to_file' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:468: error: 'zif_openssl_pkcs12_read' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:471: error: 'zif_openssl_csr_new' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:472: error: 'zif_openssl_csr_export' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:473: error: 'zif_openssl_csr_export_to_file' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:474: error: 'zif_openssl_csr_sign' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:475: error: 'zif_openssl_csr_get_subject' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:476: error: 'zif_openssl_csr_get_public_key' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:482: error: 'zif_openssl_sign' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:483: error: 'zif_openssl_verify' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:484: error: 'zif_openssl_seal' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:485: error: 'zif_openssl_open' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:492: error: 'zif_openssl_pkcs7_verify' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:493: error: 'zif_openssl_pkcs7_decrypt' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:494: error: 'zif_openssl_pkcs7_sign' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:495: error: 'zif_openssl_pkcs7_encrypt' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:497: error: 'zif_openssl_private_encrypt' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:498: error: 'zif_openssl_private_decrypt' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:499: error: 'zif_openssl_public_encrypt' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:500: error: 'zif_openssl_public_decrypt' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:508: error: 'zif_openssl_error_string' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:519: error: 'zm_startup_openssl' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:519: error: initializer element is not constant
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:519: error: (near initialization for 'openssl_module_entry.module_startup_func')
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:520: error: 'zm_shutdown_openssl' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:520: error: initializer element is not constant
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:520: error: (near initialization for 'openssl_module_entry.module_shutdown_func')
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:523: error: 'zm_info_openssl' undeclared here (not in a function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:523: error: initializer element is not constant
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:523: error: (near initialization for 'openssl_module_entry.info_func')
/usr/local/src/php-5.6.7/ext/openssl/openssl.c: In function 'zm_startup_openssl':
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:1182: error: 'OPENSSL_DEFAULT_STREAM_CIPHERS' undeclared (first use in this function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:1182: error: (Each undeclared identifier is reported only once
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:1182: error: for each function it appears in.)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:1182: warning: passing argument 3 of 'zend_register_string_constant' from incompatible pointer type
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:1210: error: 'OPENSSL_RAW_DATA' undeclared (first use in this function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:1210: warning: passing argument 3 of 'zend_register_long_constant' makes integer from pointer without a cast
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:1211: error: 'OPENSSL_ZERO_PADDING' undeclared (first use in this function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:1211: warning: passing argument 3 of 'zend_register_long_constant' makes integer from pointer without a cast
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:1233: error: 'php_openssl_ssl_socket_factory' undeclared (first use in this function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:1233: warning: passing argument 2 of 'php_stream_xport_register' from incompatible pointer type
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:1234: warning: passing argument 2 of 'php_stream_xport_register' from incompatible pointer type
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:1236: warning: passing argument 2 of 'php_stream_xport_register' from incompatible pointer type
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:1238: warning: passing argument 2 of 'php_stream_xport_register' from incompatible pointer type
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:1239: warning: passing argument 2 of 'php_stream_xport_register' from incompatible pointer type
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:1246: warning: passing argument 2 of 'php_stream_xport_register' from incompatible pointer type
/usr/local/src/php-5.6.7/ext/openssl/openssl.c: In function 'zif_openssl_encrypt':
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:5188: error: 'OPENSSL_ZERO_PADDING' undeclared (first use in this function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:5188: error: invalid operands to binary &
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:5197: error: 'OPENSSL_RAW_DATA' undeclared (first use in this function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:5197: error: invalid operands to binary &
/usr/local/src/php-5.6.7/ext/openssl/openssl.c: In function 'zif_openssl_decrypt':
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:5252: error: 'OPENSSL_RAW_DATA' undeclared (first use in this function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:5252: error: invalid operands to binary &
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:5281: error: 'OPENSSL_ZERO_PADDING' undeclared (first use in this function)
/usr/local/src/php-5.6.7/ext/openssl/openssl.c:5281: error: invalid operands to binary &
make: *** [ext/openssl/openssl.lo] Error 1

这工作得很好,当我不包括--with-openssl命令时,我可以编译/make/make install

我试图从apt,源,不同版本(0.9.8和0.9.7)等安装openssl。

任何帮助,将不胜感激!

最佳答案

在这里回答了我自己的问题:

我删除了以下configure选项,随后的make正常运行。
--no-create--no-recursion
这解决了我的问题。

关于php - 从源代码编译PHP时为OpenSSL出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29539099/

相关文章:

PHP - fgetcsv() 重置指针

javascript - React JS - 在 onClick 事件后触发 PHP

javascript - 在 PHP 中重新加载页面以显示图像

php - 一个查询而不是两个?

swift - 用户定义的 SWIFT_WHOLE_MODULE_OPTIMIZATION 和 Swift 优化级别之间有什么区别?

c - 为什么编译器不检测字符串常量初始化中的越界?

c++ - 使用指向方法的指针的 MSVC 编译器 fatal error C1001

c - 'ld' 无法链接符号,尽管它们在库中

c++ - 无法访问类 'std::basic_ios<_Elem,_Traits>' 中声明的私有(private)成员

c++ - 要求成员 'push_back' vector C++