Archive

Posts Tagged ‘Apache’

How to remove Suhosin, Ubuntu PHP

October 29th, 2009
  • Create a working directory:
    mkdir packages
  • Enter the directory:
    cd packages
  • If you haven’t built a Debian package before get development scripts:
    sudo apt-get install devscripts
  • If this system hasn’t been used for development, you need a minimal tool set:
    sudo apt-get install gcc debhelper fakeroot
  • Get the PHP5 source (do not use sudo on this one):
    apt-get source php5
  • Enter the PHP5 directory (versions may vary, at the moment it is php5-5.2.10):
    cd php5-5.x.y
  • Ensure an unmodified PHP will build. This might take some time as it fetches various dependencies.
    sudo apt-get build-dep php5
  • Remove the patch file:
    rm debian/patches/suhosin.patch
  • Remove the reference to the patch (delete the line that contains suhosin.patch with Ctrl-K, then Ctrl-O to save and Ctrl-X to exit):
    nano debian/patches/series
  • Increment the version number. This can be problematic. Your version number is likely to be different from the one listed here, and I found some reports that having the string “suhosin” in the version can confuse some applications into thinking Suhosin is installed. I simply appended “.1~custom” to the current package version:
    debchange -v 5.2.10.dfsg.1.1~custom
  • The version bump will pop the nano text editor. Move to the end of the auto-selected line, enter a comment like “Removed Suhosin.” then press Ctrl-O to save, Ctrl-X to exit.
  • Finally build the package (note only one “b” in “deb build”):
    debuild
  • Take a break, the build will take a while. Ignore the hundreds of warnings that scroll past.
  • You should have new packages:
    ls ../php5*
  • Quick and dirty install (might break stuff):
    sudo dpkg -i ../*.deb

Config, Development ,