I'm using spatie/laravel-backup package to backup my laravel project.everything works just fine on local.I uploaded my project on a host and set a cronjob to backup my data every midnight but it's not working.I found this exception from log files:
Starting backup...
In Client.php line 51:
Argument 1 passed to Spatie\Dropbox\Client::__construct() must be of the ty
pe string, null given, called in /var/www/html/vendor/benjamincrozat/larave
l-dropbox-driver/src/ServiceProvider.php on line 17
But when I enter php artisan backup:run or any other commands from this package in the host command line ,it works fine.so it just happens when using with cron.
note that I'm using DropBox for storing the backup files.
Why is this happening?
Thanks
Related
Laravel Version: 8.78.1
PHP Version: 8.0.10
Description
Whilst creating my first scheduled command, trying to list my schedules with
php artisan schedule:list
throws the error:
DateTime::setTimezone(): Argument #1 ($timezone) must be of type DateTimeZone, null given at vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleListCommand.php:43
changing my command to
php artisan schedule:list --timezone=Europe/London
gives:
DateTime::setTimezone(): Argument #1 ($timezone) must be of type DateTimeZone, string given at vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleListCommand.php:43
Steps To Reproduce:
My schedule:
$schedule->command('email:expired-licences')->weekdays()->at('08:00');
My custom command doesn't actually do anything yet.
Eventually I found a solution if I edited ScheduleListCommand.php
changing:
->setTimezone($this->option('timezone', config('app.timezone')))
to
->setTimezone(new DateTimeZone($this->option('timezone', config('app.timezone'))))
but only if I use the --timezone=Europe/London switch (not sure if this is required), if not then the $this->option doesn't seem to be accepting the config('app.timezone') as a default.
Even:
$schedule->command('route:list')->weekdays()->at('08:00');
doesn't work on my system - not sure what's going on.
This was a bug in the laravel\framework\src\Illuminate\Console\Scheduling\ScheduleListCommand.php and was fixed in the v8.79.0 release
In laravel 5.8 app I use https://github.com/spatie/browsershot
and if I save file as
$save_to_file= 'file.pdf';
Browsershot::html(htmlspecialchars_decode($pdf_content))
->showBackground()
->save($save_to_file);
it is downloaded and saved in /public dir of my app at my local OS
If I try to set path to ‘Downloads’ directory of my Kubuntu 18 as
$save_to_file= '/home/currentuser/Downloads/file.pdf';
Browsershot::html(htmlspecialchars_decode($pdf_content))
->showBackground()
->save($save_to_file);
I got error:
Symfony \ Component \ Process \ Exception \ ProcessFailedException
The command "PATH=$PATH:/usr/local/bin NODE_PATH=`npm root -g` node '/mnt/_work_sdb8/wwwroot/lar/votes/vendor/spatie/browsershot/src/../bin/browser.js' '{"url":"file:\/\/\/tmp\/0906513001561868598\/index.html","action":"pdf","options":{"path":"\/home\/serge\/Downloads\/file.pdf","args":[],"viewport":{"width":800,"height":600},"displayHeaderFooter":false,"printBackground":true}}'" failed. Exit Code: 1(General error) Working directory: /mnt/_work_sdb8/wwwroot/lar/votes/public Output: ================ Error Output: ==============
1) If there is a way to download generated file into ‘Downloads’(OS independently) ?
2) I think that I can use php remove function but again how define ‘Downloads’(OS independently) directory ?
I received the exact same error. No idea why I got that. Followed all the steps mentioned in the docs. Tried various resources still could not figure it out.
Finally this worked
$save_to_file= '/var/www/laravel/storage/app/file.pdf';
Browsershot::url('https://www.google.com')
->noSandbox()->format('a4')->save($save_to_file);
The ->noSandbox() was the key. Let me know if this works for you.
I am working on vagrant / homestead, and have a box configured.
I could enable Xdebug in PhpStorm!
Now, I want to enable PHPUnit, but I can't do it...
I followed several tutorials:
https://blog.mayflower.de/5274-Run-your-tests-with-PHPStorm-on-your-vagrant-box.html
https://confluence.jetbrains.com/display/PhpStorm/Running+PHPUnit+tests+over+SSH+on+a+remote+server+with+PhpStorm
Here are my settings:
Here is the message I receive when running PhpUnit with Code Coverage
vagrant:///Users/julien/Homestead/usr/bin/php -dxdebug.coverage_enable=1 /home/vagrant/.phpstorm_helpers/phpunit.php --coverage-clover /home/vagrant/.phpstorm_helpers/coverage/Laravel_PhpUnit.coverage -- configuration /home/vagrant/Code/vendor/autoload.php /Users/julien/Documents/Proyectos/laravel/tests/functional
Testing started at 11:12 AM ...
bash: line 0: cd: /Users/julien/Documents/Proyectos/laravel/tests/functional: No such file or directory
PHP Fatal error: Uncaught UnexpectedValueException: Cannot create phar '/home/vagrant/Code/vendor/bin', file extension (or combination) not recognised or the directory does not exist in /home/vagrant/.phpstorm_helpers/phpunit.php:181
Stack trace:
Fatal error: Uncaught UnexpectedValueException: Cannot create phar '/home/vagrant/Code/vendor/bin', file extension (or combination) not recognised or the directory does not exist in /home/vagrant/.phpstorm_helpers/phpunit.php on line 181#0 /home/vagrant/.phpstorm_helpers/phpunit.php(181): Phar- >__construct('/home/vagrant/C...')
#1 /home/vagrant/.phpstorm_helpers/phpunit.php(250): IDE_PHPUnit_Loader::init()
#2 {main}
UnexpectedValueException: Cannot create phar '/home/vagrant/Code/vendor/bin', file extension (or combination) not recognised or the directory does not exist in /home/vagrant/.phpstorm_helpers/phpunit.php on line 181
thrown in /home/vagrant/.phpstorm_helpers/phpunit.php on line 181
Call Stack:
0.0006 442920 1. {main}() /home/vagrant/.phpstorm_helpers/phpunit.php:0
0.0006 442920 2. IDE_PHPUnit_Loader::init() /home/vagrant/.phpstorm_helpers/phpunit.php:250
0.0006 451168 3. Phar->__construct() /home/vagrant/.phpstorm_helpers/phpunit.php:181
Process finished with exit code 255
Setting up vagrant with PhpStorm and PHPUnit can be a little bit daunting as it is really not that straight forward... From your console output I'd say that your interpreter setting is not correct since it executes PHP on your local machine.
The way that always worked for me was setting up vagrant as SFTP Deployment Configuration and use that configuration as PHP interpreter. As you are already using Homesteasd, these tutorials might shed some more light onto the setup:
Setting up PhpStorm with Vagrant on a Laravel Homestead box
Setting up Laravel with PHPUnit on Vagrant in PhpStorm
Here are the essential parts:
I am trying to run cellcli on my one of the Exadata Cell Server.
When I login to the Server, I am able to see all the files as expected.
(Like: all_group all_nodelist_group cell_group all_ib_group etc)
When I issue command to start cellcli it gives me error that command not found:
# cellcli
-bash: cellcli: command not found
# which cellcli
which: no cellcli in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
Any idea what is the location of the cellclie executable on exadata?
Do I need to export any other path to get this command?
cellcli is in /opt/oracle/cell/cellsrv/bin. It should be put in path by /etc/profile.d/cell_env.sh
(from Marc Fielding)
I am having a problem with running commands via cli doctrine-cli.php file. I am using Doctrine 2 and Codeigniter 2. I would like to generate entities via Command Line Tool, but without success. Page is hosted by Hostgator. On this server is installed by default PHP version 5.2, but you can use PHP version 5.3 by adding some commands to .htaccess file located in root.
In the Command Line Tool I get this error:
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/tig3rb0y/public_html/naselsi/application/doctrine-cli.php on line 10
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/tig3rb0y/public_html/naselsi/application/doctrine-cli.php on line 10
Parse error: syntax error, unexpected T_STRING in /home/tig3rb0y/public_html/naselsi/application/doctrine-cli.php on line 10
If I run a file with PHP version via url, I get PHP version 5.3, but if I run the same file via Command Line Tool, I get php version 5.2. Why is that so?
Is there any solution for that?
Regards, Mario
I have a solution. As already #KeesSchepers said, there was a problem that in command line there was default 5.2.17 PHP version. I solved that simply, I just added prefix /opt/php53/bin/php to all doctrine2 commands, example:
/opt/php53/bin/php doctrine-cli.php orm:...
Thank you guys!