Comments (48)
Things you can check:
- does the destination directory exists? Is it writable. When backing up to S3, is the path in the bucket writable?
- are the files specified in source.files.include and source.files.exclude correct?
If you can't find any issues, run the command with the -vvv flag to get more detail on the exception.
Though I haven't tested it out the package should work perfectly with L5.1 As soon as that version is available, I'll check it to make sure.
from laravel-backup.
can you cite an example for paths because i am getting the same issue.
from laravel-backup.
There are paths configured in the config file by default
from laravel-backup.
i have tried in my local machine with path mentioned,I am not sure where the 'backups' folder should reside.
from laravel-backup.
Hi Freekmurze, I set up to S3 in a new different app using server pilot and run: php5.6-sp artisan backup:run
the response was:
Start backing up
[Exception]
Could not create backup of db
Exception trace:
() at /srv/users/serverpilot/apps/appname/vendor/spatie/laravel-backup/src/BackupHandlers/Database/DatabaseBackupHandler.php:44
Spatie\Backup\BackupHandlers\Database\DatabaseBackupHandler->getDumpedDatabase() at /srv/users/serverpilot/apps/appname/vendor/spatie/laravel-backup/src/BackupHandlers/Database/DatabaseBackupHandler.php:57
Spatie\Backup\BackupHandlers\Database\DatabaseBackupHandler->getFilesToBeBackedUp() at /srv/users/serverpilot/apps/appname/vendor/spatie/laravel-backup/src/Commands/BackupCommand.php:63
Spatie\Backup\Commands\BackupCommand->getAllFilesToBeBackedUp() at /srv/users/serverpilot/apps/appname/vendor/spatie/laravel-backup/src/Commands/BackupCommand.php:33
Spatie\Backup\Commands\BackupCommand->fire() at n/a:n/a
call_user_func_array() at /srv/users/serverpilot/apps/appname/bootstrap/cache/compiled.php:924
Illuminate\Container\Container->call() at /srv/users/serverpilot/apps/appname/vendor/laravel/framework/src/Illuminate/Console/Command.php:149
Illuminate\Console\Command->execute() at /srv/users/serverpilot/apps/appname/vendor/symfony/console/Command/Command.php:259
Symfony\Component\Console\Command\Command->run() at /srv/users/serverpilot/apps/appname/vendor/laravel/framework/src/Illuminate/Console/Command.php:135
Illuminate\Console\Command->run() at /srv/users/serverpilot/apps/appname/vendor/symfony/console/Application.php:878
Symfony\Component\Console\Application->doRunCommand() at /srv/users/serverpilot/apps/appname/vendor/symfony/console/Application.php:195
Symfony\Component\Console\Application->doRun() at /srv/users/serverpilot/apps/appname/vendor/symfony/console/Application.php:126
Symfony\Component\Console\Application->run() at /srv/users/serverpilot/apps/appname/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:94
Illuminate\Foundation\Console\Kernel->handle() at /srv/users/serverpilot/apps/appname/artisan:36
I also tried in both 5.1 and 5.0 so is another problem
Also how do we make sure the S3 destination is it writable? sorry about all this, but your package seems the best and I will really like to use it
from laravel-backup.
You could try putting a file on S3 with the configured Filesystem
Storage::disk('nameOfYourConfiguredFilesystem')->put('file.txt', 'Contents');
from laravel-backup.
Hi Freek, thanks for your response, but I don't think the problem is in S3, because when I choose local it doesn't work, could the problem be the app is using serverpilot?
I try the Storage to S3 and it didn't worked, I change the key and it work, tried again the backup and still same problem (Could not create backup of db)
Thanks
from laravel-backup.
ok, is not server pilot because I test in my local server using mamp and same error with both (local and S3)
from laravel-backup.
Are you sure mysqldump is installed on your system? Could you try running it manually to see if it creates a dump of your db?
from laravel-backup.
I was facing this same issue, however only on a windows deployment. In development on my mac it ran fine. I had to set the default path for mysqldump in the config to "C:/Program Files/MySQL/MySQL Server 5.6/bin/" and then it worked.
from laravel-backup.
Ive just ran into this on another windows server and the above solution does not work for it. I've verified that mysqldump does work on the system
from laravel-backup.
I recently had the same issue. (OS X, MAMP)
It turned out that my mysqldump path was incorrect. In my case a full path to the binary was provided. I replaced it with the path to the directory.
from laravel-backup.
I too have same issue. Could any one help me?
from laravel-backup.
@RSNKumar could you try @ilkermutlu 's solution?
from laravel-backup.
Resolution for error could not backup db.
You must setup environment path to mysql.
I'm use windows 7, and here my path to mysql: C:\Program Files\MySQL\MySQL Server 5.6\bin
I do copy this path and paste to System path environment,then click ok.
Open new Command Line then execute: php artisan backup:run
It's work like a boss.
from laravel-backup.
@anhtuank7c thanks! 👍
from laravel-backup.
i can't get it running either.
php artisan backup:run --only-db -vvv
Start backing up
[Exception]
Could not create backup of db
Exception trace:
() at /var/www/staging/webshop/vendor/spatie/laravel-backup/src/BackupHandlers/Database/DatabaseBackupHandler.php:47
Spatie\Backup\BackupHandlers\Database\DatabaseBackupHandler->getDumpedDatabase() at /var/www/staging/webshop/vendor/spatie/laravel-backup/src/BackupHandlers/Database/DatabaseBackupHandler.php:60
Spatie\Backup\BackupHandlers\Database\DatabaseBackupHandler->getFilesToBeBackedUp() at /var/www/staging/webshop/vendor/spatie/laravel-backup/src/Commands/BackupCommand.php:67
Spatie\Backup\Commands\BackupCommand->getAllFilesToBeBackedUp() at /var/www/staging/webshop/vendor/spatie/laravel-backup/src/Commands/BackupCommand.php:33
Spatie\Backup\Commands\BackupCommand->fire() at n/a:n/a
call_user_func_array() at /var/www/staging/webshop/vendor/laravel/framework/src/Illuminate/Container/Container.php:502
Illuminate\Container\Container->call() at /var/www/staging/webshop/vendor/laravel/framework/src/Illuminate/Console/Command.php:150
Illuminate\Console\Command->execute() at /var/www/staging/webshop/vendor/symfony/console/Command/Command.php:259
Symfony\Component\Console\Command\Command->run() at /var/www/staging/webshop/vendor/laravel/framework/src/Illuminate/Console/Command.php:136
Illuminate\Console\Command->run() at /var/www/staging/webshop/vendor/symfony/console/Application.php:878
Symfony\Component\Console\Application->doRunCommand() at /var/www/staging/webshop/vendor/symfony/console/Application.php:195
Symfony\Component\Console\Application->doRun() at /var/www/staging/webshop/vendor/symfony/console/Application.php:126
Symfony\Component\Console\Application->run() at /var/www/staging/webshop/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:100
Illuminate\Foundation\Console\Kernel->handle() at /var/www/staging/webshop/artisan:36
Standard Filesystem settings, directory backups created, Laravel 5.1, ubuntu 14.04, also added it with ::class etc.. everything like it should.
I can also create a mysqldump as the www-data user myself from the command line, just not with this plugin.
Any ideas?
from laravel-backup.
Yep, exactly the same issue with Laravel 5.1, Debian, Standard config, created the backup directory, mysqldump is in the default location but I added it to the config as well just in case
I put a dd()
on line 51 https://github.com/spatie/laravel-backup/blob/master/src/BackupHandlers/Files/FilesBackupHandler.php#L51 both includedFiles and excludedFiles are null
for me
from laravel-backup.
anhtuank7c thanks 👍
from laravel-backup.
I second this because I'm seeing this as well. Had it happen on a first setup, then after migrating the server it's happening again, and it takes hours of debugging because the error message and trace isn't really clear.
Now, back to figuring it out…
from laravel-backup.
Ooh. Seems the culprit is hhvm. Should not get the uri for stream_get_meta_data. A workaround should be feasible.
from laravel-backup.
I am having the same problem, and I am not using hhvm:
Start backing up
[Exception]
Could not create backup of db
Exception trace:
() at /home/forge/dev.essentialoils.org/vendor/spatie/laravel-backup/src/BackupHandlers/Database/DatabaseBackupHandler.php:46
Spatie\Backup\BackupHandlers\Database\DatabaseBackupHandler->getDumpedDatabase() at /home/forge/dev.essentialoils.org/vendor/spatie/laravel-backup/src/BackupHandlers/Database/DatabaseBackupHandler.php:59
Spatie\Backup\BackupHandlers\Database\DatabaseBackupHandler->getFilesToBeBackedUp() at /home/forge/dev.essentialoils.org/vendor/spatie/laravel-backup/src/Commands/BackupCommand.php:254
Spatie\Backup\Commands\BackupCommand->getDatabaseDump() at /home/forge/dev.essentialoils.org/vendor/spatie/laravel-backup/src/Commands/BackupCommand.php:70
Spatie\Backup\Commands\BackupCommand->getAllFilesToBeBackedUp() at /home/forge/dev.essentialoils.org/vendor/spatie/laravel-backup/src/Commands/BackupCommand.php:35
Spatie\Backup\Commands\BackupCommand->fire() at n/a:n/a
call_user_func_array() at /home/forge/dev.essentialoils.org/vendor/laravel/framework/src/Illuminate/Container/Container.php:503
Illuminate\Container\Container->call() at /home/forge/dev.essentialoils.org/vendor/laravel/framework/src/Illuminate/Console/Command.php:150
Illuminate\Console\Command->execute() at /home/forge/dev.essentialoils.org/vendor/symfony/console/Command/Command.php:256
Symfony\Component\Console\Command\Command->run() at /home/forge/dev.essentialoils.org/vendor/laravel/framework/src/Illuminate/Console/Command.php:136
Illuminate\Console\Command->run() at /home/forge/dev.essentialoils.org/vendor/symfony/console/Application.php:838
Symfony\Component\Console\Application->doRunCommand() at /home/forge/dev.essentialoils.org/vendor/symfony/console/Application.php:189
Symfony\Component\Console\Application->doRun() at /home/forge/dev.essentialoils.org/vendor/symfony/console/Application.php:120
Symfony\Component\Console\Application->run() at /home/forge/dev.essentialoils.org/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:107
Illuminate\Foundation\Console\Kernel->handle() at /home/forge/dev.essentialoils.org/artisan:36
from laravel-backup.
In my case problem was with temporary config file for mysqldump (one generated with tmpfile() in dump method). When you defined host in Laravel config file as eg. "localhost:8889" (with port) this causing the problem.
[client]
user = 'root'
password = 'lopawq2012'
host = 'localhost:8889'
port = '3306'
This is working for me:
[client]
user = 'root'
password = 'lopawq2012'
host = 'localhost'
port = '8889'
from laravel-backup.
is there any way to call the same artisan command from laravel controller?? when called from controller it gives error "could not backup db" :(
from laravel-backup.
@starship11 If you configured the package correctly you can use this code in your project to perform a backup.
\Artisan::call('backup:run');
from laravel-backup.
I received the same error message, but in my case it was 100% my own fault.
Just for the record, I'm using MySQL and AWS S3.
- If you are running Laravel in a VM, make sure to run the command from within the VM (or wherever mysqldump is installed).
- Inserting
dd($success)
in/vendor/spatie/laravel-backup/src/BackupHandlers/Database/DatabaseBackupHandler.php
online 44
might provide you with a more detailed error message.
Not sure if my issue was related to the ones you folks are experiencing, but maybe this helps.
from laravel-backup.
@DerJacques Thanks for taking the time to post your solution 👍
from laravel-backup.
Start backing up
"mysqldump: Got error: 1045: "Access denied for user 'root'@'localhost' (using password: NO)" when trying to connect\n"
Why is it using root user and not the user specified in config file.
from laravel-backup.
Did you save your credentials in the config file?
from laravel-backup.
from laravel-backup.
do I need to make any changes.
Regards,
Anand
On 26 January 2016 at 04:49, Freek Van der Herten [email protected]
wrote:
Did you save your credentials in the config file?
—
Reply to this email directly or view it on GitHub
#37 (comment)
.
from laravel-backup.
Do you have any other database config-files?
You might want to check if there's a different config in a folder called config/production
or config/local
.
Make sure that your Laravel database connection works fine otherwise. The error you experience does not necessarily seem to be related to this package.
from laravel-backup.
Hi,
I do not have multiple config files. I am using default installation only
and am able to run the site which uses this database. The database had
different user than root. Why root user is being picked and from where.
Regards,
Anand
On 26 January 2016 at 05:34, Manuel Thomsen [email protected]
wrote:
Do you have any other database config-files?
You might want to check if there's a different config in a folder called
config/production or config/local.Make sure that your Laravel database connection works fine otherwise. The
error you experience does not necessarily seem to be related to this
package.—
Reply to this email directly or view it on GitHub
#37 (comment)
.
from laravel-backup.
I am using hhvm, guess that is causing the issue. Any workaround or solution available yet.
from laravel-backup.
Fixed by changing Line 50 as highlighted in MySQLDatabase.php
from laravel-backup.
Hi guys
I'm having a problem with the backup of database. When I run the artisan command on CLI, the database backup works perfectly, but I need run the backup command inside a Controller, and then, I receive error "Could not create backup of db".
How I can proceed?
God Bless
from laravel-backup.
@devLopez If it can run on the cli, it should work in the controller as well. Does your application is alle to connect to the database inside the controller? Could you show the code that you're using to run the backup command?
from laravel-backup.
@freekmurze, down, I took a print screen of my source code. I've created a controller only for manage my backup actions.
God Bless
from laravel-backup.
Seems good. Are you sure it works on the cli? From a package standpoint there's no difference in calling it from cli or calling the command from your controller. I the problem is caused by something specific to your setup.
from laravel-backup.
Works very well, take a look
from laravel-backup.
Is the process that handles your web requests allowed to execute external programs like mysqldump
?
from laravel-backup.
Oh men, you got me!!!
I don't know, how I can see it?
from laravel-backup.
I'm not familiar with running php on windows.
from laravel-backup.
I'm thinking, backups generated manually can be a bad thing.
The user can forget it.
I'll do it working with cron jobs, is more secure.
God Bless you men, thanks
from laravel-backup.
Backup will fail if the port is included/inlined with the host, e.g DB_HOST=localhost:3306
.
- The solution for my issue was to add
DB_PORT
to.env
and'port' => env('DB_PORT', 3306)
to config/database.php
from laravel-backup.
I'm going to close this for now. If you have any more troubles with v2 of this package, try upgrading to v3
from laravel-backup.
Ok men
from laravel-backup.
thanks for v3
from laravel-backup.
Related Issues (20)
- Incremental Backups Support HOT 1
- backup: clean AWS(S3) not clean any files HOT 2
- Unable to retrieve backups using backup:list
- Unable to retrieve backups using backup:list HOT 1
- Failed to open stream: Too many open files.
- When running backup after the command completed it throws an error, maybe conflicting with ActivityLogger HOT 1
- Dumping Database stuck
- Unable to run php artisan serve due to problem in backup.php file
- Backup failed because: The dump process failed with a none successful exitcode.
- Spatie\Backup\Tasks\Backup\BackupJobFactory::Spatie\Backup\Tasks\Backup\{closure}()
- Remote backup fails "necessary data rewind wasn't possible" with Flysystem WebDAVAdapter
- Documentation for v8 is missing HOT 2
- Class "ZipArchive" not found HOT 2
- Message.php error
- backup:run command is not working from controller
- Does this package support backup of dynamic fields
- Backup laravel pulse tables
- Backup PostgreSQL Global
- Using "add_extra_option" --tables users not working when I try to dump a specific table from the database.
- Notification error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-backup.