Pedro's blog: db2, mysql, php, linux and performance


Apache died after updating Ubuntu, pdo_ibm.so and php_pdo_declare_long_constant
06/02/2010, 12:51
Filed under: Apache,DB2,GNU/Linux,PHP | Tags: , , , , ,

After some months I installed my Ubuntu Server, yesterday I decided to update it, so:

$ apt-get update

$ apt-get upgrade

Between all the packages I found out php5, php5-dev, php5-common, php5-cli and libapache2-mod-php5, none of them should be dangerous… or maybe yes. I reboot and… crap, Apache doesn’t work! I tried to restart the daemon and got nothing, didn’t want to work. I took a look to the /var/log/apache2/error.log and I found:

/usr/sbin/apache2: symbol lookup error: /usr/lib/php5/20060613/pdo_ibm.so: undefined symbol: php_pdo_declare_long_constant

Something was wrong with the pdo_ibm module… I reinstalled again:

$ wget http://pecl.php.net/get/PDO_IBM-1.2.5.tgz

$ tar zxvf PDO_IBM-1.2.5.tgz

$ cd PDO_IBM-1.2.5

(Removed the line with the PDO dependency from the package.xml file: <dep type=”pkg” rel=”has” version=”1.0.0″>PDO</dep>)

$ pecl uninstall package.xml

$ pecl install package.xml

I tried again /etc/init.d/apache start and still didn’t work, so I decided to reinstall PDO:

$ pecl uninstall pdo

$ pecl install pdo

And after started apache /etc/init.d/apache start it worked!



DB2, the date and PHP
04/02/2010, 18:58
Filed under: General | Tags: , , , ,

Here comes the trick:

The common format when I get a date row from the db2 database is:

echo $date; //gets 2010-02-04 18:21:42

How did I make the magic with php:

$date        = strftime(“%d/%m/%Y”, strtotime($date));

echo $date; //gets 04/02/2010

Source: http://php.net/manual/en/function.strftime.php



Disable log on htaccess
30/01/2010, 9:45
Filed under: General,PHP,Security | Tags: , ,

How to disable the logging function of a well defined php script with the htaccess file?

SetEnvIf Request_URI “^/yourdir/yourfile\.php$” dontlog