HOWTO: Drupal 6.14 on OpenSuse 11.2

OpenSuse 11.2 comes with php5 in version 5.3. unfortunately php version 5.3 is not compatible with Drupal in its current version which is 6.14.

Since I had a couple of web projects that did require Drupal I thought about patching Drupal to work with php 5.3 (didn’t work…) and then as a last resort to downgrade php5 to version 5.2.

This is how to do it:

1. Get the source files needed

You will need to recompile two src packages from the 11.1 distribution:

http://download.opensuse.org/source/distribution/11.1/repo/oss/suse/src/php5-5.2.6-49.11.src.rpm

http://download.opensuse.org/source/distribution/11.1/repo/oss/suse/src/imap-2006c1_suse-67.26.src.rpm

The imap requirement cannot be full filled by any 11.2 package since that does not exist for 11.2

2. Recompile the imap package

sudo rpmbuild --rebuild imap-2006c1_suse-67.26.src.rpm

in case you have some missing dependencies, install them using the following command:

sudo zypper in <package names>

where is a list of space separated packages listed as missing dependencies.

When all dependencies are installed really recompile the imape src-package:

sudo rpmbuild --rebuild imap-2006c1_suse-67.26.src.rpm

As a result you will get three new rpm packages, imap, imap-lib and imap-devel. Install them all using:

rpm -Uhv --force /usr/src/packages/RPMS/i586/imap-*

3. Recompile the php5 package

Do the same for the php5 src-package. Since I don’t like to clutter my system with package I never need again, I put down all required packages in a list to de-install them later:

rpmbuild --rebuild php5-5.2.6-49.11.src.rpm

This command listed the following missing packages (I added the imap packages as well to have them de-install later):

[pre]apache2-devel bison cyrus-sasl-devel flex-old gmp-devel libapr1-devel libapr-util1-devel libcurl-devel libedit0 libedit-devel libexpat-devel libmcryptlibmcrypt-devel libmm-devel libsensors3-devel libtidy-devel net-snmp net-snmp-devel openldap2 openldap2-devel perl-SNMP re2c rpm-devel sqlite2-devel t1lib-devel tcpd-devel unixODBC unixODBC-devel imap imap-devel imap-lib[/pre]

I saved these package names in a text file (php_dep.txt) in a single line of text.

issue the following command to install all the dependencies to recompile the php5 src-package:

sudo zypper in <list of packages>

Then recompile the php5 src-package:

rpmbuild --rebuild php5-5.2.6-49.11.src.rpm

Depending on your system’s speed this will take a while. Go grab a coffee…

4. Uninstall the php5-5.3 files

Get a list of all php5-5.3 packages on your system:

rpm -qa | grep php5-5.3

Review the list of returned packages and if save delete them:

rpm -qa | grep php5-5.3 | xargs rpm -e

5. Install the recompiled php5-5.2 files

If the recompile went OK, then the new php5-5.2 file are located in /usr/src/packages/RPMS/i586/:

Wrote: [pre]/usr/src/packages/RPMS/i586/php5-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-devel-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-pear-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/apache2-mod_php5-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-fastcgi-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-bcmath-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-bz2-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-calendar-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-ctype-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-curl-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-dba-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-dbase-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-dom-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-exif-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-ftp-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-gd-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-gettext-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-gmp-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-hash-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-iconv-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-imap-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-json-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-ldap-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-mbstring-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-mcrypt-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-mysql-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-ncurses-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-odbc-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-openssl-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-pcntl-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-pdo-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-pgsql-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-posix-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-pspell-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-readline-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-shmop-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-snmp-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-soap-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-sockets-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-sqlite-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-suhosin-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-sysvmsg-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-sysvsem-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-sysvshm-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-tidy-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-tokenizer-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-wddx-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-xmlrpc-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-xsl-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-xmlreader-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-xmlwriter-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-zip-5.2.6-49.11.i586.rpm
Wrote: /usr/src/packages/RPMS/i586/php5-zlib-5.2.6-49.11.i586.rpm[/pre]

Change into that sub directory and install the same packages you have removed in step 4:

cd /usr/src/packages/RPMS/i586/
sudo rpm -Uhv php5-5.2-xxx.rpm

Fix the permission on the php5 module:

sudo chmod +x /usr/lib/apache2/mod_php5.so

and add the php5 module to the list of loaded module in apache2:

a2enmod php5

Finally restart apache2:

sudo /etc/init.d/apache2 restart

That should do it. I have tested this approach on a more or less clean install of OpenSuse 11.2 and the latest Drupal package from the Drupal website (version 6.14).

J.

PS: In case you would like to remove all the extra packages that were needed to recompile php5-5.2 do this:

edit the file that list all the extra packages you had to install for this recompile:

e.g.:

pico -w php_dep.txt

This should show you all the packages in a single line of text. add the following to the beginning of the line:

sudo rpm -e

Save the file and then issue the following command:

sh php_dep.txt

This will execute the command in the single line of text removing all those packages from your system.

I almost forgot.

I might be a good idea to lock the php5-5.2 packages so they do not get updated to the 5.3 version from 11.2 accidentally:

sudo zypper al <package-name>

to get a list of currently locked packages issue this command:

sudo zypper ll 

To remove alock from a package use this one:

sudo zypper rl <package name>

Cheers J.

I don’t know if I’m missing something but when I try rebuild the rpm for the imap package I get an error message that says


+ /usr/bin/patch -s -p0 --fuzz=2
/var/tmp/rpm-tmp.ALSgcp: line 32: /usr/bin/patch: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.ALSgcp (%prep)


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

Any idea’s as to why this would happen, and how I could go about fixing this?

Also, does one need IMAP to run drupal?

YOu are missing the patch package

sudo zypper in patch

Cheers J.

PS: No you do not need the imap for drupal, but php need the package for rebuilding since there is a php-imap to be build.

For those who would prefer to use YaST, I have put together a tutorial blog on my badzilla site. It is essentially the same, although I went about it in a slightly different way. Like you, my motivation was to get Drupal 6 working correctly. In addition, if you upgraded MySQL during the openSUSE upgrade, then you may need to edit php.ini to specify the new MySQL socket locations. Again, details in my blog.