martes, septiembre 12, 2006

PHP in command line

This post is a bit off-topic of my two last posts to my blog, but just in case someone (maybe me), in the future could have any problem.

Today, I was trying to run a php script in command line. I came across the following link:
http://es2.php.net/manual/en/features.commandline.php

Which was helpful to know that I could do what I want. I needed to check whether my php installation could run as CLI (command line):

linuxserver:/var/www-ssl# php -v

PHP 5.0.5-Debian-0.8~sarge1 (cli) (built: Oct 27 2005 10:43:05) (Debian
GNU/Linux)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.5, Copyright (c) 1998-2004 Zend Technologies
Anyway, when I tried to run the command (which essentially was exporting a Ms Access database into MySQL), I got:
Fatal error: Call to undefined function mysql_connect() in
/var/www-ssl-version0.2/database.inc on line 19

After searching around a little bit, I discovered that I needed to change the php.ini file of the CLI, to be able to load the mysql dynamic library. I went to:
 vi /etc/php5.0/cli/php.ini

and added in the extension part:

extension=mysql.so

But I came across with other problem:


Fatal error: Call to undefined function gzcompress() in /var/www-ssl-version0.2/crypt.class.inc on line 257

Which is solved adding also zlib support:

extension=zlib.so

and off We go! :)

0 comentarios:

Publicar un comentario

Suscribirse a Enviar comentarios [Atom]

<< Inicio