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

fsdolphin's avatar

What is the process to upload my app to a shared server

Hi,

After avoiding PHP for years I decided to try Laravel and so far I like it. I don't have any previous experience with server languages nor frameworks (except for Cocoa for iOS and QT for C++ frameworks) and one question that has come to my mind lately is, how difficult it will be to port my application to a shared hosting? All examples I have seen here in Laracasts are based on dedicated servers. I could try to upload it but I don't want to waste any time without getting some advice first.

1- How difficult would it be to port my application to a shared server? Is this even possible?

2- Do I need to install composer?

3- Can someone please describe the process?

Thanks a lot and sorry about the silly question.

0 likes
18 replies
luddinus's avatar

Good luck with that, the typical response in laravel world: "buy a better hosting"

try this:

.htaccess of your directory root

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_URI} !^public
    RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

And in all the directories (app, bootstrap, vendor...) put this .htaccess

deny from all
1 like
fsdolphin's avatar

Thanks a lot for your reply.

Now, lets pretend that I go with a better hosting, what is typically the amount of work that it requires? Do I need to install Composer, Virtual Box and Homestead?

luddinus's avatar

@fsdolphin not at all, just do what you want on your localhost and then upload your laravel project

1 like
davorminchorov's avatar

Which shared hosting service you plan on using? Fortrabbit and Forge are recommended (there's a full series on Forge here). Heroku is also a good platform, you can deploy your app for free and if needed, subscribe for the premium features.

1 like
fsdolphin's avatar

@luddinus How about security, are there any differences between shared vs dedicated servers when it comes to security? In other words, is there anything I would need to do to make it more secure or do some sort of maintenance?

@Ruffles I currently have eleven2.com. Fortrabbit seems a little to expensive for my start up app (10 euro/month). Forge is also $10/month. I have heard about Digital Ocean which is only $5/month, is that a good choice?

Mattiman's avatar

Not sure I understand the problem. You can develop your project locally and then upload your project files to the shared host. Why would that be a problem?

1 like
Mattiman's avatar

@fsdolphin Yes I have done it. No problems at all. Didn't do what @luddinus did.

I upload the files from the Laravel /public folder to the public folder on the web host. In my case it was named '/default'.

I upload all other Laravel files to the folder above that. And that's it, it all works.

1 like
luddinus's avatar

@Mattiman there are some shared hosts that don't allow to have folders one level above.

1 like
Mattiman's avatar

@luddinus yes that can happen, you are right. In that case you have to do something like you mentioned.

But there should be enough shared hosts available which have access to private folders. The ones I use (not expensive, $2-5/month, but still very good and fast) all have that.

1 like
fsdolphin's avatar

Thank you all for your help.

@Mattiman
If I understood this correctly and based on the file structured below which is how my server looks, I would put the files from the "public" folder from Laravel into the "public_html" folder in my server and the rest of the folders from Laravel will go at the same level as the "public_html" in my server, correct?

.cpanel
.ssh
etc
logs
mail
public_ftp
public_html
tmp
.bashrc

@luddinus
there are some shared hosts that don't allow to have folders one level above.
When you say one level above, do you mean at the level of the "public_html" folder? If yes, I just tried it and I was able to create a folder at that level.

Thanks a lot for your help.

sitesense's avatar

Bear in mind that you'll need to be able to make the storage folder writeable, so make sure you're allowed to change permissions in your "one level above" :)

1 like
sitesense's avatar

@Snapey has a better solution here. Avoids the messy structure of dumping your app in the folder above public, keeping everything together :)

1 like
Mattiman's avatar

@fsdolphin yes that's correct. It'll look like:

/app/
/bootstrap/
/public_html/
/vendor/
etc

And with "folder above the public_html level" one does mean the root level in the example above. So the folder in which the folders shown above are is the level "above" compared to the public_html. Since only public_html is public accessible, the app files and everything else is not.

Please or to participate in this conversation.