You are here:  » Fatal error: Call to undefined function with SSH

Support Forum



Fatal error: Call to undefined function with SSH

Submitted by hansi on Sun, 2006-11-05 00:26 in

Hello,

I bought "Price Tapestry" yesterday. I have to import large csv files into the database.
I registered the .csv with the adminmenu and tried to import it with SSH:

php import.php filename.csv

But I get errors:

Fatal error: Call to undefined function: mysql_escape_string() in
/var/www/web42/html/comparison/includes/database.php on line 53

Maybe someone can help?

Best regards,
Hani

Submitted by support on Sun, 2006-11-05 03:28

Hello Hani,

I think what has happened here is that the command line version of PHP on your server has been compiled without MySQL support. Would you be able to check this with your host?

I presume that you can import OK via the web interface? If that's the case then i'm pretty sure this is what's happened as PHP has probably been compiled as an Apache module with different build parameters and does include MySQL.

The first thing I would recommend doing would be to run the MySQL version test script from the command line:

version.php

<?php
  $link 
mysql_connect("localhost","username","password");
  print 
"<p>PHP Version ".phpversion()."</p>";
  print 
"<p>MySQL Version ".mysql_get_server_info($link)."</p>";
?>

Change username and password as required, then run in from SSH as before:

php version.php

If that gives mysql_connect() not found then it is definitely the case that the command line version of PHP on your server does not have MySQL support.

Hope this helps,
Cheers,
David.

Submitted by hansi on Sun, 2006-11-05 17:56

Hello David,

I have test it with your version.php and you are right. I got the mysql error. But I don't have any problems to dump the wikipedia database (7,8 GB)with a php script into mysql with SSH. How can I compile my php to have mysql support?

Submitted by support on Sun, 2006-11-05 17:58

Hello hansi,

You would need to contact your host i'm afraid as compilation of PHP is a complex task. If you explain that you are running a PHP script from the command line and need to have MySQL compiled in they should be able to help.

If you are not able to get PHP recompiled let me know as there is a workaround that you might be able to use, provided that you are able to import through the web interface without any timeout problems.

Cheers,
David.

Submitted by hansi on Sun, 2006-11-05 19:16

Hello David,

I own a Debian Linux Server with 2 X 3GH Dualcore Pentium CPU's and I set the restictions in php.ini to very high:
post_max_size = 1000M
upload_max_filesize = 1000M
max_execution_time = 6000 ; Maximum execution time of each script, in seconds
max_input_time = 120000 ; Maximum amount of time each script may spend parsing request data
memory_limit = 1000M ; Maximum amount of memory a script may consume (8MB)

But if I try to import a file.csv, it only has 18 MB, I get a blank page after 5 minutes.
In site home it displays only "0":

Product search results for merchant:Gameworld.de: (showing 1 to 10 of 16037)
Order by: Relevance, Product Rating | Price: Low to High, High to Low
10010000100001886000000000000000000000000000000000000000000.00
10010000100001886000000000000000000000000000000000000000000.00

10010000100001886000000000000000000000000000000000000000000.00
€999999999.99
More Information
101000083129989160000000000000000000000000000000000000.00
101000083129989160000000000000000000000000000000000000.00

101000083129989160000000000000000000000000000000000000.00
€999999999.99
More Information
1010030122249921600000000000000000000000000000000000000.00
1010030122249921600000000000000000000000000000000000000.00

1010030122249921600000000000000000000000000000000000000.00
€999999999.99
More Information
10201500199915140000000000000000000000000000000000000.00
10201500199915140000000000000000000000000000000000000.00

10201500199915140000000000000000000000000000000000000.00
€999999999.99
More Information
1022110210224444200000000000000000000000000000000000000000000000.00
1022110210224444200000000000000000000000000000000000000000000000.00

1022110210224444200000000000000000000000000000000000000000000000.00
€999999999.99
More Information
10222102102244442000000000000000000000000000000000000000000000000.00
10222102102244442000000000000000000000000000000000000000000000000.00

10222102102244442000000000000000000000000000000000000000000000000.00
€999999999.99
More Information
1022310210224444000000000000000000000000000000000000000000000000.00
1022310210224444000000000000000000000000000000000000000000000000.00

1022310210224444000000000000000000000000000000000000000000000000.00
€999999999.99
More Information
1022410210224444200000000000000000000000000000000000000000000000.00
1022410210224444200000000000000000000000000000000000000000000000.00

1022410210224444200000000000000000000000000000000000000000000000.00
€999999999.99
More Information
10228102102244437000000000000000000000000000000000000000000000000.00
10228102102244437000000000000000000000000000000000000000000000000.00

10228102102244437000000000000000000000000000000000000000000000000.00
€999999999.99
More Information
1022910210224444200000000000000000000000000000000000000000000000.00
1022910210224444200000000000000000000000000000000000000000000000.00

1022910210224444200000000000000000000000000000000000000000000000.00
€999999999.99
More Information
Previous | 1 2 3 4 5 6 7 8 9 | Next

Would you tell me your workaround?
Thanks!

Best Regards,
Hansi

Submitted by support on Sun, 2006-11-05 19:41

Hi Hansi,

This sounds like two separate issues here. It looks like maybe the feed has been registered with the wrong format or field mapping. Would you mind sending me a link to your admin page so that I can take a look - reply to your reg code email or forum registration email is the easiest way...

Cheers,
David.

Submitted by hansi on Sun, 2006-11-05 20:49

Hello David,

I already have send you the URL to the admin of a clean installation of Price Tapestry.
Hope you can help.
Thanks!

Regards,
Hansi

Submitted by hansi on Mon, 2006-11-06 00:14

Hello David,

could you import it without timeout?
How can I do that?

Thanks!

Submitted by support on Mon, 2006-11-06 07:14

Hi,

It looks like the import completed OK, so the timeout you are seeing may well be from a proxy server or your own browser. The script is designed to work even if the client browser disconnects - all I did was click "Import" after registering the feed and running a trial import. This means that your server is not imposing the timeout (which is good), so you can just click "Import" and then wait for the process to complete.

Did you get my email reply about the registration and character set of your site? I also sent you a faster version of Magic Parser (for CSV files) which may speed things up.

Cheers,
David.

Submitted by hansi on Mon, 2006-11-06 20:06

Hello David,

yes I could solve the charakter-proplem yesterday after I read it on your forum.
You wrote:" Because you have not got MySQL
working for the command line version of PHP".
Today I tried it again and I got the same mysql error with putty but... I could dump the whole wikipedia database.xml (7,8 GB) into mysql with putty (ssh) without problems. I used:
php maintenance\importDump.php

Submitted by support on Tue, 2006-11-07 08:06

Hello hansi,

Is importDump.php a private script, or would you be able to send me a copy so I can see what MySQL functions it is using - that will help work out why the version.php script doesn't work.

You can reply to your reg code or forum registration email is the easiest way if you are able to send it to me...

Cheers,
David.

Submitted by hansi on Tue, 2006-11-07 15:49

Hello David,

I allready send you a mail with description of the file.
Thanks!

Hansi

Submitted by support on Tue, 2006-11-07 16:29

Hi Hansi,

I haven't yet received your email with this file (or your description) - can you resend it?

I need to see what mysql functions it is using...

Thanks,
David.

Submitted by hansi on Tue, 2006-11-07 19:58

Hi David,

I have resend it.

Submitted by hansi on Wed, 2006-11-22 23:49

Hello David,

I cant register a csv file from command line but if I enter "php -v" , I see, that CLI (command line) is installed:

"PHP 4.3.10-18 (cli) (built: Nov 3 2006 21:56:29)
Copyright (c) 1997-2004 The PHP Group"

What do you say about that?

Regards,
hani

Submitted by support on Thu, 2006-11-23 08:06

Hello Hani,

The problem is not that the command line version is not installed; but that I don't think MySQL is compiled into it. This can be checked in fact if you enter "php -m" this will show the compiled in modules. Can you do this on your server and post the results. This is what you see on my server:

~$ php -m
[PHP Modules]
ctype
date
dom
hash
iconv
libxml
mbstring
mysql
pcre
PDO
posix
Reflection
session
SimpleXML
soap
SPL
SQLite
standard
tokenizer
xml
xmlreader
xmlwriter
zlib
[Zend Modules]

The crucial thing is whether mysql appears in that list on your server.

Cheers...
David.

Submitted by hansi on Tue, 2007-01-16 15:14

Hello David,
could you help me?
if I try "php -m" in ssh, I see this:

root18:~# php -m
[PHP Modules]
bcmath
bz2
calendar
ctype
dba
dbx
exif
filepro
ftp
gd
gettext
iconv
ionCube Loader
mbstring
mime_magic
mysql
openssl
overload
pcre
posix
session
shmop
sockets
standard
sysvmsg
sysvsem
sysvshm
tokenizer
Upload Progress Meter
wddx
xml
xmlrpc
yp
zip
zlib

[Zend Modules]
the ionCube PHP Loader

Submitted by support on Tue, 2007-01-16 15:26

Hello Hansi,

Can you try the version.php script in the second message in this thread again - it is possible that your host has upgraded the version of PHP since you last tried to do this.

If you could post the output when you try to run it from the command line that will help...

$php version.php

Cheers,
David.

Submitted by hansi on Tue, 2007-01-16 15:48

Hello David,

I get this after "php version.php":

PHP Version 4.4.4MySQL Version 4.0.24_Debian-10sarge2-log

Submitted by support on Tue, 2007-01-16 15:52

Hello Hansi,

Sorry to be a pain, can you try this version which prints the mySQL error message (if any); just incase the error is supressed.

<?php
  $link 
mysql_connect("localhost","username","password");
  print 
"<p>MySQL Error: ".mysql_error()."</p>";
  print 
"<p>PHP Version ".phpversion()."</p>";
  print 
"<p>MySQL Version ".mysql_get_server_info($link)."</p>";
?>

Now, if that doesn't display any additional information; it looks like your host has upgraded the CLI version of PHP on your server. Can you try using the automation scripts again and see if it now works...

Cheers,
David.

Submitted by hansi on Tue, 2007-01-16 16:13

Hello David,

I think, that I can run this correctly, because I register a csv-feed and try it to import it via ssh. Now I don't get any errors:

root18:/var/www/web42/html/preis/scripts# php import.php Abopool-DE.csv
importing Abopool-DE.csv...[done]
backfilling reviews...[done]

Submitted by hansi on Tue, 2007-01-16 16:16

I think, now It runs correctly:

root18:/var/www/web42/html/price/scripts# php import.php Abopool-DE.csv
importing Abopool-DE.csv...[done]
backfilling reviews...[done]

Submitted by support on Tue, 2007-01-16 16:21

Hi Hansi,

Yes - that looks fine now!

Cheers,
David.