1

I'm hosting my system in laravel on Locaweb, a shared server. However, when migrating my hosting plan, I am getting this error when trying to use "php artisan...". Using info.php to show my php version it appears that it is 7.3.28. However, when I type php -v in the terminal inside public_html, it shows me that it is 5.2.

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/storage/a/b7/b3/reciclaoleovegetal/public_html/public/index.php on line 52

Parse error: syntax error, unexpected T_STRING in /home/storage/a/b7/b3/reciclaoleovegetal/public_html/public/index.php on line 52
  • Does this answer your question? [Laravel: running artisan gives me "Unexpected character in input" error](https://stackoverflow.com/questions/14975613/laravel-running-artisan-gives-me-unexpected-character-in-input-error) – steven7mwesigwa Nov 11 '21 at 20:20
  • Does this answer your question? [Unexpected character in input: '\' (ASCII=92) state=1](https://stackoverflow.com/questions/17156251/unexpected-character-in-input-ascii-92-state-1) – steven7mwesigwa Nov 11 '21 at 20:54

1 Answers1

1

Hy,

I had the same issue, every time I run artisan.

It seems the command php is linked to the wrong php version. If you run artisan with the correct php version, the error should disappear.

On my provider the command was /usr/bin/php8.1-cli artisan, but I do not know the location of the php script on Locaweb.

A good starting point would be to see if there is a php file in the same directory.
Simply run ls /usr/bin/ -Al | grep php to get a list of all files in /usr/bin/ wiht php in the file name.
If you find a file (let's say php8.1) you then can run artisan with /usr/bin/php8.1 artisan

testgoofy
  • 33
  • 4