Skip to content

Instantly share code, notes, and snippets.

@tassoevan
Last active August 11, 2021 15:32
Show Gist options
  • Save tassoevan/74a65692bd1ddccec5fb to your computer and use it in GitHub Desktop.
Save tassoevan/74a65692bd1ddccec5fb to your computer and use it in GitHub Desktop.
Install PHP 5.2.17 in phpbrew
--- ext/dom/node.c 2012-08-06 17:49:48.826716692 +0800
+++ ext/dom/node.c 2012-08-06 17:52:47.633484660 +0800
@@ -1895,9 +1895,17 @@ static void dom_canonicalization(INTERNA
RETVAL_FALSE;
} else {
if (mode == 0) {
+#ifdef LIBXML2_NEW_BUFFER
+ ret = xmlOutputBufferGetSize(buf);
+#else
ret = buf->buffer->use;
+#endif
if (ret > 0) {
+#ifdef LIBXML2_NEW_BUFFER
+ RETVAL_STRINGL((char *) xmlOutputBufferGetContent(buf), ret, 1);
+#else
RETVAL_STRINGL((char *) buf->buffer->content, ret, 1);
+#endif
} else {
RETVAL_EMPTY_STRING();
}
--- ext/dom/documenttype.c 2012-08-06 18:02:16.019640870 +0800
+++ ext/dom/documenttype.c 2012-08-06 18:06:16.612228905 +0800
@@ -205,7 +205,13 @@ int dom_documenttype_internal_subset_rea
if (buff != NULL) {
xmlNodeDumpOutput (buff, NULL, (xmlNodePtr) intsubset, 0, 0, NULL);
xmlOutputBufferFlush(buff);
+
+#ifdef LIBXML2_NEW_BUFFER
+ ZVAL_STRINGL(*retval, xmlOutputBufferGetContent(buff),
+ xmlOutputBufferGetSize(buff), 1);
+#else
ZVAL_STRINGL(*retval, buff->buffer->content, buff->buffer->use, 1);
+#endif
(void)xmlOutputBufferClose(buff);
return SUCCESS;
}
--- ext/simplexml/simplexml.c 2012-08-06 18:10:44.621017026 +0800
+++ ext/simplexml/simplexml.c 2012-08-06 18:12:48.016270419 +0800
@@ -1417,7 +1417,12 @@ SXE_METHOD(asXML)
xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, ((xmlDocPtr) sxe->document->ptr)->encoding);
xmlOutputBufferFlush(outbuf);
+#ifdef LIBXML2_NEW_BUFFER
+ RETVAL_STRINGL((char *)xmlOutputBufferGetContent(outbuf),
+ xmlOutputBufferGetSize(outbuf), 1);
+#else
RETVAL_STRINGL((char *)outbuf->buffer->content, outbuf->buffer->use, 1);
+#endif
xmlOutputBufferClose(outbuf);
}
} else {
--- ext/openssl/xp_ssl.c 2015-10-07 17:19:55.710935804 -0300
+++ ext/openssl/xp_ssl.c 2015-10-07 17:23:12.723383144 -0300
@@ -332,10 +332,12 @@
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();
@@ -352,10 +354,12 @@
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();
@@ -579,9 +583,11 @@
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;
@@ -813,9 +819,11 @@
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;
$ phpbrew install http://museum.php.net/php5/php-5.2.17.tar.bz2 +default # it will fail
$ cd ~/.phpbrew/build/php-5.2.17
$ patch -p0 < ~/Downloads/openssl.patch
$ patch -p0 < ~/Downloads/libxml29_compat.patch
$ make
$ make install
$ phpbrew use 5.2.17
$ cd ext
$ wget http://xdebug.org/files/xdebug-2.2.1.tgz
$ tar xvf xdebug-2.2.1.tgz
$ mv xdebug-2.2.1 xdebug
$ rm xdebug-2.2.1.tgz
$ cd xdebug
$ phpbrew use 5.2.17
$ phpize
$ ./configure --enable-xdebug
$ make
$ make install
$ echo "zend_extension=$(readlink -f ~/.phpbrew/php/php-5.2.17/lib/php/extensions/no-debug-non-zts-*/xdebug.so)" > ~/.phpbrew/php/php-5.2.17/etc/php.ini
@chaushevic
Copy link

Thank you, the openssl patch came in handy.

@michaelyx2
Copy link

michaelyx2 commented Aug 26, 2018

While installing again get:

Enjoy!
patching file ext/openssl/xp_ssl.c
Reversed (or previously applied) patch detected! Assume -R? [n] n
Apply anyway? [n] n
Skipping patch.
4 out of 4 hunks ignored -- saving rejects to file ext/openssl/xp_ssl.c.rej
patching file ext/dom/node.c
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file ext/dom/node.c.rej
patching file ext/dom/documenttype.c
Reversed (or previously applied) patch detected! Assume -R? [n] j
Apply anyway? [n] j
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file ext/dom/documenttype.c.rej
patching file ext/simplexml/simplexml.c
Reversed (or previously applied) patch detected! Assume -R? [n]
patching file ext/simplexml/simplexml.c
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file ext/simplexml/simplexml.c.rej

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

Installing PHP SAPI module: cgi
Installing PHP CGI binary: /home/michaelyx/.phpbrew/php/php-5.2.17/bin/
Installing PHP CLI binary: /home/michaelyx/.phpbrew/php/php-5.2.17/bin/
Installing PHP CLI man page: /home/michaelyx/.phpbrew/php/php-5.2.17/man/man1/
Installing build environment: /home/michaelyx/.phpbrew/php/php-5.2.17/lib/php/build/
Installing header files: /home/michaelyx/.phpbrew/php/php-5.2.17/include/php/
Installing helper programs: /home/michaelyx/.phpbrew/php/php-5.2.17/bin/
program: phpize
program: php-config
Installing man pages: /home/michaelyx/.phpbrew/php/php-5.2.17/man/man1/
page: phpize.1
page: php-config.1
Installing PEAR environment: /home/michaelyx/.phpbrew/php/php-5.2.17/lib/php/pear/
[PEAR] Archive_Tar - already installed: 1.3.7
[PEAR] Console_Getopt - already installed: 1.2.3
[PEAR] Structures_Graph- already installed: 1.0.3
[PEAR] XML_Util - already installed: 1.2.1
[PEAR] PEAR - already installed: 1.9.1
Warning! a PEAR user config file already exists from a previous PEAR installation at '/home/michaelyx/.pearrc'. You may probably want to remove it.
Wrote PEAR system config file at: /home/michaelyx/.phpbrew/php/php-5.2.17/etc/pear.conf
You may want to add: /home/michaelyx/.phpbrew/php/php-5.2.17/lib/php/pear to your php.ini include_path
Installing PDO headers: /home/michaelyx/.phpbrew/php/php-5.2.17/include/php/ext/pdo/
Exception: You should not see this, if you see this, it means you didn't load the ~/.phpbrew/bashrc script, please check if bashrc is sourced in your shell.
Trace:

0) PhpBrew\Command\VirtualCommand->execute('5.2.17')
1) call_user_func_array([PhpBrew\Command\UseCommand, 'execute'], ['5.2.17'])
2) CLIFramework\CommandBase->executeWrapper(['5.2.17'])
3) CLIFramework\Application->run(['/usr/local/bin/phpbrew', 'use', '5.2.17'])
4) PhpBrew\Console->runWithTry(['/usr/local/bin/phpbrew', 'use', '5.2.17'])
5) require('phar:///usr/local/bin/phpbrew/scripts/phpbrew-emb.php')

