Hello and thanks for reading my question.
I've been searching around for a few hours now with no luck, I'm trying to run a php script via cron job via the URL.
After about 15 minutes I figured out that I should use wget rather than php, I'm not sure if that is correct thinking or not.
The url i'm trying to run is
http://www.mydomain.com/bla/ftp.php?password=secret&db=mydb&ftp=source1
dbase will run mysql dump on "mydb" for example and ftp source1 is where to send the file to.
/usr/bin/wget -O - -q http://www.mydomain.com/bla/ftp.php?password=secret&db=mydb&ftp=source1
If I run this from the browser it works great!
When I run it from cron wget I get the following error
[MYSQL_DUMP]</b> Failed to select Data Base
Now this of course is my error coding in the file
IF ( $_GET['password'] !== SCRIPT_PWD ){
die('Access Denied');
}
IF ( array_key_exists( $_GET['db'], $db ) ){
$dbSel = $_GET['db'];
IF ( array_key_exists( $_GET['ftp'], $ftp ) ){
$ftpSel = $_GET['ftp'];
( $ftp[$ftpSel]['Mode'] ) ? $ftp[$ftpSel]['ModeT'] = 'Passive' : $ftp[$ftpSel]['ModeT'] = 'Active';
( $ftp[$ftpSel]['Type'] == 2 ) ? $ftp[$ftpSel]['TypeT'] = 'Binary' : $ftp[$ftpSel]['TypeT'] = 'ASCII';
$ftp[$ftpSel]['ModeT'] = $ftp[$ftpSel]['ModeT'] . ' '. $ftp[$ftpSel]['TypeT'];
}ELSE{
$ftpSel = FALSE;
}
}ELSE{
$dbSel = FALSE;
}
Later on in the code if dbSel is false then I'll get
[MYSQL_DUMP]</b> Failed to select Data Base
so it's like it is not picking up the second and probably the 3 parameters.