Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6331699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:07:12+00:00 2026-05-24T18:07:12+00:00

I can’t find any question exactly like this. If I’m wrong please point me

  • 0

I can’t find any question exactly like this. If I’m wrong please point me to the right answer about this.

I have the following situation:

I need to run a script in the cron job (no problem), the problem is in my script, something is wrong, ’cause the script is not running properly.

NOT WORKING SCRIPT

<?php

$command = 'mysql -u root -h localhost eephi < C:/wamp/www/file-20110817-0200.sql';
system( $command );

?>

The most weird is, the command -> mysql -u root -h localhost eephi < C:/wamp/www/file-20110817-0200.sql when executed is a shell, works perfect, no errors, everything run fine. But when I call the command in a php script like is showed above it is not working, no errors, no warnings, nothing is outputed.

I have another script doing something similar, but not the same, but the idea is the same.. and it works fine.

WORKING SCRIPT

$command = 'mysqldump -u user -p****** -h myhost.com mytable > /home/user/www/backup/file-20110817-0200.sql';
system( $command );

?>

Then what is the difference between the two scripts? one works fine and another one not.. WEIRD to me. I hope I can find a solution here. Thanks anyway for your time.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T18:07:13+00:00Added an answer on May 24, 2026 at 6:07 pm

    Probably a path error – executing things from within PHP has a different environment than from the command line. You’ll probably have to provide a full path to mysql in your exec (e.g. /usr/local/bin/mysql ...)

    You can capture the shell’s error messages by appending 2>&1 to the end of the command. This’ll redirect stderr to stdout so PHP sees the error messages as part of the command’s output.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can somebody point me to a resource that explains how to go about having
Can anyone (maybe an XSL-fan?) help me find any advantages with handling presentation of
Can someone maybe tell me why this is not working? I have used echo
Can anyone help me trying to find out why this doesn't work. The brushes
can any one tell me how can change this java code into objective c.is
I have some data like this: 1 2 3 4 5 9 2 6
Can I run this in a Windows command prompt like I can run it
Can anyone tell me how I can display a status message like 12 seconds
I have a jquery bug and I've been looking for hours now, I can't
Can anybody shed some light on getDay() in Javascript please. Here datepicker is textbox

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.