Create a directory for compiling the source code in.
$ mkdir source
$ mkdir source/php5
$ cd source/php5/
Get the source code package from the source repository. (Note you don't need root privileges for this step as you're not installing anything, just downloading the source to your personal directory).
$ apt-get source php5
Install the other packages needed by the source code to compile.
$ sudo apt-get build-dep php5
In the downloaded source code there is a file
php5-5.1.2/debian/rules
. Add --with-tidy
to the end of the list of options in COMMON_CONFIG
. Now compile the modified source.
$ cd php5-5.1.2
$ dpkg-buildpackage -rfakeroot -uc -b
and install the newly created packages.
$ cd ..
$ sudo dpkg -i *.deb
Apache is automatically restarted as part of the build process, and a quick check with
phpinfo()
shows the new compile date and lists the tidy module.UPDATE
When the package manager next downloads the latest version of php5, your changes will be overwritten. So be careful what boxes you tick when it asks you what to update. To get the latest version with your changes added to it repeat the above process. Easy enough for a simple one line change, but for bigger changes you should create a diff file, or manage your version in svn.
3 comments:
Thanks Alex, for posting this on the off chance someone else finds it useful. I certainly did!
Glad to help. I might just post a bit more often now.
Thanks Alex. I've followed these instructions twice now, since the update from php5-5.1.2-1ubuntu3.3 to php5-5.1.2-1ubuntu3.4 STILL did not implement --with-tidy in the compile, even though this is listed as an ubuntu bug! Very useful!
Post a Comment