Recompile PHP with iodbc

From TechWiki

Jump to: navigation, search

These steps are required to run structWSF on x_64 bit ubuntu (and probably most linux distro's). There is an error in the unixodbc drivers which means that when you get to the load_ontologies.php step in the constructscs/structwsf installation guide it will fail with core dumps in Apache. The procedure below recompiles/packages the current PHP 5 release to work with iodbc. An alternative ODBC driver.

Create a working directory (e.g., in your home dir):

mkdir packages

Enter the directory:

cd packages

Install dev tools that'll help you build debian packages:

sudo apt-get install devscripts
sudo apt-get install gcc debhelper fakeroot

Get the PHP source:

apt-get source php5

Enter the PHP directory:

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 unixodbc package as we'll be using iodbc instead:

sudo apt-get remove unixodbc

Replace rules and control file in the php5-5.x.y/debian directory by downloading rules.txt and control.txt. These files change the dependencies from unixodbc to iodbc for the build process.

(Note: still need to update with specific changes.)

Install iodbc and iodbc-dev:

sudo apt-get install iodbc libiodbc2-dev

OPTIONAL - If PHP is already installed you will need to update the version number of this package to be greater than the one installed.

debchange -v <version number>

Run the command: (While in the php5-5.x.y directory)

debuild

Note - This could take up to an hour to fully compile the PHP packages depending on your machine's specs. When completed, it should display a range of new debian packages built and ready to be installed.

ls ../*deb

Install package apache2-mpm-prefork.

sudo apt-get install apache2-mpm-prefork

Install packages (replacing <version_no> with the version number you may have created in step 9):

sudo dpkg -i php5-common_<version_no>_amd64.deb php5-cgi_<version_no>_amd64.deb php5-cli_<version_no>_amd64.deb php5-curl_<version_no>_amd64.deb libapache2-mod-php5_<version_no>_amd64.deb php5-mysql_<version_no>_amd64.deb php5-odbc_<version_no>_amd64.deb php5_<version_no>_all.deb
Personal tools