Compiling the PDO_4D extension in recent versions of PHP5
Are you running Ubuntu 12.04 LTS? Are you working in PHP5? Do you need to access 4D database hosted on an external server? Have you discovered that PDO_4D won't compile when downloaded via PECL? Have I narrowed this to 0.001% of the world yet? Still with me? Well! That is exciting.
Here is how you can compile and install PDO_4D:
# Install dependencies (You may need more) sudo apt-get install php5-dev # Get most recent copy of the code svn checkout http://svn.php.net/repository/pecl/pdo_4d/trunk pdo_4d cd pdo_4d # Prepare the PHP extension for compiling phpize # Fix problem with generated configure pointing to incorrect header location. # See: https://bugs.php.net/bug.php?id=63902 sed -i -e 's/php\//php5\//g' configure # Configure the package to the system ./configure --with-pdo-4d # Copy fourd.h to the main directory. Note: This is not the correct way to # fix this problem, but it works to get the extension compiled. cp lib4d_sql/fourd.h . # Compile! make # Copy the extension to PHP's library sudo make install # Create php5 module configuration file sudo sh -c "echo extension=pdo_4d.so > /etc/php5/conf.d/pdo_4d.ini" # Restart apache sudo apache2ctl restart # Check for PDO_4D in the PHP CLI Information php -i | grep 4D
The last command should return something along the lines of
PDO drivers => 4D, mysql PDO Driver for 4D => enabled Provided by => 4D (http://www.4d.com), and Alter Way (http://www.alterway.fr) This program makes use of the 4D SQL protocol: <br />4D v11 and up, Copyright (c) 2009 4D<img src="?=PDO_4D_LOGO_ID" align="right" alt="4D logo" border="0">
Wasn't that fun!?
Update 7/12/13: If you need to export/dump a 4D database to a MySQL formatted SQL file, this will help: https://github.com/famsf/4d-mysqldump