You are here:  » Php import

Support Forum



Php import

Submitted by Bob on Thu, 2007-11-15 13:41 in

Hi there,

I've been trying to import feeds through the command line on my Linux server but I am getting this message:

PHP Fatal Error: Call to undefined function mysql_escape_string in includes/database.php on line 52

Does this mean that PHP cannot be run through the scripts directory?

Many Thanks.

Bob

Submitted by support on Thu, 2007-11-15 13:53

Hello Bob,

That message means that the command line version of PHP on your server does not have the MySQL libraries installed. The command line version is a different file on the server to the one that runs when you browse a webpage written in PHP.

To resolve this, you will need to contact your host and ask them to "add MySQL support to the PHP CLI binary" - they should know what this means!

Cheers,
David.

Submitted by Bob on Thu, 2007-11-15 14:04

Well "they should know what this means" is probably correct but in this case I am running my own server now :) So it's MySQL libraries missing right?

Many Thanks.

Bob

Submitted by Bob on Thu, 2007-11-15 14:30

OK I will the way to fix it. Let me ask you this question David.

Submitted by support on Thu, 2007-11-15 14:31

Hi Bob,

Yes it's the libraries.

When PHP is compiled, a number of flags are used, and it needs to have --with-mysql to enable the MySQL function. This is added to the configure statement, so if you have the PHP source installed, you would configure and build like this:

$./configure --with-mysql
$make
$make install

But there would need to be all sorts of other --with's depending upon your setup and what other libraries you have installed. The configure line I use for PHP on my server (v5.1.4) is:

./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-zlib --with-gd --enable-mbstring --enable-soap

As long as you stick to the standard libraries bundled with PHP there shouldn't be any security issues.

Hope this helps,
Cheers,
David.

Submitted by Bob on Thu, 2007-11-15 14:47

David thanks a lot for that. I am now thinking about sticking to the browser import as there seem to be some issues with those libraries such as updates and conflicts that I am not very keen to see. Maybe I will install those later on. What's the speed gain when importing through the command line? 20%?

Many Thanks.

Bob

Submitted by support on Thu, 2007-11-15 14:50

Hi Bob,

There's not actually any speed gain, it's more there for either automation or if you have timeout problems when importing through the browser. As you have your own server, there won't be any timeout issues (or at least if there are you can remove them) so using the browser is fine...

Cheers,
David.

Submitted by Bob on Thu, 2007-11-15 14:58

Alright. I see. I thought I would get some speedier imports through the command line. Brilliant. Thanks a lot for your support David.