Coder Social home page Coder Social logo

Comments (48)

freekmurze avatar freekmurze commented on May 19, 2024

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.

mfsi-praveenm avatar mfsi-praveenm commented on May 19, 2024

can you cite an example for paths because i am getting the same issue.

from laravel-backup.

freekmurze avatar freekmurze commented on May 19, 2024

There are paths configured in the config file by default

from laravel-backup.

mfsi-praveenm avatar mfsi-praveenm commented on May 19, 2024

i have tried in my local machine with path mentioned,I am not sure where the 'backups' folder should reside.

from laravel-backup.

nam-co avatar nam-co commented on May 19, 2024

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.

freekmurze avatar freekmurze commented on May 19, 2024

You could try putting a file on S3 with the configured Filesystem

Storage::disk('nameOfYourConfiguredFilesystem')->put('file.txt', 'Contents');

from laravel-backup.

nam-co avatar nam-co commented on May 19, 2024

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.

nam-co avatar nam-co commented on May 19, 2024

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.

freekmurze avatar freekmurze commented on May 19, 2024

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.

sethphillips avatar sethphillips commented on May 19, 2024

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.

sethphillips avatar sethphillips commented on May 19, 2024

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.

ilkermutlu avatar ilkermutlu commented on May 19, 2024

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.

naveenkumarmatturthi avatar naveenkumarmatturthi commented on May 19, 2024

I too have same issue. Could any one help me?

from laravel-backup.

freekmurze avatar freekmurze commented on May 19, 2024

@RSNKumar could you try @ilkermutlu 's solution?

from laravel-backup.

anhtuank7c avatar anhtuank7c commented on May 19, 2024

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.

freekmurze avatar freekmurze commented on May 19, 2024

@anhtuank7c thanks! 👍

from laravel-backup.

lucidlemon avatar lucidlemon commented on May 19, 2024

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.

REBELinBLUE avatar REBELinBLUE commented on May 19, 2024

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.

Sarnodeep avatar Sarnodeep commented on May 19, 2024

anhtuank7c thanks 👍

from laravel-backup.

adrinavarro avatar adrinavarro commented on May 19, 2024

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.

adrinavarro avatar adrinavarro commented on May 19, 2024

Ooh. Seems the culprit is hhvm. Should not get the uri for stream_get_meta_data. A workaround should be feasible.

facebook/hhvm#2336

from laravel-backup.

jpscharf avatar jpscharf commented on May 19, 2024

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.

ekstro avatar ekstro commented on May 19, 2024

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.

starship11 avatar starship11 commented on May 19, 2024

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.

freekmurze avatar freekmurze commented on May 19, 2024

@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.

DerJacques avatar DerJacques commented on May 19, 2024

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 on line 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.

freekmurze avatar freekmurze commented on May 19, 2024

@DerJacques Thanks for taking the time to post your solution 👍

from laravel-backup.

bloodyburger avatar bloodyburger commented on May 19, 2024

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.

freekmurze avatar freekmurze commented on May 19, 2024

Did you save your credentials in the config file?

from laravel-backup.

bloodyburger avatar bloodyburger commented on May 19, 2024
PDO::FETCH_CLASS, /* |-------------------------------------------------------------------------- | Default Database Connection Name |-------------------------------------------------------------------------- | | Here you may specify which of the database connections below you wish | to use as your default connection for all database work. Of course | you may use many connections at once using the Database library. | */ 'default' => 'mysql', /* |-------------------------------------------------------------------------- | Database Connections |-------------------------------------------------------------------------- | | Here are each of the database connections setup for your application. | Of course, examples of configuring each database platform that is | supported by Laravel is shown below to make development simple. | | | All database work in Laravel is done through the PHP PDO facilities | so make sure you have the driver for your particular database of | choice installed on your machine before you begin development. | */ 'connections' => [ 'sqlite' => [ 'driver' => 'sqlite', 'database' => storage_path('database.sqlite'), 'prefix' => '', ], 'mysql' => [ 'driver' => 'mysql', 'host' => 'localhost', 'database' => 'thejanso_anand', 'username' => 'thejanso_anand', 'password' => 'wewewew', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, ], 'pgsql' => [ 'driver' => 'pgsql', 'host' => env('DB_HOST', 'localhost'), 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'charset' => 'utf8', 'prefix' => '', 'schema' => 'public', ], 'sqlsrv' => [ 'driver' => 'sqlsrv', 'host' => env('DB_HOST', 'localhost'), 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'charset' => 'utf8', 'prefix' => '', ], ], /* |-------------------------------------------------------------------------- | Migration Repository Table |-------------------------------------------------------------------------- | | This table keeps track of all the migrations that have already run for | your application. Using this information, we can determine which of | the migrations on disk haven't actually been run in the database. | */ 'migrations' => 'migrations', /* |-------------------------------------------------------------------------- | Redis Databases |-------------------------------------------------------------------------- | | Redis is an open source, fast, and advanced key-value store that also | provides a richer set of commands than a typical key-value systems | such as APC or Memcached. Laravel makes it easy to dig right in. | */ 'redis' => [ 'cluster' => false, 'default' => [ 'host' => '127.0.0.1', 'port' => 6379, 'database' => 0, ], ], ``` ];

from laravel-backup.

bloodyburger avatar bloodyburger commented on May 19, 2024

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.

DerJacques avatar DerJacques commented on May 19, 2024

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.

bloodyburger avatar bloodyburger commented on May 19, 2024

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.

bloodyburger avatar bloodyburger commented on May 19, 2024

I am using hhvm, guess that is causing the issue. Any workaround or solution available yet.

from laravel-backup.

bloodyburger avatar bloodyburger commented on May 19, 2024

Fixed by changing Line 50 as highlighted in MySQLDatabase.php

capture

from laravel-backup.

devLopez avatar devLopez commented on May 19, 2024

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.

freekmurze avatar freekmurze commented on May 19, 2024

@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.

devLopez avatar devLopez commented on May 19, 2024

@freekmurze, down, I took a print screen of my source code. I've created a controller only for manage my backup actions.

God Bless

backup-artisan-error

from laravel-backup.

freekmurze avatar freekmurze commented on May 19, 2024

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.

devLopez avatar devLopez commented on May 19, 2024

@freekmurze

Works very well, take a look

error-laravel-db

from laravel-backup.

freekmurze avatar freekmurze commented on May 19, 2024

Is the process that handles your web requests allowed to execute external programs like mysqldump?

from laravel-backup.

devLopez avatar devLopez commented on May 19, 2024

Oh men, you got me!!!

I don't know, how I can see it?

from laravel-backup.

freekmurze avatar freekmurze commented on May 19, 2024

I'm not familiar with running php on windows.

from laravel-backup.

devLopez avatar devLopez commented on May 19, 2024

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.

jpscharf avatar jpscharf commented on May 19, 2024

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.

freekmurze avatar freekmurze commented on May 19, 2024

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.

devLopez avatar devLopez commented on May 19, 2024

Ok men

from laravel-backup.

nam-co avatar nam-co commented on May 19, 2024

thanks for v3

from laravel-backup.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.