My ultimate goal is to install OwnCloud on my Debian box, a 64-bit squeeze.

My setup is pretty simple. I have installed OpenPanel which in turn installs all of the required LAMP modules via APT-GET. This installs PHP5.3.7 on my system, and points Apache2 to use it, all nice and proper.

However, OwnCloud requires mbstring to be enabled in PHP. This requires me to compile my own version of PHP with the --with-mbstring configuration option, as the PHP bundled in the Debian repositories seemingly won't have that, and there is no such package as php-mbstring or php5-mbstring as there used to be with PHP4.

I have compiled the PHP using the tutorial found here, omitting APXS2 from the config (as I couldn't get it to work for the love of me) and substituting 5.2 with 5.4. However, the Apache2 installed by APT-GET (in /etc/apache2) will not recognize this, and continues to say "5.3.7".

I have also tried to first compile the PHP, and then install OpenPanel, to no avail.

Having OpenPanel is essential, as it will help my customers manage their DNSs, domains, and databases, as well as Shell access.

Having OpenCloud is necessary also, because my clients require the use of an opensource collaboration suite.

How do I achieve this.

(Previously asked on stackoverflow.com but figured it didn't belong there.)


Debian can actually help you here--apt-get has a mode for downloading the source and build-dependencies for a package, which you can then tweak and build yourself. In theory, the setup should be identical to what Debian's repository contains, so it ought to integrate well with your version of Apache.

I originally found this is PHP Magazine where they used it to customize the version of GD they were compiling with PHP. But you could use it for changing other build flags just as easily.


Since the original site isn't available any more (link above is through the Way Back Machine), I'm reproducing the instructions here:

# Install build tools, debian helpers and fakeroot
apt-get install build-essential debhelper fakeroot
# Get PHP source (it should go into /usr/src)
cd /usr/src
apt-get source php5
# Install all packages required to build PHP5
apt-get build-dep php5

#Now what we need is to update compile options,
# so we need to edit debian/rules file:
cd php5-5.2.6.dfsg.1
vim debian/rules
# locate the line having "--with-gd=shared,/usr --enable-gd-native-ttf \"
# replace with "--with-gd=shared --enable-gd-native-ttf \"
# that's remove reference to /usr so that bundled library is used

# compile (drink some coffee, walk you dog, see the latest House episode)
dpkg-buildpackage -rfakeroot

# install the new php5-gd package
cd ..
dpkg -i php5-gd_5.2.6.dfsg.1-3ubuntu4.2_i386.deb

# finally restart apache
/etc/init.d/apache2 restart

Obviously, change the version number to match the version you're actually compiling, and replace the flags with the ones you actually want.

| improve this answer | |
  • I'd up vote this once more if I could. – Milad Naseri Jun 16 '14 at 9:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.