OpenWrt Forum Archive

Topic: How can i upgrade php5 5.2.6 to 5.2.8 ?

The content of this topic has been archived on 4 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I tried moodle inside a lighthttpd+sqlite+php5 8.09 kamikaze, but moodle seems to need at least 5.2.8 php version, how can I upgrade this thing?
thx

Change lang/php5/Makefile rebuild and reinstall the package.

Thanks but build failed! there are some included patches that dont work

dogge@debian:~$ cd ~/
dogge@debian:~$ sudo apt-get install quilt
dogge@debian:~$ svn checkout svn://svn.openwrt.org/openwrt/tags/8.09.1/
dogge@debian:~$ cd ~/8.09.1/
dogge@debian:~/8.09.1$ ./scripts/feeds update packages luci
dogge@debian:~/8.09.1$ ./scripts/feeds install php5


Edit feeds/packages/lang/php5/Makefile and make the changes below:

dogge@debian:~/8.09.1$ nano feeds/packages/lang/php5/Makefile

-# Copyright (C) 2006,2007 OpenWrt.org
+# Copyright (C) 2006-2009 OpenWrt.org

-PKG_VERSION:=5.2.6
+PKG_VERSION:=5.2.8

-PKG_RELEASE:=2
+PKG_RELEASE:=3

-PKG_MD5SUM:=7380ffecebd95c6edb317ef861229ebd
-#PKG_MD5SUM:=7380ffecebd95c6edb317ef861229ebd


So, lang/php5/patches/002-uts_domainname.patch failed? Lets fix it.

dogge@debian:~/8.09.1$ make package/php5/{clean,prepare} V=99 QUILT=1
dogge@debian:~/8.09.1$ cd build_dir/mipsel/php-5.2.8/

Apply patches/002-uts_domainname.patch. It fails but that doesn't matter.

dogge@debian:~/8.09.1/build_dir/mipsel/php-5.2.8$ quilt push patches/002-uts_domainname.patch -f

Look at ext/posix/posix.c.rej and check where it failed. Now we know what to fix.

dogge@debian:~/8.09.1/build_dir/mipsel/php-5.2.8$ cat ext/posix/posix.c.rej
***************
*** 468,474 ****
        add_assoc_string(return_value, "version",  u.version,  1);
        add_assoc_string(return_value, "machine",  u.machine,  1);
  #ifdef _GNU_SOURCE
-       add_assoc_string(return_value, "domainname", u.domainname, 1);
  #endif
  }
  /* }}} */
--- 468,474 ----
        add_assoc_string(return_value, "version",  u.version,  1);
        add_assoc_string(return_value, "machine",  u.machine,  1);
  #ifdef _GNU_SOURCE
+       add_assoc_string(return_value, "domainname", u.__domainname, 1);
  #endif
  }
  /* }}} */


Now go and edit ext/posix/posix.c with QUILT and change the lines below.

dogge@debian:~/8.09.1/build_dir/mipsel/php-5.2.8$ EDITOR=nano quilt edit ext/posix/posix.c

-add_assoc_string(return_value, "domainname", u.domainname, 1);
+add_assoc_string(return_value, "domainname", u.__domainname, 1);


Refresh the patch and see if it applies now.

dogge@debian:~/8.09.1/build_dir/mipsel/php-5.2.8$ quilt refresh
dogge@debian:~/8.09.1/build_dir/mipsel/php-5.2.8$ quilt push patches/002-uts_domainname.patch

Then update and refresh the patches in lang/php5/patches/*

dogge@debian:~/8.09.1/build_dir/mipsel/php-5.2.8$ cd ~/8.09.1/
dogge@debian:~/8.09.1$ make package/php5/update V=99
dogge@debian:~/8.09.1$ make package/php5/{clean,refresh} V=99


Get the MD5SUM from the PHP5 source tarball

dogge@debian:~/8.09.1$ md5sum -b dl/php-5.2.8.tar.bz2 | awk '{print $1}'


Edit feeds/packages/lang/php5/Makefile and make the changes below:

dogge@debian:~/8.09.1$ nano feeds/packages/lang/php5/Makefile

-#PKG_MD5SUM:=7380ffecebd95c6edb317ef861229ebd
+PKG_MD5SUM:=8760a833cf10433d3e72271ab0d0eccf


dogge@debian:~/8.09.1$ svn status feeds/packages/
M      feeds/packages/lang/php5/patches/002-uts_domainname.patch
M      feeds/packages/lang/php5/patches/005-APC.patch
M      feeds/packages/lang/php5/patches/001-configure_cross.patch
M      feeds/packages/lang/php5/Makefile


Save the patch if you like with:

dogge@debian:~/8.09.1$ svn diff feeds/packages/lang/php5/ > ~/php5-update.diff


And finally you can build a new verison of PHP5.

Have fun smile

(Last edited by Dogge on 26 Jun 2009, 01:35)

You also like to apply this patch as well and choose the static version of PCRE.

Index: feeds/packages/lang/php5/Makefile
===================================================================
--- feeds/packages/lang/php5/Makefile   (revision 16564)
+++ feeds/packages/lang/php5/Makefile   (working copy)
@@ -31,9 +31,27 @@
  suited for Web development and can be embedded into HTML.
 endef
 
+define Package/php5/config  
+       choice  
+               prompt "PHP5 SPL Options"  
+               default PACKAGE_php5_without_spl  
+
+       config PACKAGE_php5_with_spl  
+               bool "With SPL (and pcre) static"  
+
+       config PACKAGE_php5_without_spl  
+               bool "without SPL (pcre may be enabled)"  
+       endchoice  
+endef  
+
 define Package/php5
   $(call Package/php5/Default)
-  DEPENDS:=+libopenssl +zlib
+       ifneq ($(CONFIG_PACKAGE_php5_with_spl),)
+               DEPENDS:=+libopenssl +zlib
+               CONFIG_PACKAGE_php5-mod-pcre:=
+       else
+               DEPENDS:=+libopenssl +zlib +libpcre
+       endif
 endef
 
 define Package/php5/description
@@ -184,7 +202,6 @@
        --disable-rpath \
        --disable-debug \
        --without-pear \
-       --disable-spl \
        \
        --with-config-file-path=/etc \
        --disable-ipv6 \
@@ -226,7 +243,11 @@
   CONFIG_PACKAGE_php5-mod-gmp:=m
   CONFIG_PACKAGE_php5-mod-ldap:=m
   CONFIG_PACKAGE_php5-mod-mysql:=m
-  CONFIG_PACKAGE_php5-mod-pcre:=m
+  ifneq ($(CONFIG_PACKAGE_php5_with_spl),)
+       CONFIG_PACKAGE_php5-mod-pcre:=n
+  else
+       CONFIG_PACKAGE_php5-mod-pcre:=m
+  endif
   CONFIG_PACKAGE_php5-mod-pgsql:=m
   CONFIG_PACKAGE_php5-mod-sqlite:=m
   CONFIG_PACKAGE_php5-mod-xml:=m
@@ -266,11 +287,17 @@
 else
   PKG_CONFIGURE_OPTS+= --without-mysql
 endif
+ifneq ($(CONFIG_PACKAGE_php5_with_spl),)
+  PKG_CONFIGURE_OPTS+= --with-pcre-dir="$(STAGING_DIR)/usr"
+  PKG_CONFIGURE_OPTS+= --enable-spl
+else
+  PKG_CONFIGURE_OPTS+= --disable-spl
 ifneq ($(CONFIG_PACKAGE_php5-mod-pcre),)
   PKG_CONFIGURE_OPTS+= --with-pcre-regex=shared,"$(STAGING_DIR)/usr"
 else
   PKG_CONFIGURE_OPTS+= --without-pcre-regex
 endif
+endif
 ifneq ($(CONFIG_PACKAGE_php5-mod-pgsql),)
   PKG_CONFIGURE_OPTS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
 else
@@ -405,7 +432,8 @@
   define Package/$(1)/install
        [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib/php
        for m in $(2); do \
-               $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$$$$$$$${m}.so $$(1)/usr/lib/php/ ; \
+               [ -z "$(CONFIG_PACKAGE_$(1))" ] \
+                       || $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$$$$$$$${m}.so $$(1)/usr/lib/php/ ; \
        done
   endef

This patch is backported to 8.09.1 from trunk: https://dev.openwrt.org/changeset/15671 … /lang/php5

(Last edited by Dogge on 26 Jun 2009, 02:46)

Thanks so much! It seems to be working now, first it failed but 4 another reasons (libsqlite2 was needed i thought 3 would be enough) but now it gives the image without complaints, next step:moodle install
Yur great help is highly appreciate Dogge

The discussion might have continued from here.