Header RSS Feed
 
If you only want to see the articles of a certain category, please click on the desired category below:
ALL Android Backup BSD Database Hacks Hardware Internet Linux Mail MySQL Monitoring Network Personal PHP Proxy Shell Solaris Unix Virtualization VMware Windows Wyse

PHP 5.2.17 on Debian Wheezy 7: Solve make error in xp_ssl.c
Saturday - Oct 26th 2013 - by - (0 comments)

When I tried to compile PHP 5.2.17 (I know, I know, it's EOL!) on a Debian Wheezy machine, 'make' ends with the following error message:

 ext/openssl/.libs/xp_ssl.o: In function `php_openssl_setup_crypto':
/root/downloads/php-5.2.17/ext/openssl/xp_ssl.c:337: undefined reference to `SSLv2_client_method'
/root/downloads/php-5.2.17/ext/openssl/xp_ssl.c:357: undefined reference to `SSLv2_server_method'
collect2: error: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1

According to PHP bug #54736, this is because the new Debian system has a newer libssl without SSLv2 support.

To still be able to finish the compile process, I needed to manually apply the following patch:

--- a/ext/openssl/xp_ssl.c
+++ b/ext/openssl/xp_ssl.c
@@ -328,10 +328,12 @@ static inline int php_openssl_setup_cryp
             sslsock->is_client = 1;
             method = SSLv23_client_method();
             break;
+#ifndef OPENSSL_NO_SSL2
         case STREAM_CRYPTO_METHOD_SSLv2_CLIENT:
             sslsock->is_client = 1;
             method = SSLv2_client_method();
             break;
+#endif
         case STREAM_CRYPTO_METHOD_SSLv3_CLIENT:
             sslsock->is_client = 1;
             method = SSLv3_client_method();
@@ -348,10 +350,12 @@ static inline int php_openssl_setup_cryp
             sslsock->is_client = 0;
             method = SSLv3_server_method();
             break;
+#ifndef OPENSSL_NO_SSL2
         case STREAM_CRYPTO_METHOD_SSLv2_SERVER:
             sslsock->is_client = 0;
             method = SSLv2_server_method();
             break;
+#endif
         case STREAM_CRYPTO_METHOD_TLS_SERVER:
             sslsock->is_client = 0;
             method = TLSv1_server_method();
@@ -629,9 +633,11 @@ static inline int php_openssl_tcp_sockop
                 case STREAM_CRYPTO_METHOD_SSLv23_CLIENT:
                     sock->method = STREAM_CRYPTO_METHOD_SSLv23_SERVER;
                     break;
+#ifndef OPENSSL_NO_SSL2
                 case STREAM_CRYPTO_METHOD_SSLv2_CLIENT:
                     sock->method = STREAM_CRYPTO_METHOD_SSLv2_SERVER;
                     break;
+#endif
                 case STREAM_CRYPTO_METHOD_SSLv3_CLIENT:
                     sock->method = STREAM_CRYPTO_METHOD_SSLv3_SERVER;
                     break;
@@ -911,9 +917,11 @@ php_stream *php_openssl_ssl_socket_facto
     if (strncmp(proto, "ssl", protolen) == 0) {
         sslsock->enable_on_connect = 1;
         sslsock->method = STREAM_CRYPTO_METHOD_SSLv23_CLIENT;
+#ifndef OPENSSL_NO_SSL2
     } else if (strncmp(proto, "sslv2", protolen) == 0) {
         sslsock->enable_on_connect = 1;
         sslsock->method = STREAM_CRYPTO_METHOD_SSLv2_CLIENT;
+#endif
     } else if (strncmp(proto, "sslv3", protolen) == 0) {
         sslsock->enable_on_connect = 1;
         sslsock->method = STREAM_CRYPTO_METHOD_SSLv3_CLIENT;

I saved it as xp_ssl.patch and applied it on xp_ssl.c:

patch xp_ssl.c xp_ssl.patch
patching file xp_ssl.c
Hunk #1 succeeded at 332 (offset 4 lines).
Hunk #2 succeeded at 354 (offset 4 lines).
Hunk #3 succeeded at 583 (offset -50 lines).
Hunk #4 succeeded at 819 (offset -98 lines).

The diff looked like this:

diff xp_ssl.c xp_ssl.c.orig
335d334
< #ifndef OPENSSL_NO_SSL2
340d338
< #endif
357d354
< #ifndef OPENSSL_NO_SSL2
362d358
< #endif
586d581
< #ifndef OPENSSL_NO_SSL2
590d584
< #endif
822d815
< #ifndef OPENSSL_NO_SSL2
826d818
< #endif

Right after I launched make again and received this error:

/usr/bin/ld: cannot find -lltdl
collect2: error: ld returned 1 exit status
make: *** [libphp5.la] Error 1

Well that was a bit easier to solve as it was only a package missing:

apt-get install libltdl-dev libltdl7

After that, make worked as it should:

make
[...]
Build complete.
Don't forget to run 'make test'.

 

Add a comment

Show form to leave a comment

Comments (newest first):

No comments yet.

Go to Homepage home
Linux Howtos how to's
Nagios Plugins nagios plugins
Links links

Valid HTML 4.01 Transitional
Valid CSS!
[Valid RSS]

7668 Days
until Death of Computers
Why?