Solved

command not working

Posted on 2009-05-08
2
163 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
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 200 total points
ID: 24339210
-p prompts for a password, -pPasswordhere doesn't.

Phil
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article discusses how to create an extensible mechanism for linked drop downs.
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…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

773 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