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
Related
I try to follow the Laradock getting started tutorial on windows: http://laradock.io/getting-started/
I have the following tools:
Docker version: 20.10.5, build 55c4c88
git version: 2.30.2.windows.1
Windows 10 20H2(19042.867)
I get stuck on the step when trying to start the: docker-compose up -d nginx mysql
Then I get these error:
ERROR: The Compose file '.\docker-compose.yml' is invalid because:
services.proxy.expose is invalid: should be of the format 'PORT[/PROTOCOL]'
services.proxy2.expose is invalid: should be of the format 'PORT[/PROTOCOL]'
services.proxy.ports contains an invalid type, it should be a number, or an object
services.proxy2.ports contains an invalid type, it should be a number, or an object
...
services.sqs.ports contains an invalid type, it should be a number, or an object
services.sqs.ports contains an invalid type, it should be a number, or an object
services.traefik.ports value [':', ':', ':'] has non-unique elements
Only change I done to the repo is to add the env file and this line:
# Point to the path of your applications code on your host
APP_CODE_PATH_HOST=../project-z/
I also created the folder project-z
I saw this text quote but didn´t understand it:
Depending on the host’s operating system you may need to change the
value given to COMPOSE_FILE. When you are running Laradock on Mac OS
the correct file separator to use is :. When running Laradock from a
Windows environment multiple files must be separated with ;.
But think it might be related to my issue and I need to update something to make it work on Windows.
Any idea what could be wrong? Since it almost out of the box I assume it´s something with my Windows environment
I found the solution directly after posted this question.
It was very easy I forgot to add the "." before env when created the file.
I found the solution here: https://github.com/laradock/laradock/issues/1437
When I installed Phalcon 2.0.13 according to the https://docs.phalconphp.com/en/latest/reference/install.html description and I wanted to launch my test script then I got the following error (literally it is just a warning but it causes Phalcon not to be loaded which causes errors):
{
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20131226/phalcon.so' - /usr/lib/php/20131226/phalcon.so: undefined symbol: php_pdo_get_dbh_ce in Unknown on line 0
}
What is this symptom cased by and how could I get rid of it?
After struggling a lot, I managed to solve the problem. The {extension=phalcon.so} line should be put NOT in php.ini. Much rather, you should create a /etc/php/5.6/cli/conf.d/30-phalcon.ini file containing {extension=phalcon.so}.
The reason is that this way you can guarantee that the processing order of the ini files is appropriate.
If you want to use Phantom not just in cli but in apache module as well then copy the ini file in the corresponding directory too.
(The directory names can be different in your system.)
Typically I run a laravel artisan command like
php artisan Command -v
and if there is an error I can find the file/line#, using the -v flag.
For some reason the -v is not working on one of my commands. I am therefore receiving a pretty limited error message:
[Symfony\Component\Debug\Exception\FatalErrorException]
Call to a member function getArgument() on null
This command happens to be calling some code that is extending someone else's code.
Any ideas how to get the file/line output in the error message?
Old, but relates to a questions / answer I had...
...verbosity levels...
// -v|vv|vvv Increase the verbosity of messages:
// 1 for normal output, 2 for more verbose output and 3 for debug
php artisan --verbose
Good reference here...
https://github.com/JesseObrien/laravel-cheatsheet (moved to github)
It's been caught by laravel
You can dump the detail in the "handle" function in this file
/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php
When running artisan migrate on a Laravel 5 project, it is failing with the following FatalErrorException:
$ artisan migrate -vvv --force
[Symfony\Component\Debug\Exception\FatalErrorException] syntax
error, unexpected '$table' (T_VARIABLE)
How do I get the file and line that is causing the error?
If in anyway relevant, I'm on a Windows 7 x64 machine with WAMP - PHP 5.6 and Laravel Framework version 5.1.10 (LTS).
There might be a semicolon or bracket missing a line
Check all in your migration files.
Laravel is configured to create daily log files for your application
which are stored in the storage/logs directory.
http://laravel.com/docs/5.1/errors#logging
This class Symfony\Component\Debug\Exception\FatalErrorException has some differences compared with the other Exception classes and it is not properly presented by the "error renderers" or "error notifiers".
A New sentry "error notifier" ("getsentry/sentry-php" version >= "2.0") will give you a proper stack trace.
Here is issue where is reported : https://github.com/getsentry/sentry-php/issues/761
Here is the PR for fix : https://github.com/getsentry/sentry-php/pull/763
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!