0

My Laravel 5.1 website works fine on my localhost. I moved all folders to a "laravel" folder I created off root at the host. Host is running php 5.6. Then moved the index.php (originally in the laravel public folder) to public_html at the host. Made some edits to the index.php for it to see bootstrap. I could see the front login page, and at that point it's not making any calls to the database. My next step was to run artisan migrations to create the database and seed it. When I ran:

php artisan migrate:refresh 

I got this error:

Parse error: syntax error, unexpected T_CLASS, expecting T_STRING or T_VARIABLE or '$' in /home/myself9/laravel/artisan on line 31

and that line happens to be:

$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);

I verified that the required php extensions are installed with my host's php rev 5.6

OpenSSL PHP Extension PDO PHP Extension Mbstring PHP Extension Tokenizer PHP Extension

Any ideas?

enter image description here

sOltan
  • 447
  • 1
  • 7
  • 20
  • did you run `composer install` after moving your files to host? – Vishal Sharma Dec 14 '15 at 04:35
  • No, I didn't do that. Is it necessary? what will composer install do? – sOltan Dec 14 '15 at 04:38
  • It is necessary, as laravel commands will not work if laravel framework is not installed. However, this might be a partial solution to the problem. Please go ahead and try and let me know what happens after that – Vishal Sharma Dec 14 '15 at 04:40
  • baboobi8@serv01 [~/laravel]# composer install -bash: composer: command not found. I connected to my host web using SSH, and issued composer install from the same folder where I saw file "composer.json" – sOltan Dec 14 '15 at 04:44
  • Good that you have SSH-ed. Follow my answer and we can debug further if the problem persists . – Vishal Sharma Dec 14 '15 at 04:52

2 Answers2

3

Okay, based on your last comment, I see that even composer isn't installed. You will have to Install composer using cURL in your shared host. Use the command below

curl -sS https://getcomposer.org/installer | php

(I hope that php is pre installed in your host)

Now, go to the directory where composer.json and composer.lock are located and run composer install this will install all the dependecies your project has.

As I said, this may be a partial solution but these are initial things that you need to do after moving your project to server. I will update this answer based on your further comments..

EDIT

If your server is a shared host, you will not be allowed to run composer directly. Move composer.phar that you downloaded using cURL to your project root and run php composer.phar install

Vishal Sharma
  • 2,550
  • 1
  • 23
  • 40
  • baboobi8@serv01 [~/laravel]# curl -sS https://getcomposer.org/installer | php #!/usr/bin/env php Some settings on your machine make Composer unable to work properly. Make sure that you fix the issues listed below and run this script again: The detect_unicode setting must be disabled. Add the following to the end of your `php.ini`: detect_unicode = Off The php.ini used by your command-line PHP is: /usr/local/php53/lib/php.ini If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times. – sOltan Dec 14 '15 at 04:53
  • 1
    Follow as it says. Try running `curl -sS https://getcomposer.org/installer | php -d detect_unicode=Off` – Vishal Sharma Dec 14 '15 at 05:00
  • Seems like it worked. See below please. baboobi8@serv01 [~]# curl -sS https://getcomposer.org/installer | php -d detect_unicode=off #!/usr/bin/env php Some settings on your machine may cause stability issues with Composer. If you encounter issues, try to change the following: PHP was compiled with --with-curlwrappers which will cause issues with HTTP authentication and GitHub. Recompile it without this flag if possible Downloading... Composer successfully installed to: /home/baboobi8/composer.phar Use it: php composer.phar – sOltan Dec 14 '15 at 05:02
  • for your reference, laravel files (which work fine on my localhost) i moved them all to host folder /home/baboobi8/laravel/ that's where I see files composer.json and composer.lock. I went there and ran composer install, but it didn't work, it said composer command not found. I tried php composer install and still did not work --> could not open input file composer. – sOltan Dec 14 '15 at 05:05
  • go to the directory where your composer.json is and run `php composer.phar install` – Vishal Sharma Dec 14 '15 at 05:06
  • You will have to move your `composer.phar` file to the same directory where your `composer.json` is, and run `php composer.phar install` – Vishal Sharma Dec 14 '15 at 05:10
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/97806/discussion-between-soltan-and-vishal-sh). – sOltan Dec 14 '15 at 05:12
0

Just add a cronjob like this:

* * * * * /usr/local/bin/php /home/YOUR_USER/domains/YOUR_DOMAIN/artisan migrate:refresh >> /dev/null 2>&1
Afshin
  • 340
  • 4
  • 8