Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

devKirui's avatar

Laravel Backup

I have hosted by project on shared hosting where my 'app' folder i outside public_html The php version is 7.3.5, the issue i am having is.. i am have created a cron job to automatically backup the project database but i keep getting this error on my logs;

[08-Jun-2019 21:04:01 UTC] PHP Parse error:  syntax error, unexpected '?', expecting variable (T_VARIABLE) in /home/username/app-folder/vendor/zendframework/zend-diactoros/src/functions/marshal_uri_from_sapi.php on line 83 

I am using spatie/laravel-backup.

My cron is set as

*   *   *   *   *   php /home/username/app-folder/artisan backup:run 
0 likes
4 replies
Snapey's avatar
Snapey
Best Answer
Level 122

The php in your command line path is not the right version

You need to change the path or (preferably) put the full path in the cron job

devKirui's avatar

@snapey Thanks for the reply... I am a bit lost though, what would be the ideal path? or how do I know if the php version on my command line path is the right version?

Snapey's avatar

run php -v from the command line

The location of the php installation will vary by operating system. Just google it for your OS

Please or to participate in this conversation.