URL transformed to HTTPS due to an HSTS policy
--2018-08-26 13:19:41-- https://xdebug.org/files/xdebug-2.2.1.tgz
Auflösen des Hostnamen »xdebug.org (xdebug.org)«... 82.113.146.227
Verbindungsaufbau zu xdebug.org (xdebug.org)|82.113.146.227|:443... verbunden.
HTTP-Anforderung gesendet, warte auf Antwort... 200 OK
Länge: 248057 (242K) [application/x-gtar-compressed]
In »»xdebug-2.2.1.tgz«« speichern.

xdebug-2.2.1.tgz 100%[===================>] 242,24K 1,50MB/s in 0,2s

2018-08-26 13:19:42 (1,50 MB/s) - »xdebug-2.2.1.tgz« gespeichert [248057/248057]

package.xml
xdebug-2.2.1/contrib/tracefile-analyser.php
xdebug-2.2.1/contrib/xt.vim
xdebug-2.2.1/debugclient/build/buildcheck.sh
xdebug-2.2.1/debugclient/build/buildconf1.mk
xdebug-2.2.1/debugclient/build/buildconf2.mk
xdebug-2.2.1/debugclient/build/clean.mk
xdebug-2.2.1/debugclient/build/config-stubs
xdebug-2.2.1/debugclient/acinclude.m4
xdebug-2.2.1/debugclient/buildconf
xdebug-2.2.1/debugclient/config.guess
xdebug-2.2.1/debugclient/config.h.in
xdebug-2.2.1/debugclient/config.sub
xdebug-2.2.1/debugclient/configure
xdebug-2.2.1/debugclient/configure.in
xdebug-2.2.1/debugclient/cvsclean
xdebug-2.2.1/debugclient/debugclient.dsp
xdebug-2.2.1/debugclient/depcomp
xdebug-2.2.1/debugclient/INSTALL
xdebug-2.2.1/debugclient/install-sh
xdebug-2.2.1/debugclient/LICENSE
xdebug-2.2.1/debugclient/ltmain.sh
xdebug-2.2.1/debugclient/main.c
xdebug-2.2.1/debugclient/Makefile.in
xdebug-2.2.1/debugclient/missing
xdebug-2.2.1/debugclient/mkinstalldirs
xdebug-2.2.1/debugclient/usefulstuff.c
xdebug-2.2.1/debugclient/usefulstuff.h
xdebug-2.2.1/config.m4
xdebug-2.2.1/config.w32
xdebug-2.2.1/CREDITS
xdebug-2.2.1/LICENSE
xdebug-2.2.1/Makefile.frag
xdebug-2.2.1/Makefile.in
xdebug-2.2.1/NEWS
xdebug-2.2.1/php_xdebug.h
xdebug-2.2.1/README
xdebug-2.2.1/usefulstuff.c
xdebug-2.2.1/usefulstuff.h
xdebug-2.2.1/xdebug.c
xdebug-2.2.1/xdebug_code_coverage.c
xdebug-2.2.1/xdebug_code_coverage.h
xdebug-2.2.1/xdebug_com.c
xdebug-2.2.1/xdebug_com.h
xdebug-2.2.1/xdebug_compat.c
xdebug-2.2.1/xdebug_compat.h
xdebug-2.2.1/xdebug_handlers.c
xdebug-2.2.1/xdebug_handlers.h
xdebug-2.2.1/xdebug_handler_dbgp.c
xdebug-2.2.1/xdebug_handler_dbgp.h
xdebug-2.2.1/xdebug_hash.c
xdebug-2.2.1/xdebug_hash.h
xdebug-2.2.1/xdebug_llist.c
xdebug-2.2.1/xdebug_llist.h
xdebug-2.2.1/xdebug_mm.h
xdebug-2.2.1/xdebug_private.c
xdebug-2.2.1/xdebug_private.h
xdebug-2.2.1/xdebug_profiler.c
xdebug-2.2.1/xdebug_profiler.h
xdebug-2.2.1/xdebug_set.c
xdebug-2.2.1/xdebug_set.h
xdebug-2.2.1/xdebug_stack.c
xdebug-2.2.1/xdebug_stack.h
xdebug-2.2.1/xdebug_str.c
xdebug-2.2.1/xdebug_str.h
xdebug-2.2.1/xdebug_superglobals.c
xdebug-2.2.1/xdebug_superglobals.h
xdebug-2.2.1/xdebug_tracing.c
xdebug-2.2.1/xdebug_tracing.h
xdebug-2.2.1/xdebug_var.c
xdebug-2.2.1/xdebug_var.h
xdebug-2.2.1/xdebug_xml.c
xdebug-2.2.1/xdebug_xml.h
Exception: You should not see this, if you see this, it means you didn't load the ~/.phpbrew/bashrc script, please check if bashrc is sourced in your shell.
Trace:

0) PhpBrew\Command\VirtualCommand->execute('5.2.17')
1) call_user_func_array([PhpBrew\Command\UseCommand, 'execute'], ['5.2.17'])
2) CLIFramework\CommandBase->executeWrapper(['5.2.17'])
3) CLIFramework\Application->run(['/usr/local/bin/phpbrew', 'use', '5.2.17'])
4) PhpBrew\Console->runWithTry(['/usr/local/bin/phpbrew', 'use', '5.2.17'])
5) require('phar:///usr/local/bin/phpbrew/scripts/phpbrew-emb.php')

Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

/home/michaelyx/.phpbrew/bin/phpbrew-php5.2.17.sh: Zeile 17: ./configure: Datei oder Verzeichnis nicht gefunden
make: *** Es wurden keine Ziele angegeben und keine „make“-Steuerdatei gefunden. Schluss.
make: *** Keine Regel, um „install“ zu erstellen. Schluss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment