Re: MySQL upload problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Chris wrote:
tedd wrote:

I was thinking that I could ftp the sql file to the clients server and then run a php script on his server, something like:

$sql = "mysql  -h$dbhost -u$dbuser -p$dbpass $dbname < $filename";
system($sql);

But, that didn't work -- however -- using mysqldump did download the file. So, I'm close.


Actually reading the php site:

http://php.net/system

With safe mode enabled, the command string is escaped with escapeshellcmd().

Then http://www.php.net/manual/en/function.escapeshellcmd.php:

Following characters are preceded by a backslash: #&;`|*?~<>^()[]{}$\, \x0A and \xFF.

So your < is being replaced with \< which is why it wouldn't work.


Right. You could try mysqlimport to get around using the < instead. Strip out all but the ddl statements (CREATE TABLE and friends) and place them into separate files for each table. That is, name each file for the table its data corresponds to. Upload the ddl stuff with phpMyAdmin, then import the data with mysqlimport through your script.

However, i think you might need FILE privilege.

Instead of putzing around with your existing dump file to copy everything out, you could import everything to a local database (if you don't have it already) and dump out each table to a separate file.

brian

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux