I have a server hosted on 1and1 and I am using Laravel. When I want to execute the Artisan command to schedule a tasks, I get this error:
$ php artisan schedule:run
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /htdocs/artisan on line 31
Parse error: syntax error, unexpected T_STRING in /htdocs/artisan on line 31
After a lot searches, nothing solved my issue (do an alias for PHP, call $ php5.5
instead $ php
, etc.).
The main problem is that a call to php
uses version 4.4.9 of PHP, instead 5.5 that Laravel needs.
$ php -v
PHP 4.4.9 (cgi-fcgi) (built: Mar 31 2016 16:41:29)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
$ php5.5 -v
PHP 5.5.35 (cgi-fcgi) (built: May 3 2016 07:09:03)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
I changed the call to php5.5 and altered the Artisan file, calling this on the first line:
#!/usr/local/bin/php5.5
<?php
But at the end I always get this from artisan module calls:
Running scheduled command: '/usr/local/bin/php' 'artisan' moneySaved:send >> './logs/log.log' 2>&1 &
So the problem must come from who generates those "Running scheduled command" lines.