PDA

View Full Version : Howto: Suhosin + Fedora Core 7 PHP 5.2.2


djcloudychamber
4th September 2007, 09:05
Hey everyone.. having a bit of a problem.
I am trying to install Suhosin to harden my php deployment. I am using php version 5.2.2 I've downloaded the proper patch for my php version: suhosin-patch-5.2.2-0.9.6.2.patch.gz

I've modified the php.spec file to include the suhosin patches.
When I run rpmbuild -ba php.spec to recompile PHP with the patch I get the following error:


/usr/src/redhat/BUILD/php-5.2.2/ext/pcre/php_pcre.c: In function 'php_pcre_match_impl':
/usr/src/redhat/BUILD/php-5.2.2/ext/pcre/php_pcre.c:529: error: 'PCRE_EXTRA_MATCH_LIMIT_RECURSION' undeclared (first use in this function)
/usr/src/redhat/BUILD/php-5.2.2/ext/pcre/php_pcre.c:533: error: 'pcre_extra' has no member named 'match_limit_recursion'
/usr/src/redhat/BUILD/php-5.2.2/ext/pcre/php_pcre.c: In function 'php_pcre_replace_impl':
/usr/src/redhat/BUILD/php-5.2.2/ext/pcre/php_pcre.c:972: error: 'PCRE_EXTRA_MATCH_LIMIT_RECURSION' undeclared (first use in this function)
/usr/src/redhat/BUILD/php-5.2.2/ext/pcre/php_pcre.c:976: error: 'pcre_extra' has no member named 'match_limit_recursion'
/usr/src/redhat/BUILD/php-5.2.2/ext/pcre/php_pcre.c: In function 'php_pcre_split_impl':
/usr/src/redhat/BUILD/php-5.2.2/ext/pcre/php_pcre.c:1416: error: 'PCRE_EXTRA_MATCH_LIMIT_RECURSION' undeclared (first use in this function)
/usr/src/redhat/BUILD/php-5.2.2/ext/pcre/php_pcre.c:1420: error: 'pcre_extra' has no member named 'match_limit_recursion'
/usr/src/redhat/BUILD/php-5.2.2/ext/pcre/php_pcre.c: In function 'php_pcre_grep_impl':
/usr/src/redhat/BUILD/php-5.2.2/ext/pcre/php_pcre.c:1681: error: 'PCRE_EXTRA_MATCH_LIMIT_RECURSION' undeclared (first use in this function)
/usr/src/redhat/BUILD/php-5.2.2/ext/pcre/php_pcre.c:1685: error: 'pcre_extra' has no member named 'match_limit_recursion'
make: *** [ext/pcre/php_pcre.lo] Error 1
error: Bad exit status from /var/tmp/rpm-tmp.94472 (%build)


RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.94472 (%build)

ANY suggestions are greatly appreciated.

falko
5th September 2007, 21:01
Did you include the Suhosin patch in the right location in php.spec?

djcloudychamber
8th September 2007, 06:58
Falko, thanks for the reply.
Yes, I have suhosin declared in my php.spec file. Here are the relevant exerpts:

Source0: http://www.php.net/distributions/php-%{version}.tar.gz
Source1: php.conf
Source2: php.ini
Source3: macros.php
Patch0: php-5.2.2-suhosin.patch
Patch1: php-5.1.4-gnusrc.patch
Patch2: php-4.3.3-install.patch
Patch3: php-5.0.4-norpath.patch
Patch5: php-5.0.2-phpize64.patch
Patch8: php-5.2.0-includedir.patch

%prep
%setup -q
%patch0 -p1 -b .suhosin
%patch1 -p1 -b .gnusrc
%patch2 -p1 -b .install
%patch3 -p1 -b .norpath
%patch5 -p1 -b .phpize64
%patch8 -p1 -b .includedir

The error message seems to be only complaining about the php_pcre.c file. All the variables listed below are declared in the file. I'm going to try the latest ver. of php 5.2.4 and apply the latest suhosin patch. I'd really like to figure out what I'm doing wrong here though.