Solved

command not working

Posted on 2009-05-08
2
161 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 300 total points
Comment Utility
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 200 total points
Comment Utility
-p prompts for a password, -pPasswordhere doesn't.

Phil
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now