Skip to content

Instantly share code, notes, and snippets.

@horitaku1124
Last active June 6, 2017 12:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save horitaku1124/34872fc29426c056adcf9d60ac37df9b to your computer and use it in GitHub Desktop.
Save horitaku1124/34872fc29426c056adcf9d60ac37df9b to your computer and use it in GitHub Desktop.
PHP5.1.6 install to CentOS7
FROM centos:latest
RUN yum install -y gcc make flex patch bzip2 libxml2-devel perl httpd-devel
RUN yum -y install httpd
COPY php-5.1.6.tar.bz2 /root
WORKDIR /root
RUN tar xvf php-5.1.6.tar.bz2
WORKDIR /root/php-5.1.6
COPY simplexml.c.diff /root/php-5.1.6
COPY documenttype.c.diff /root/php-5.1.6
COPY php_functions.c.diff /root/php-5.1.6
# See http://qiita.com/tkimura/items/55b1fc245c87ad58a941
RUN patch --ignore-whitespace ext/dom/documenttype.c < documenttype.c.diff
RUN patch --ignore-whitespace ext/simplexml/simplexml.c < simplexml.c.diff
RUN patch --ignore-whitespace sapi/apache2handler/php_functions.c < php_functions.c.diff
RUN ./configure \
--with-apxs2 \
--enable-mbstring \
&& make && make install && make clean
RUN echo 'AddType application/x-httpd-php .php' >> /etc/httpd/conf/httpd.conf
RUN rm -rf /root/php-5.1.6
RUN /bin/rm /root/php-5.1.6.tar.bz2
RUN yum remove -y gcc make flex patch bzip2 libxml2-devel perl httpd-devel
RUN yum clean all
--- ext/dom/documenttype.c.bk 2017-05-22 12:57:33.860532330 +0000
+++ ext/dom/documenttype.c 2017-05-22 12:58:09.506312471 +0000
@@ -216,7 +216,7 @@ int dom_documenttype_internal_subset_rea
if (buff != NULL) {
xmlNodeDumpOutput (buff, NULL, (xmlNodePtr) intsubset, 0, 0, NULL);
xmlOutputBufferFlush(buff);
- strintsubset = xmlStrndup(buff->buffer->content, buff->buffer->use);
+ strintsubset = xmlStrndup(xmlOutputBufferGetContent(buff), xmlOutputBufferGetSize(buff));
(void)xmlOutputBufferClose(buff);
ZVAL_STRING(*retval, (char *) strintsubset, 1);
return SUCCESS;
--- sapi/apache2handler/php_functions.c.bk 2017-06-01 13:24:19.729603744 +0000
+++ sapi/apache2handler/php_functions.c 2017-06-01 13:25:39.011097257 +0000
@@ -333,7 +333,7 @@ PHP_FUNCTION(apache_getenv)
static char *php_apache_get_version()
{
- return (char *) ap_get_server_version();
+ return (char *) ap_get_server_banner();
}
/* {{{ proto string apache_get_version(void)
@@ -379,7 +379,7 @@ PHP_MINFO_FUNCTION(apache)
char *p;
server_rec *serv = ((php_struct *) SG(server_context))->r->server;
#if !defined(WIN32) && !defined(WINNT)
- AP_DECLARE_DATA extern unixd_config_rec unixd_config;
+ AP_DECLARE_DATA extern unixd_config_rec ap_unixd_config;
#endif
for (n = 0; ap_loaded_modules[n]; ++n) {
@@ -410,7 +410,7 @@ PHP_MINFO_FUNCTION(apache)
php_info_print_table_row(2, "Hostname:Port", tmp);
#if !defined(WIN32) && !defined(WINNT)
- sprintf(tmp, "%s(%d)/%d", unixd_config.user_name, unixd_config.user_id, unixd_config.group_id);
+ sprintf(tmp, "%s(%d)/%d", ap_unixd_config.user_name, ap_unixd_config.user_id, ap_unixd_config.group_id);
php_info_print_table_row(2, "User/Group", tmp);
#endif
--- ext/simplexml/simplexml.cbk 2017-05-22 12:54:46.624162646 +0000
+++ ext/simplexml/simplexml.c 2017-05-22 12:55:32.193200337 +0000
@@ -1220,7 +1220,7 @@ SXE_METHOD(asXML)
xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 1, ((xmlDocPtr) sxe->document->ptr)->encoding);
xmlOutputBufferFlush(outbuf);
- strval = xmlStrndup(outbuf->buffer->content, outbuf->buffer->use);
+ strval = xmlStrndup(xmlOutputBufferGetContent(outbuf), xmlOutputBufferGetSize(outbuf));
xmlOutputBufferClose(outbuf);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment