Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Using System/exec, How To Backup Database?


system("mysqldump --opt myDatabase > backup.sql");

here are my problems,

i don't think it works on the webserver. next, where exactly the file, backup.sql be place if it does succeed.

i believe we just can't execute commands on the webserver can we?

i also tried using the sql query BACKUP TABLE ... TO .. but i'm guessing the problem lies with the TO... how do i know what directory shall i place it therE?

for instance, my pages are placed in,

home/myname/public_html/...

i tried to put
home/myname/public_html/backup in the TO but nothing happens.




View Complete Forum Thread with Replies

Related Forum Messages:
Database Backup Using Exec & Mysqldump
Im trying to get a database backup using ...

<?php

exec("mysqldump -ulogin -ppassword database > file.sql");

?>

but the resulting file file.sql is written but is empty can anyone suggest where im going wrong.

View Replies !
MySQL Database Backup - Restore Certain Tables Into The Database
I am stuck with a MySQLdatabase backup. Now I wish to restore certain tables into the database.

View Replies !
PHP System() And Exec()
Background: I am trying to execute a binary on the server located in the current directory where the php script is being run. The server is a linux (debian based). I am having trouble getting php to execute the binary properly, below is my code. Code:

View Replies !
System() And Exec()
If you start a program using this function and want to leave it running in the background, you have to make sure that the output of that program is redirected to a file or some other output stream or else PHP will hang until the execution of the program ends.

I have tried numerous time by redirecting to a file or other stream to free up a php web page that called a perl script for example, but the php script always hangs...has anyone had any luck freeing up a calling php script from a process, or program that it launched in the background? Code:

View Replies !
Exec(), System()
I write very, very simple script who call external program. The script is run on Linux Slackware, Apache/1.3.37 (Unix) mod_ssl/2.8.28 OpenSSL/0.9.8b PHP/4.4.4 here is my script:

<?php
echo exec('ls');
?>
this work properly.

but if i write:

<?php
echo exec('xine'); //xine is a multimedia player
?>

View Replies !
Bug In System And Exec Commands
If PHP is running via a web server, and mutiple system
calls are made within the script to another script,
hundreds of processes are created. Here is an example:

Script 1:
<?php
for ($i=1; $i<=5; $i++) {
system("php script2.php");
}
?>

Script 2:
<?php
exit;
?>

The effect is the same (and more difficult to stop) when
the system calls are made in the background. e.g.

system("php script2.php >>/dev/null 2>>/dev/null &");
system("php script2.php >/dev/null 2>&1");

I have even tried calling a shell script, which in turn
calls the second PHP script (both in the background), but
it still causes lots of processes.

The "exec" command is also affected.

At first, I thought this was a problem with either Zeus web
server of Fast CGI, but I have since tried it with Apache
and normal CGI with the same effect.

Does anyone have any idea why this happens and whether there is any way to prevent it? I have posted a bug report to bugs.php.net (ID 14997), but so far to no avail.

View Replies !
System() Or Exec() And Permissions
I'm trying to run a command (mogrify) that requires that I'm logged in as root, or at least I think this is the case. How can I do this?

View Replies !
Exec() And System() Problems
I am trying to use php's exec() or system() to execute a shell script that I wrote.

exec and system() work fine with a simple command like ls, but nothing happens when I point it at the shell script.

The shell script works fine from my shell login. Can't figure out what tho problem is. Is php just incapable of running shell scripts?

View Replies !
Using Passthru(), Exec(), System() Etc.
I have an executable that runs as expected from a command prompt but seems to do nothing when I try to run it from php, using passthru(), exec(), etc.

View Replies !
System/shell/exec/etc
I've got PHP 5.1.6, Apache 2.2.2, on Fedora 5. Everything is great except that when I use an of the external launching commands, persistent apps dont stay open. I have a simple shell script set up to load an app, and I have it write a PID file. Immediately after calling exec (milliseconds later) the PID is alive. However, within a few more milliseconds it seems to close.

I've made sure that the apache uid/gid have full access to the script and the apps it calls. When sudo'ing manualy in a shell with the apache uid, the script works flawlessly and loads the program, and stays open, as it should. I've verified that the app loads under the uid 'apache' with ps. When running it through PHP, it seems to close almost immediately after succeeding.

Is there some fundamental issue with how this works that I'm missing? I can't seem to get any real errors out of php, apache, or even the shell when redirected to a file. Should I try PHP4? Is PHP5 buggy with this kind of thing? I even tried running 'at' to schedule the script (so that it'd be invoked by at instead of the shell itself) but that failed, silently, as well.

View Replies !
Exec(), System() And Win 2003
I have searched high and low for the past 2 days for an answer to my problem. I have found a few references, but nothing has helped me. My problem is this: I am trying to ping a remote server from a PHP script in IE 6.0. When I load the page, the cmd.exe loads on the server and takes up all my CPU. I have to manually stop the process for it to go away.

My setup is this:
Windows 2003 Server
PHP 5.0.1

I have tried
- giving my system32cmd.exe full IUSR_%machinename% rights
- moved the cmd.exe to the script folder, to the PHP folder

And about a million other things that I can't remember =(. I have tried multiple functions, written in mulitple ways and the outcome is always the same. when the cmd.exe is opened it hangs on the 2003 server.

View Replies !
Use Exec() In PHP 5.2 On A Windows XP Pro System
I'm trying to use exec() in PHP 5.2 on a Windows XP Pro system. What I'm trying to do is use it to tell an already running program what to.

For example:
X:pathprogram.exe /something
or
X:pathprogram.exe /something_else

If I do the command through the command line, it works, but so far I have been unsuccessful in PHP. Usually it PHP just hangs, and give no error message, and does nothing to the program.

View Replies !
Problem Using System/exec Function.
I am faced with strange problem. Basically I want to make a script which would take mysql back up for me. I have come up with following. [ basically code is borrowed from some other place ]
PHP Code:

View Replies !
Exec(), System(), Shell_exec(), Etc + Nmap
i'm trying to create a script that executes nmap from my server, then displays the output.

i've tried:

$output = passthru('nmap -v -A'.' $ip');
$output = shell_exec('nmap -v -A'.' $ip');
system('nmap -v -A'.' $ip');

the problem i'm having is that using the above methods i only get the first line of output, ie.

Starting Nmap 4.20 ( http://insecure.org ) at 2007-08-31 21:46 CST

and nothing else. i've managed to find a way around it by sending the nmap output to a textfile, the using file_get_contents() to pull the data back in:

exec('nmap -v -A '.$ip.' > /usr/local/www/apache22/data/nmap/'.$ip.'.html');    
$file = "/usr/local/www/apache22/data/nmap/$ip.html";
$result = file_get_contents($file);
echo "(pre)$result(/pre)";

that works perfectly, but i'd rather not be writing anything to the drive. i guess the problem might be that nmap takes about 5-10 seconds to do its scan, and for some reason php doesn't want to wait that long, i really have no idea. can it be made to work without needing to write to files?

and for the curious minds, i'm not doing anything dodgy, i just wanted an online tool i could access from any computer to test networks i support .

View Replies !
System/exec Not Working In Browser
In two files, and I serve foo.php then I notice If I use commandline execution i.e. php foo.php then foo.txt is touched/created all right. i.e. system command is executed as expectedBut If I use browser then I notice that the shell command in config.php is *not* executedAny ideas as to why this might be happening? Code:

View Replies !
Command Window - Exec/system
I'm in the process of developing a script in Windows where I need to use exec/system. Whenever I execute either, Windows spawns a command window which automatically sappears. Is there a clean way to force Windows to NOT display the command window?

I've seen this discussed a few times previously, but, none of the
solutions seem to be working (tried both exec and system; tried using
cmd /c, tried using start /B, etc.)



View Replies !
Exec, Shell_exec, System, And Passthru Not Working At All
Can't get these commands to work! The following page simply doesn't
finish loading ( Waiting... Opening... :-( )

<?php echo system("dir"); ?>

The same for <?php echo exec("dir"); ?> or <?php echo
shell_exec("dir"); ?>, etc...

I'm running Apache 2.0.55 & PHP 5.0.5 with Zend Optimizer v2.5.10 on
windows XP SP2.

View Replies !
Exec And System Commands Blocked By Host
I've got this code, its the simpliest example I could make. It works perfectly on my windows xp/apache/php box, but doesn't do anything on a commercial website host. The actual code should use gzip to compress a folder but that doesn't work either.

Anyone know the reason why they would be blocking these commands? I suspect the problems with commonly used php apps like phpBB to be the real reason.

<?
exec("ping 127.0.0.1 > test.txt") or die();
// get contents of a file into a string
$filename = "test.txt";
$fd = fopen ($filename, "r");
$contents = fread ($fd, filesize ($filename));

fclose ($fd);

echo $contents;

?>

View Replies !
Alternates To System() And Exec() In Order To Use ImageMagik?
My Web host apepars to not allow exec() and system(), as a line in my script:

system("convert -scale 100x100 $uploadfile $toimage");

gives the error:

"Warning: system() has been disabled for security reasons"

Is there some other way to use ImageMagik (or is it GhostScript?)'s
"convert" command in PHP that may be safer and generally allowed by Web
hosts?

View Replies !
Doing Database Backup
I have this site where I runs on 2 server. One is for backup purposes and one is the main server. I have a portal running and therefore, there are heaps of changes going on my database. the question now is, how can i ensure that both have the up-to-date data?

if either one does an update, i would like to have both databases being updated as well. never done this before and i don't even have a single clue on how to start.

View Replies !
Backup Database
is there a code that i can export/backup my mysql database from inside a private/admin area of a website? also is there a way to export as say an excell file or sertain sections of a site? i know this can be done inside of phpmyadmin but is there a code to do this from inside an admin section to backup a database/website or download certain section of the website.

View Replies !
Database Backup
PHP Code:

$db_connection = mysql_connect("$server","$user","$pass") or die ("No DB Connection");
    $db = mysql_select_db("$db",$db_connection) or die ("Couldn't select DB");

$table1 = datadump ("options");
$table2 = datadump ("tbl_users");

$content = $table1 . $table2;    
    
function datadump ($table) {

    $result .= "# Dump of $table";
    $result .= "# Dump DATE : " . date("d-M-Y") ."";.....

View Replies !
Exec - Create An Executable That Return The System Drives
I need some help about exec command. I have create an executable that return the System Drives. It is based on DOS and does not need any parameter.

I have create my php script that executes the executable i've create and the source code is the following: ...

View Replies !
Function For Database Backup
Is there a function that backs up the mysql database you have? Or did the people who wrote phpmyadmin actually write a function for it.

View Replies !
MySQL Database Backup
I'm looking at using PHP and MySQL for a particular website application.
However, I was a bit concerned that if a PHP script went wrong then it would
be possible to accidentally delete or overwrite large chunks of the data in
the database which presumably would then be lost. What is the usual
procedure for these situations?. Is it possible to back up a database
somehow so that data from a previous time can be retrieved?.

View Replies !
Backup MySQL Database
How does one go about using cron jobs to create a MySQL database dump each evening?

I have cPanel with my hosting and when i go to cron jobs i have a 'Command to run:

View Replies !
Backup Of Database (Mysql)
i want to take backup of database (Mysql) in php script and then send this on any mail.
Is it possible in PHP?

View Replies !
Backup Database And Email It To Me
I'm trying to get my db backed up every 24 ours and emailed to me I set it up on a cron job and I get the email but the file is 0 bytes Any ideas? Code:

View Replies !
Php Application For Database Backup
As phpmyadmin I need a database admin tool I have a database of over 47mb need to take backup. phpmyadmin has limited upload capacity of 2048kb only which is not suffice for me. Appreciate if someone can suggest me any option which we even I can offer to my company libra03.com where I am in the support department, we have a large base of customers and we need to provide this solution to many of our clients.

View Replies !
ORACLE Database BACKUP
i m using php as frontend nd. oracle 9i as backend 1.i hv to take database backup after every 30 minute autometically. it must be prgrammed using php. i hv to connect a printer using php. i m unable to use it using my code.

View Replies !
And MySql Database Backup
I have an internet portal based on MySql database and what I need is
to make a database backup , after each actualization of data.

I know how should PHP code look like but I have no idea how to create
SQL command that will backup full database.

I know that this group does't concern MySql directly but lots of PHP
programmers have wide knowledge of MySql.

View Replies !
Running An .exe File Using Exec() Or System(), Unable To Fork Error
I have a problem with running an .exe file using exec() or system() I have downloaded a file called ffmpeg.exe for converting movie clips. I can use the program thourg the command line in windows (cmd), but I'm not able to have PHP run the file. First PHP gave be an "unable to fork" error. But then I gave users access to the cmd.exe file and solved that problem. So now is no problem running for example exec("dir");

View Replies !
Backup A Database Using The Mysqldump Function
Does anyone know what is the simplest way to backup a database using the mysqldump function in php?

View Replies !
Daily Database Backup Solutions?
Currently using mysqldump which is not a good solution for backing up live databases that are constantly being accessed. What are some other (better) backup solutions?

View Replies !
Upload Database Backup File
I backed up(using export) a database from one server. Then I went to upload that backup file into another database on another server. I get the error 'File could not be read'.

View Replies !
Database Backup - Two Databases I Need To Combine
I have two databases I need to combine and I can't figure it out through myphpadmin. I'm seeing all over that you can do this: PHP Code:

mysqldump --opt -a -u USERNAME -p PASSWORD DATABASE > FILENAME.mysql

But I don't understand WHERE I'm supposed to do that, or how, or anything. Even better would be if someone could explain the process and I could just use this: PHP Code:

mysqldump -u USERNAM -p PASSWORD DATABASE | mysql --host=123.45.67.89 -C DATABASE .

View Replies !
Restore MySQL Database Backup File Through PHP?
I wrote a PHP script to backup my complete database and send it through email. When I import the file through PHPMyAdmin, everything works. However, when I try to restore the database through PHP (I found similar code on several sites), it doesn't do anything:

$restore = "mysqlimport -u $dbuser -p $dbpass $dbname $location";
$importFile = system($restore, $return);

This is what $restore contains: mysqlimport -u user12345 -p pass12345 database12345 tempdata/backuprestore/mp_database_15-09-2007.sql

I also tried shell_exec instead of system aswell, but this didn't work either. Does anyone know how I can do this with PHP? I need this for my admin panel.

PS: mysqlimport is used to import data into a already existing database, right? Since that's what I need.

View Replies !
Php Program To Backup/restore Mysql Database?
I'm looking for a PHP program to backup and restore a mysql database.

I'm using Godaddy to host a forum. Their mysql control panel will only
restore a database of two megabytes or less. My database is over 13
megabytes in size.

View Replies !
Backup My Mysql Database To A Flat File
I have been browsing all over the internet, and searching for ways to backup my mysql database to a flat file however; all the scripts I find either just backup the data and not the structure or backup both but it only works if your hosting the db on your machine. Is there a script out there or a tutorial ANYWHERE that tells you how to backup your mysql's database structure and data?

View Replies !
Backup Of Mysql Database To A Secure Location Of Website
how would you make a backup of your Mysql database to a secure location of your website. for example, in a locked backup folder. is it possible to do this, so that when a php file is run on the site, it performs a backup to this "secure" directory?

View Replies !
Making A Database Backup To Local Server And Upload Files To Another?
I want to make a script that backups the *.frm and *.MYD files to my server and I also want to upload those files to another server via FTP? I have a copy of the database files in the directory, that works fine. But my ftp part doesn't! PHP Code:

View Replies !
Easiest Way To Backup Your MySQL Database On Multiple FTP Servers For FREE!
Here's the only tool you need to do scheduled backups of your MySQL database
on multiple FTP servers! It PHP based so there's no lengthy installation
process involved. Extract the file on any directory of your choice, edit the
configuration file and you're good to go! And best of all.... IT"S FREE!!!

Visit: http://sourceforge.net/projects/myphpdumptool/

View Replies !
MySQL Backup Script Out There That Works Automatically To Back Up A Database
Is anyone aware of a MySQL Backup Script out there that works automatically
to back up a database, say once every 24 hours?

View Replies !
System(), Exec(), Shell_exec(), But "Permission Denied"
I want to execute the php script via web server to run linux command. I try to use system(), exec(), shell_exec(), but the system show me "Permission Denied". i have set the file permission by using chmod 777 file.php .

View Replies !
Scheadule Backup Of Our Database From A Host Server To Our Local Server
I am wanting to scheadule backup of our database from a host server to our local server. How do I do this and is their any software out their that can take care of it for me? Or will I have to write the scripts?


View Replies !
Warning: Ftp_exec() [function.ftp-exec]: SITE EXEC Is An Unknown Extension
This is kind of a part II to a question a posted earlier about exec and shell_exec not working.

I'm trying to use ftp_exec to execute some simple command:

$conn_id = ftp_connect("$server") or die ("Cannot initiate connection to host");
ftp_login($conn_id, "$username", "$userpass") or die("Cannot login");
$command = 'cd..'
if (ftp_exec($conn_id, $command)) {
   echo "$command executed successfully";
} else {
   echo "could not execute $command";
}
ftp_close($conn_id);


I'm getting the following error:

Warning: ftp_exec() [function.ftp-exec]: SITE EXEC is an unknown extension in /home/urieilam/public_html/work/video/test1.1.php on line 21
could not execute cd..

Have tried other commands as well, get the same. Could this be a security issue or something to do with p Safe Mode? I don't know much about commands, shell, etc..

View Replies !
Database Rating System
Can someone point me in the direction of a PHP Rating System I can use on my site, that incorporates a MySQL database, so members of my forums can rate certain content on certain pages?

I have no experience in coding, but if a tutorial is available I can modify the coding.

View Replies !
Need Login System Without Database
I want a user login system using a flat files for User Name & Password logging & I dont wanna use any Databases.

View Replies !
Flat File Database System?
I am researching flat file DBs. I know that they are bad, but a client i am working for does not have access to mysql hosting!

What i need to do is to have a set of special offers (say about 8 different special offers, each one consisting of 5 fields (title, link, description, image, end date)).

Is there a way (either using a php 'random' script or using a flat file or even the explode/implode funcs) to generate a random page to display 2 random special offers?

View Replies !
Comment System Database Structure
I'm sure this has been brought up numerous times in the past, but I couldn't find any posts asking it specifically. I am creating a comment system for a news site.. and my question is: does it make more sense to have one table containing all comments relating to all stories, calling the comments by story ID, or to create an individual table for each story containing just the comments specific to that story?

View Replies !
System That Upgrades Records In A Database
I'm trying to put together a system that upgrades records in a database and apparently have run into a bit of a glitch. I think the problem is with the $HTTP_POST_VARS portion of the code. Is there some variable that has to be set for this to work properly or what?
Ideas anyone?

The Input form: (1 of 3 forms)
<html>
<head>
<title>SystemsDoc Update</title>
</head>
<body bgcolor="white">
<form method="POST" action="sysdocupdate.php">
<table>
<col span="1" align="right">
<tr>
<td><font color="blue">UID to Update:</font></td>
<td><input type="text" name="UID" size=100></td>
</tr>................

View Replies !
5 Star Rating System W/ Database
just wondering if there was anywhere online that I could find a decent 5 star rating system with database integration. I found several online but the explanations of some of them aren't all that great.

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved