Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

command not working

Posted on 2009-05-08
2
Medium Priority
?
171 Views
Last Modified: 2012-05-06
I have a client that has 2 cpanel servers with me running joomla installations.  He needs to execute this command within joomla I believe.  One of the servers the command works just fine, the other though, it doesn't even though they're very similar builds.

$command="nohup mysql -u ".$user." -p".$password." ".$dbname." < ".$sqlfile;
passthru($command);

It's not seeming to work and he did get it sort of work, but he's sitll saying there are problems.  He used this command to get past it:

$command="/usr/bin/mysql -u ".$user." -p".$password." ".$dbname." < ".$sqlfile;
$sqlit=passthru($command);

What Changed was:"nohup mysql -u " to  "/usr/bin/mysql -u "

Does anyone know what's going on and why nohup would work on the one server and not on the other.
0
Comment
Question by:allwebnow
2 Comments
 
LVL 34

Accepted Solution

by:
Beverley Portlock earned 1200 total points
ID: 24339183
Do not use -p for the password as this prompts an interactive input. Use --password instead like so

$command="/usr/bin/mysql -u ".$user." --password=".$password." ".$dbname." < ".$sqlfile;
$sqlit=passthru($command);
0
 
LVL 2

Assisted Solution

by:lavinpj1
lavinpj1 earned 800 total points
ID: 24339210
-p prompts for a password, -pPasswordhere doesn't.

Phil
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
In this article, we’ll look at how to deploy ProxySQL.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question