Installing Laravel Without Composer

Some people don’t realize that Composer isn’t required to use Laravel. It is nice to have however and should be used when ever possible. If you have no reason for excluding Composer, see my original tutorial on Installing Laravel with Composer HERE. For those of you that cannot use composer because your hosting provider doesn’t allow it or because you want only use composer on your primary developing environment, this article is for you. In this article, I am using Xampp, but the basics will apply to any basic web server.

Setting Up a Basic Working Environment For Laravel

If you are just experimenting or need a secondary development environment, then I suggest cloning your original Xampp server and installing Laravel there. Follow my tutorial on Cloning Xampp by CLICKING HERE to learn how to clone Xampp to have two working copies of your development environment for testing and developing more applications. If you already have a copy of Xampp or another web server working where you want to install Laravel, then don’t worry about this part of the tutorial. It is over now anyway. Ha ha.

Download Laravel

If you have downloaded Laravel before, you can use those files, otherwise download a fresh copy BY CLICKING HERE to get it from github.com or just go to http://laravel.com/. If you go to Laravel.com, click on the five minute quick start button and you will see that they instruct you to use composer, but under that they provide a link to download from github which is what you want to do in this case. I provided both links because Laravel.com has general information that is useful for beginners, but you could just download from github if you are in a hurry and just want to follow this tutorial to get up and running.

Here’s the Gotcha!

You have to run composer once! I know, I said we were installing Laravel without composer, but what I meant was for cases where you cannot install composer like production shared server environments. This is basically a work-around for those that can not install Composer on a client’s server or on their own. You can however almost always install Composer on your Local Machine. I see no reason why anyone couldn’t! So go ahead and run composer. After you do so on your local machine, you will have all the dependencies necessary downloaded into your Laravel installation and you can now move it to a server that can not or does not, for whatever reason, use Composer. Now, if you have already installed Laravel on your original Xampp server and are working on a clone now, you can move a project over without composer just by moving the Laravel directories over to the htdocs folder of your new server, so see, we are installing Laravel without Composer after all! I told you so!. The “Gotcha” is that you do have to run Composer somewhere at least one time to get all the dependencies required to run Laravel. So, if you can’t do it on the production server, do it on your localhost and upload the entire working Laravel installation to your production machine when it’s ready. I’ll explain just how to do this later, so keep reading!

Running Composer from Localhost

So, as I mentioned, you all should be able to run Composer from your localhost, so go ahead and do that using your Xampp installation by opening up a terminal window from your Xampp control panel. Just go to the file, xampp-comtrol in your main Xampp folder and fire up your server if you have not already, then click on the “Shell” button to get a shell prompt.

Okay, before we install our Laravel dependencies, make sure you have yourself in order…or at least have your Laravel directory in order. I can’t help you with you ha ha. So, if you installed Laravel from github.com as I suggested above, unzip the laravel-master.zip folder into your htdocs directory of xampp. Sadly it will be in a sub-folder like laravel-master/laravel-master and we probably don’t want that, so just make a new folder in htdocs called “laravel” or whatever you want to call your project and open up the final laravel-master folder, the one with all the files and cut all the contents and paste them into your final project directory.

Now go back to your shell and type:

composer install

Type the above from the shell prompt to have Composer download the necessary dependencies and add them to your Laravel project. You will notice a new folder in your Laravel directory called “vendor” that is the results of running the composer install command, but be patient, depending on your internet service provider, it could take several minutes to complete. Watch your shell prompt, when it is done, it will let you know by returning your command prompt to you.

Test Laravel

To see if it worked, go to:

http://localhost/laravel/public/

If you named your project “laravel” as I suggested above, then that URL should now work, but if you named it something else, replace laravel with whatever you named your Laravel folder. If your efforts were a success, you should see a page like in the following screenshot I took while making this tutorial:

Snap 2013-10-08 at 16.07.01All is god if you see the above on your screen navigating to your Laravel public folder. If you see anything else, you have issues I suspect. Read on for help! There is a troubleshooting section below, trust me. It may be a ways down the page, but it is there, I promise.

 

Moving Laravel from localhost to a Live Web Server

Here comes the fun part! This is where you folks that don’t want to or can’t use Composer on your production server will thank me. This part was tricky for me the first time because I couldn’t find a tutorial on it anywhere, which also in part inspired me to write out, so hopefully if you are reading this, you won’t have the difficult time I did. Well, if you are the thanking type anyway. If not, don’t worry about it, my feelings won’t be hurt. I don’t know you anyway. So, go to your nasty old public shared host and make a FTP connection to it. I like to use Filezilla for this. If you don’t know how to connect to your web server with FTP, contact your host or Google it and get instructions. Most hosting support departments are prepared to answer such elementary questions as how to access your account using FTP, so don’t be afraid to ask! Once you have established an FTP connection, make a new directory for your Laravel Project or upload the existing project from your local machine and use that. Here is all you are going to need to do to move your Laravel project from localhost to another web server:

  1. Go to your project on your local machine. If you don’t have one and need one just for testing, create a simple route at least so you have something in your project to migrate to a new server for learning purposes. CLICK HERE to see my simple Laravel route tutorial to create a route if you don’t already know how.

 

Troubleshooting, Help Me!

Here are some possible issues you may have when following this tutorial if you didn’t follow every small detail to the letter:

  • Laravel may be configured wrong for your environment. When I wrote this tutorial, I assumed you were working on your localhost and that you used xampp installed on your local machine. That also assumes that your working directory is going to have http://localhost/ as it’s root. If that isn’t the case, you will need to set some configuration settings in your Laravel installation. Look in your app/config directory for clues as to how to resolve such issues. Also your database may need configured. Laravel, conveniently for some of us, comes set up for a local host install with default settings for Mysql which uses root user and no password by default out of the box, but if you have changed this, you will have to go into your database..php file and make changes. It is located in app/config/database.php, so go there and make the appropriate changes if necessary and try to start your project again. It should work now.
  • Apparently my directory paths are different and are causing issues when I moved my installation to a live web server! You can configure Laravel directory paths in  bootstrap/paths.php.
  • Where can I find more help, your tutorial sucks and I can’t get my Laravel app working! Okay okay, jeez! give me a break here… go to laravel.com/docs and happy hunting. No need to be rude.

 

 

 

10 Replies to “Installing Laravel Without Composer”

  1. This is the manual that I’m looking for. Unfortunately, Moving Laravel from localhost to a Live Web Server part 2 is missing. Can you upload this part?

    Very thanks!

  2. My app work perfectly on local server, but when i upload it something change with the routes, i dont understand why on local server it works perfectly but in web server dont..
    The routes are changed when i upload it?

  3. Hi,
    I found your tutorial after I already figured out how to make it work. Thanks, sometimes I just need to see how someone else is doing it.
    Here I’d like to point out – what can happen if you update files on your prod server. It might not work if you don’t re-upload vendor folder. Right now I’m still playing around what folders in vendor are crucial, as it takes quiet some time to upload all.

  4. Thanks for the tutorial, i want to make a note of the following:

    Apparently my directory paths are different and are causing issues when I moved my installation to a live web server! You can configure Laravel directory paths in bootstrap/paths.php.

    After some research i found out that moving the laravel installation in windows, will (of course) also change the paths. In laravel 5 you will need to change the paths in the following file: bootstrap/cache/config.php

    After performing this action the environment should function again. (This helped for me anyway)

    Thanks for this artikel, helped me a lot!

  5. I wouldn’t recommend shared hosting for Laravel app. A better option is a platform, like Cloudways laravel hosting platform where you get Laravel ready server in just few minutes. You can easily deploy your app through ssh or git to the server.

Leave a Reply

Your email address will not be published. Required fields are marked *