11 Replies - 949 Views - Last Post: 09 May 2016 - 02:46 PM Rate Topic: -----

#1 nomoremercy   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 71
  • Joined: 12-October 13

Deploying Laravel

Posted 06 May 2016 - 11:43 AM

I'm trying to deploy a Laravel application on my remote server. I uploaded all files, edited .env file but when I try to access my site, I get this error:

Quote

Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in

That line looks like this:
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);


I don't get it, what is wrong here. Can it be problem with a host?

Is This A Good Question/Topic? 0
  • +

Replies To: Deploying Laravel

#2 ArtificialSoldier   User is offline

  • D.I.C Lover
  • member icon

Reputation: 2760
  • View blog
  • Posts: 8,062
  • Joined: 15-January 14

Re: Deploying Laravel

Posted 06 May 2016 - 11:49 AM

If that works on one server but on another then, considering that class is a reserved word in PHP, I bet the problem is the PHP version. That code probably uses a feature that was introduced in a later version of PHP than what is installed on your server.
Was This Post Helpful? 1
  • +
  • -

#3 Atli   User is offline

  • Enhance Your Calm
  • member icon

Reputation: 4241
  • View blog
  • Posts: 7,216
  • Joined: 08-June 10

Re: Deploying Laravel

Posted 06 May 2016 - 11:53 AM

Seems to be a common error for deployments of Laravel 5.1 and higher, which require PHP 5.5.9 or higher. (ref.)

That's a relatively high PHP version number for a lot of shared hosting, as they tend to be painfully slow to upgrade to new PHP versions. Often, though, you can choose between versions in whatever control panel they offer.
Was This Post Helpful? 1
  • +
  • -

#4 nomoremercy   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 71
  • Joined: 12-October 13

Re: Deploying Laravel

Posted 06 May 2016 - 11:53 AM

Maybe someone can offer a host where I can deploy Laravel 5? It would be better free, but I can pay if it is neccessary. I'm in a hurry so I have no choice :surrender:
Was This Post Helpful? 0
  • +
  • -

#5 Atli   User is offline

  • Enhance Your Calm
  • member icon

Reputation: 4241
  • View blog
  • Posts: 7,216
  • Joined: 08-June 10

Re: Deploying Laravel

Posted 06 May 2016 - 12:01 PM

Free hosts are pretty much exclusively crap. To be avoided if at all possible.

In the US, I know Bluehost offers PHP 5.6 as an option. (You can choose between 5.4 and 5.6 in the CP.)
It's not free, but not very expensive either.

But if you are not in (or near) the US, that's not a good option. You'd want a host nearby you.

This post has been edited by Atli: 06 May 2016 - 12:02 PM

Was This Post Helpful? 1
  • +
  • -

#6 nomoremercy   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 71
  • Joined: 12-October 13

Re: Deploying Laravel

Posted 06 May 2016 - 12:12 PM

Well I need this for a school project. After 4-5 weeks it will be gone. Is PHP 5.6 enough for Laravel 5? Will I be able to use SSH? Execute commands such as curl?

This post has been edited by nomoremercy: 06 May 2016 - 12:15 PM

Was This Post Helpful? 0
  • +
  • -

#7 Atli   User is offline

  • Enhance Your Calm
  • member icon

Reputation: 4241
  • View blog
  • Posts: 7,216
  • Joined: 08-June 10

Re: Deploying Laravel

Posted 06 May 2016 - 12:20 PM

PHP 5.5.9 is the minimum for the latest Laravel 5 version, so yes.

You could always try hosting this yourself, if you have a half decent internet connection somewhere.
Just set up XAMPP or WAMP on your PC, and then forward ports 80 (and 443, if you use HTTPS) through your router to that PC.
That's normally not difficult to do on typical home routers.
Was This Post Helpful? 1
  • +
  • -

#8 nomoremercy   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 71
  • Joined: 12-October 13

Re: Deploying Laravel

Posted 06 May 2016 - 12:28 PM

That could be an option. But I also need to send emails and etc. I read that it is not possible in localhost. Or by doing what you told me my app won't be local?

This post has been edited by Atli: 06 May 2016 - 12:30 PM

Was This Post Helpful? 0
  • +
  • -

#9 Atli   User is offline

  • Enhance Your Calm
  • member icon

Reputation: 4241
  • View blog
  • Posts: 7,216
  • Joined: 08-June 10

Re: Deploying Laravel

Posted 06 May 2016 - 12:44 PM

"localhost" only refers to "this machine". Technically all servers are "local", it just depends on your perspective.

There is nothing stopping you from setting up whatever software you want on your own machine. Web servers, databases, email (SMTP), DNS, etc... It's all just software, and your PC is really no different than any other server computer out there.

Of course, installing a working PHP server is relatively simple, using things like XAMPP. Other types of server software might be a little more tricky.

Though, you may in fact not need a email server set up. The basic PHP mail() function would require it, but since you are using Laravel you have more options than that. It can be configured to send email through an external SMTP server - like Gmail, for example - instead of relying on a local SMTP server. (A quick Google search turned this up)
Was This Post Helpful? 1
  • +
  • -

#10 astonecipher   User is offline

  • Enterprise Software Architect
  • member icon

Reputation: 3150
  • View blog
  • Posts: 11,955
  • Joined: 03-December 12

Re: Deploying Laravel

Posted 06 May 2016 - 01:07 PM

I may suggest the free tier of AWS
Was This Post Helpful? 1
  • +
  • -

#11 Glorfindal   User is offline

  • Java Enthusiast
  • member icon

Reputation: 37
  • View blog
  • Posts: 607
  • Joined: 31-December 08

Re: Deploying Laravel

Posted 09 May 2016 - 09:57 AM

View PostAtli, on 06 May 2016 - 08:20 PM, said:

PHP 5.5.9 is the minimum for the latest Laravel 5 version, so yes.

You could always try hosting this yourself, if you have a half decent internet connection somewhere.
Just set up XAMPP or WAMP on your PC, and then forward ports 80 (and 443, if you use HTTPS) through your router to that PC.
That's normally not difficult to do on typical home routers.

Just make sure your ISP does not have something against running servers on port 80 in your agreement. I know I ran into that problem when I first started and ended up having to go with hosting.
Was This Post Helpful? 0
  • +
  • -

#12 Atli   User is offline

  • Enhance Your Calm
  • member icon

Reputation: 4241
  • View blog
  • Posts: 7,216
  • Joined: 08-June 10

Re: Deploying Laravel

Posted 09 May 2016 - 02:46 PM

HTTP doesn't necessarily have to be on port 80 or 443. If you're just setting up a test server, or demo server, you could easily get around ISP blocks on those ports by configuring it to use other ports.

Although, if your ISP is backwards enough to block any ports, you would probably be better of switching.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1