Re: [PHP] mysqldump problem from PHP

2006-10-24 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-10-23 16:34:16 +0100:
  It appears that it could be because the user that runs the scripts is
  not allowed to. When I run them on the commandline, I run them as the
  root user.

that's very simple to check (man su)

  yes I know of CRONtabs but wont this still leave us with the user
  permission of running mysqldump? because essentially it will still be a
  PHP file to run the shell command to create the dump file?

Are you concerned about what user it runs as or what language
it's written in?

 No, cron will typically run as root. You don't need to involve PHP.
 
How are those two things connected at all in the first place?

 It looks to me as if you are trying to use web scripting (PHP) to do the
 sysadmin on your server, for which other methods are more suitable.

Those would be? What makes PHP unsuitable for non-web programming?

Don't write the SMTP server in C, that's only for text editors.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mysqldump problem from PHP

2006-10-24 Thread Chris

Roman Neuhauser wrote:

# [EMAIL PROTECTED] / 2006-10-23 16:34:16 +0100:

It appears that it could be because the user that runs the scripts is
not allowed to. When I run them on the commandline, I run them as the
root user.


that's very simple to check (man su)


yes I know of CRONtabs but wont this still leave us with the user
permission of running mysqldump? because essentially it will still be a
PHP file to run the shell command to create the dump file?


Are you concerned about what user it runs as or what language
it's written in?


No, cron will typically run as root. You don't need to involve PHP.
 
How are those two things connected at all in the first place?



It looks to me as if you are trying to use web scripting (PHP) to do the
sysadmin on your server, for which other methods are more suitable.


Those would be? What makes PHP unsuitable for non-web programming?


I think the point was php doesn't *need* to be used for everything - use 
the best tool for the job.


mysqldump is provided on the system and doesn't need to be called 
through php - what's the point of doing it that way?


I use php for non-web programming at times when I can't find something 
else to do what I want.. most of the time though there's a tool already 
out there somewhere that does exactly what I want already (for sys admin 
tasks).


--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mysqldump problem from PHP

2006-10-24 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-10-24 17:58:45 +1000:
 Roman Neuhauser wrote:
 # [EMAIL PROTECTED] / 2006-10-23 16:34:16 +0100:
 It looks to me as if you are trying to use web scripting (PHP) to do the
 sysadmin on your server, for which other methods are more suitable.
 
 Those would be? What makes PHP unsuitable for non-web programming?
 
 I think the point was php doesn't *need* to be used for everything - use 
 the best tool for the job.

IMO the post I argued was equating PHP with web scripting which is
something else from what you're saying. Besides that you're right of
course. It's just that I can see how PHP could be the best tool for
this job: if your only tool is a hammer...
 
 mysqldump is provided on the system and doesn't need to be called 
 through php - what's the point of doing it that way?

You might want to have some logic around the mysqldump. I would
write such things in a combination of POSIX sh and make, but that's
just my taste.
 
 I use php for non-web programming at times when I can't find something 
 else to do what I want.. most of the time though there's a tool already 
 out there somewhere that does exactly what I want already (for sys admin 
 tasks).

Lucky! ;)

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] mysqldump problem from PHP

2006-10-23 Thread Angelo Zanetti

hi all,

Im doing the following dump through PHP:

$output = shell_exec('mysqldump '. $db_database .'  '. 
$backup_path.$filename);


It doesnt seem to work but when I run the exact same command (with 
appropriate values) in the command line it creates the dump file. What 
could be the reason for this?


Thanks in advance.

regards



Angelo Zanetti
Systems developer


*Telephone:* +27 (021) 469 1052
*Mobile:*   +27 (0) 72 441 3355
*Fax:*+27 (0) 86 681 5885
*
Web:* http://www.zlogic.co.za
*E-Mail:* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mysqldump problem from PHP

2006-10-23 Thread clive

write rights for apache/php user to the $backup_path?

also is apache/php user allowed to run mysqldump?

hi all,

Im doing the following dump through PHP:

$output = shell_exec('mysqldump '. $db_database .'  '. 
$backup_path.$filename);


It doesnt seem to work but when I run the exact same command (with 
appropriate values) in the command line it creates the dump file. What 
could be the reason for this?


Thanks in advance.

regards



Angelo Zanetti
Systems developer


*Telephone:* +27 (021) 469 1052
*Mobile:*   +27 (0) 72 441 3355
*Fax:*+27 (0) 86 681 5885
*
Web:* http://www.zlogic.co.za
*E-Mail:* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]




--
Regards,

Clive

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mysqldump problem from PHP

2006-10-23 Thread Angelo Zanetti



Angelo Zanetti wrote:


hi all,

Im doing the following dump through PHP:

$output = shell_exec('mysqldump '. $db_database .'  '. 
$backup_path.$filename);


It doesnt seem to work but when I run the exact same command (with 
appropriate values) in the command line it creates the dump file. What 
could be the reason for this?


Thanks in advance.

regards

It appears that it could be because the user that runs the scripts is 
not allowed to. When I run them on the commandline, I run them as the 
root user. Is this a common problem? What would the best way be to sort 
this out keeping in mind security on the server?


Thanks in advance.
angelo

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] mysqldump problem from PHP

2006-10-23 Thread Edward Kay
 hi all,
 
 Im doing the following dump through PHP:
 
 $output = shell_exec('mysqldump '. $db_database .'  '.
 $backup_path.$filename);
 
 It doesnt seem to work but when I run the exact same command (with
 appropriate values) in the command line it creates the dump file. What
 could be the reason for this?
 
 Thanks in advance.
 
 regards
 
 
 
 It appears that it could be because the user that runs the scripts is
 not allowed to. When I run them on the commandline, I run them as the
 root user. Is this a common problem? What would the best way be to sort
 this out keeping in mind security on the server?
 
 
 
 If you are trying to automate backups of you database, set up a
 cron job. I
 have a shell script that dumps my databases, zips them and then
 sends them
 via FTP to a remote server. This is automatically run every 12 hours by
 cron.
 
 See http://en.wikipedia.org/wiki/Crontab for more info.
 
 Edward
 
 
 
 

 hi Edward,
 yes I know of CRONtabs but wont this still leave us with the user
 permission of running mysqldump? because essentially it will still be a
 PHP file to run the shell command to create the dump file?

 thanks

No, cron will typically run as root. You don't need to involve PHP.

It looks to me as if you are trying to use web scripting (PHP) to do the
sysadmin on your server, for which other methods are more suitable.

Edward

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mysqldump problem from PHP

2006-10-23 Thread Brad Bonkoski

Edward Kay wrote:

hi all,

Im doing the following dump through PHP:

$output = shell_exec('mysqldump '. $db_database .'  '.
$backup_path.$filename);

It doesnt seem to work but when I run the exact same command (with
appropriate values) in the command line it creates the dump file. What
could be the reason for this?

Thanks in advance.

regards



  

It appears that it could be because the user that runs the scripts is
not allowed to. When I run them on the commandline, I run them as the
root user. Is this a common problem? What would the best way be to sort
this out keeping in mind security on the server?




If you are trying to automate backups of you database, set up a
  

cron job. I


have a shell script that dumps my databases, zips them and then
  

sends them


via FTP to a remote server. This is automatically run every 12 hours by
cron.

See http://en.wikipedia.org/wiki/Crontab for more info.

Edward




  

hi Edward,
yes I know of CRONtabs but wont this still leave us with the user
permission of running mysqldump? because essentially it will still be a
PHP file to run the shell command to create the dump file?

thanks



No, cron will typically run as root. You don't need to involve PHP.

It looks to me as if you are trying to use web scripting (PHP) to do the
sysadmin on your server, for which other methods are more suitable.

Edward

  
#1. You can run mysqldump with the same flags a the mysql command 
line... i.e. -u=user --password=password

#2. Crons run as the user that owns the crontab, not always root.
#3. Edward is right, PHP is a wonderful tool, not sure the tool was 
meant to do the types of things you are trying to do...unless you could 
fill us in with more details of what the purpose is, then we might be 
able to give more insight into how.


-B

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mysqldump problem from PHP

2006-10-23 Thread Angelo Zanetti



Edward Kay wrote:


Angelo Zanetti wrote:

   


hi all,

Im doing the following dump through PHP:

$output = shell_exec('mysqldump '. $db_database .'  '.
$backup_path.$filename);

It doesnt seem to work but when I run the exact same command (with
appropriate values) in the command line it creates the dump file. What
could be the reason for this?

Thanks in advance.

regards

 


It appears that it could be because the user that runs the scripts is
not allowed to. When I run them on the commandline, I run them as the
root user. Is this a common problem? What would the best way be to sort
this out keeping in mind security on the server?
   



If you are trying to automate backups of you database, set up a cron job. I
have a shell script that dumps my databases, zips them and then sends them
via FTP to a remote server. This is automatically run every 12 hours by
cron.

See http://en.wikipedia.org/wiki/Crontab for more info.

Edward


 



hi Edward,
yes I know of CRONtabs but wont this still leave us with the user 
permission of running mysqldump? because essentially it will still be a 
PHP file to run the shell command to create the dump file?


thanks

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mysqldump problem from PHP

2006-10-23 Thread David Giragosian

Angelo, as Brad says, you can pass user and password args to mysqldump from
an include file.

I run a php backup script via cron every night, then tar and compress and
store in various dirs out of the web tree.

I have the script if you'd like. It came from someone on the php-db list
years ago, and I'm not in any way claiming credit for it.

David


On 10/23/06, Brad Bonkoski [EMAIL PROTECTED] wrote:


Edward Kay wrote:
 hi all,

 Im doing the following dump through PHP:

 $output = shell_exec('mysqldump '. $db_database .'  '.
 $backup_path.$filename);

 It doesnt seem to work but when I run the exact same command (with
 appropriate values) in the command line it creates the dump file.
What
 could be the reason for this?

 Thanks in advance.

 regards




 It appears that it could be because the user that runs the scripts is
 not allowed to. When I run them on the commandline, I run them as the
 root user. Is this a common problem? What would the best way be to
sort
 this out keeping in mind security on the server?



 If you are trying to automate backups of you database, set up a

 cron job. I

 have a shell script that dumps my databases, zips them and then

 sends them

 via FTP to a remote server. This is automatically run every 12 hours
by
 cron.

 See http://en.wikipedia.org/wiki/Crontab for more info.

 Edward





 hi Edward,
 yes I know of CRONtabs but wont this still leave us with the user
 permission of running mysqldump? because essentially it will still be a
 PHP file to run the shell command to create the dump file?

 thanks


 No, cron will typically run as root. You don't need to involve PHP.

 It looks to me as if you are trying to use web scripting (PHP) to do the
 sysadmin on your server, for which other methods are more suitable.

 Edward


#1. You can run mysqldump with the same flags a the mysql command
line... i.e. -u=user --password=password
#2. Crons run as the user that owns the crontab, not always root.
#3. Edward is right, PHP is a wonderful tool, not sure the tool was
meant to do the types of things you are trying to do...unless you could
fill us in with more details of what the purpose is, then we might be
able to give more insight into how.

-B

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php