{"id":6351,"date":"2021-05-22T00:14:33","date_gmt":"2021-05-22T00:14:33","guid":{"rendered":"https:\/\/oxhosting.com\/blog\/2021\/05\/22\/how-to-install-laravel-on-our-server-hosting\/"},"modified":"2021-05-22T00:14:33","modified_gmt":"2021-05-22T00:14:33","slug":"how-to-install-laravel-on-our-server-hosting","status":"publish","type":"post","link":"https:\/\/oxhosting.com\/blog\/2021\/05\/22\/how-to-install-laravel-on-our-server-hosting\/","title":{"rendered":"How to install Laravel on our server &#8211; Hosting"},"content":{"rendered":"<p> <script data-ad-client=\"ca-pub-3214842754935876\" async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\n<\/p>\n<div id=\"article\">&#13;<br \/>\n\t\t<b>Laravel<\/b> is a free, open-source <b>PHP web application framework<\/b>. It provides an expressive, elegant syntax and is used for the development of web applications following the model\u2013view\u2013controller (MVC) architectural pattern. Developers believe development must be an enjoyable, creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as authentication, routing, sessions, queueing, and caching. Laravel is accessible, yet powerful, providing powerful tools needed for large, robust applications. <\/p>\n<p>As of March 2015, Laravel is regarded as one of the most popular PHP frameworks, together with Symfony2, Nette, CodeIgniter, Yii2 and other frameworks. Documentation for the framework can be found on the  Laravel website.&#13;<br \/>\n&#13;<br \/>\nYou are able to choose two different variants of Laravel installation \u2013 <b>automatic via the Softaculous<\/b> and <b>manual<\/b>. <\/p>\n<p><b>Laravel automatic installation via the Softaculous<\/b><\/p>\n<div>Currently, Softaculous allow you to install the latest Laravel version: 6.5.2 The Laravel framework has a few system requirements that may be checked here for every version. <\/div>\n<p>First of all, you need to log into your cPanel account and find <b>Softaculous<\/b> menu in <b>Software and Services section<\/b>:&#13;<br \/>\n&#13;\n<\/p>\n<p><img class=\"kb-image\" src=\"https:\/\/oxhosting.com\/blog\/wp-content\/uploads\/2021\/05\/How-to-install-Laravel-on-our-server-Hosting.png\"\/><\/p>\n<p>Once done, you will be redirected to Softaculous main page. Type <i><b>Laravel <\/b><\/i>in the search bar and click on the result:&#13;<br \/>\n&#13;\n<\/p>\n<p><img class=\"kb-image\" src=\"https:\/\/oxhosting.com\/blog\/wp-content\/uploads\/2021\/05\/1621642471_784_How-to-install-Laravel-on-our-server-Hosting.png\"\/><\/p>\n<p>Move to <b>Install <\/b>tab, there you will be prompted to choose the folder where Laravel will be installed. Feel free to chose the one you need (note that this directory will be created by Softaculous):&#13;<br \/>\n&#13;\n<\/p>\n<p><img class=\"kb-image\" src=\"https:\/\/oxhosting.com\/blog\/wp-content\/uploads\/2021\/05\/1621642472_222_How-to-install-Laravel-on-our-server-Hosting.png\"\/><\/p>\n<p>&#13;<br \/>\nClick the <b>Install <\/b>button and that\u2019s all. <\/p>\n<p><b>Laravel manual installation<\/b><\/p>\n<p>Other software which should be installed in order to set up Laravel is <b>Composer<\/b>. It is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on, and it will manage (install\/update) them for you. Composer is <b>not<\/b> a package manager in the same sense as Yum or Apt are. Yes, it deals with &#8216;packages&#8217; or libraries, but it manages them on a per-project basis, installing them in a directory (e.g., vendor) inside your project. By default, it will never install anything globally. Thus, it is a dependency manager.<\/p>\n<p>Let\u2019s stick to the algorithm of installation now:<\/p>\n<p>1. SSH access should be enabled for your hosting account with us. You can do this with the help of this guide.<\/p>\n<p>2. To access your account via SSH, download and install one of available SSH clients. You can find the list of free SSH clients here. In case you are using a Unix-based OS (Linux or OSX), you can easily run the Terminal application and connect to the server using the command:<\/p>\n<p><i>ssh username@servername -p21098<\/i><\/p>\n<p><b>ssh <\/b> \u2013 command for logging into the remote server&#13;<br \/>\n<br \/><b>username<\/b> \u2013 your cPanel username&#13;<br \/>\n<br \/><b>servername<\/b> \u2013 name of the server where your hosting account is located (you can find it using this tutorial)&#13;<br \/>\n<br \/><b>-p21098<\/b> \u2013 port which is used on the shared server<\/p>\n<p>3. Open your SSH client, put your domain name or the <b>IP address<\/b> of the server into the <b>Host Name<\/b> field, enter <b>21098<\/b> into the <b>Port <\/b>field, choose SSH as your connection type and press the <b>Open <\/b>button:<\/p>\n<p><img class=\"kb-image\" src=\"https:\/\/oxhosting.com\/blog\/wp-content\/uploads\/2021\/05\/1621642472_699_How-to-install-Laravel-on-our-server-Hosting.png\"\/><\/p>\n<p>4. If you receive PuTTY Security Alert, press <b>Yes<\/b>: &#13;<br \/>\n&#13;\n<\/p>\n<p><img class=\"kb-image\" src=\"https:\/\/oxhosting.com\/blog\/wp-content\/uploads\/2021\/05\/1621642472_135_How-to-install-Laravel-on-our-server-Hosting.png\"\/><\/p>\n<p>When prompted, enter your<b> cPanel username <\/b>and <b>password <\/b>(when you enter the password, it is automatically hidden for security purposes): <\/p>\n<p><img class=\"kb-image\" src=\"https:\/\/oxhosting.com\/blog\/wp-content\/uploads\/2021\/05\/1621642472_266_How-to-install-Laravel-on-our-server-Hosting.png\"\/><\/p>\n<p>5. Laravel and Composer require <b>PHP 7.1.3 version<\/b>, so we need to check whether the needed version is set up. Type the <i>php -v<\/i> command in PuTTY (or in Terminal) and you will get the following output:&#13;<br \/>\n&#13;\n<\/p>\n<p><img class=\"kb-image\" src=\"https:\/\/oxhosting.com\/blog\/wp-content\/uploads\/2021\/05\/1621642472_5_How-to-install-Laravel-on-our-server-Hosting.png\"\/><\/p>\n<p>6. In order to set up 7.1 version, you need to log into your cPanel, navigate to <b>Software and Services<\/b> section &gt; <b>Select PHP Version<\/b> menu:&#13;\n<\/p>\n<p><img class=\"kb-image\" src=\"https:\/\/oxhosting.com\/blog\/wp-content\/uploads\/2021\/05\/1621642472_668_How-to-install-Laravel-on-our-server-Hosting.png\"\/><\/p>\n<p>Select 7.1 version from the drop-down menu and then click on the <b>Set as current<\/b> button &gt;&gt; <b>Save<\/b>:&#13;<br \/>\n&#13;\n<\/p>\n<p><img class=\"kb-image\" src=\"https:\/\/oxhosting.com\/blog\/wp-content\/uploads\/2021\/05\/1621642472_547_How-to-install-Laravel-on-our-server-Hosting.png\"\/><\/p>\n<p>You can also find additional information about PHP selector here.&#13;\n<\/p>\n<p>&#13;<br \/>\n&#13;<br \/>\n&#13;<br \/>\n7. Now you need to decide where you wish to put your Laravel installation. For example, we will create <i>laravel_folder<\/i> in public_html using the following command:<\/p>\n<pre class=\"prettyprint\">cd public_html &amp;&amp; mkdir laravel_folder &amp;&amp; cd laravel_folder<\/pre>\n<p>&#13;<br \/>\n\t\tThis line can be divided into three separate commands:&#13;<br \/>\n<\/p>\n<ul>\n<li><b><i>cd public_htm<\/i><i>l<\/i><\/b>: navigation to the <i>public_html<\/i> folder, since after logging in you will be located in the <i>\/home\/username\/<\/i> folder by default<\/li>\n<li><b><i>mkdir laravel_folder<\/i><\/b>:<i> mkdir <\/i>command will create of a new folder named <i>laravel_folder<\/i>, you can replace <i>laravel_folder<\/i> with any desired name<\/li>\n<li><b><i>cd laravel_folder<\/i><\/b>: navigation to the newly created <i>laravel_folder<\/i><\/li>\n<li><b><i>&amp;&amp;<\/i><\/b>:<b\/>used for combination of several different commands.&#13;<br \/>\n&#13;<br \/>\n&#13;\n<\/li>\n<\/ul>\n<p><img class=\"kb-image\" src=\"https:\/\/oxhosting.com\/blog\/wp-content\/uploads\/2021\/05\/1621642472_653_How-to-install-Laravel-on-our-server-Hosting.png\"\/><\/p>\n<p>8. Then you need to copy <b>php.ini<\/b> file from the default location on the server to your <i>laravel_folder<\/i> using this command:&#13;<br \/>\n&#13;\n<\/p>\n<pre class=\"prettyprint\">cp \/opt\/alt\/php56\/etc\/php.ini \/home\/username\/public_html\/laravel_folder&#13;\n<\/pre>\n<p><\/p>\n<ul>\n<li><b><i>cp<\/i><\/b>:<b\/>this command is used to copy the php.ini file to the folder you wish to use with Laravel. <\/li>\n<\/ul>\n<p><b>NOTE 1:<\/b> make sure that you replace <i>username <\/i>with your actual cPanel username <\/p>\n<p><b>NOTE 2:<\/b> in case you need php.ini for any other PHP version, just change <i>php56 <\/i>to <i>php55<\/i> or to any other value corresponding to the current version.&#13;<br \/>\n&#13;<br \/>\n&#13;\n<\/p>\n<p><img class=\"kb-image\" src=\"https:\/\/oxhosting.com\/blog\/wp-content\/uploads\/2021\/05\/1621642472_309_How-to-install-Laravel-on-our-server-Hosting.png\"\/><\/p>\n<p>9. Now you will need to find php.ini file in current location. Log into <b>cPanel<\/b> and navigate <b>File Manager<\/b> menu:&#13;<br \/>\n&#13;\n<\/p>\n<p><img class=\"kb-image\" src=\"https:\/\/oxhosting.com\/blog\/wp-content\/uploads\/2021\/05\/1621642472_180_How-to-install-Laravel-on-our-server-Hosting.png\"\/><\/p>\n<p>Move to the folder you have chosen for Laravel and open php.ini with Editor:&#13;<br \/>\n&#13;\n<\/p>\n<p><img class=\"kb-image\" src=\"https:\/\/oxhosting.com\/blog\/wp-content\/uploads\/2021\/05\/1621642472_725_How-to-install-Laravel-on-our-server-Hosting.png\"\/><\/p>\n<p>Then add the following block to the end of the file and hit <b>Save<\/b> button:&#13;<br \/>\n&#13;\n<\/p>\n<pre class=\"prettyprint\">max_execution_time = 300&#13;\n<br\/>max_input_time = 300&#13;\n<br\/>memory_limit = 512M&#13;\n<br\/>suhosin.executor.include.whitelist = phar&#13;\n<br\/>detect_unicode = Off<\/pre>\n<p><img class=\"kb-image\" src=\"https:\/\/oxhosting.com\/blog\/wp-content\/uploads\/2021\/05\/1621642472_662_How-to-install-Laravel-on-our-server-Hosting.png\"\/><\/p>\n<p>10. When all the preparations are done, you are ready to install Composer and then Laravel. Open PuTTY window where you have logged into your cPanel account and fill in the following command:&#13;\n<\/p>\n<pre class=\"prettyprint\">php -r \"readfile('https:\/\/getcomposer.org\/installer');\" | php -c php.ini<\/pre>\n<p>This will execute the Composer installation:&#13;<br \/>\n&#13;<\/p>\n<p><img class=\"kb-image\" src=\"https:\/\/oxhosting.com\/blog\/wp-content\/uploads\/2021\/05\/1621642472_930_How-to-install-Laravel-on-our-server-Hosting.png\"\/><\/p>\n<p><b>NOTE:<\/b> To run composer commands use:<b> php -c php.ini composer.phar<\/b>\u00a0&#13;\n<\/p>\n<p>In case you get a notification <b>Some settings on your machine make Composer unable to work properly<\/b>, make sure that the PHP version is 5.5 or higher and all the changes in the php.ini file are saved. &#13;<br \/>\n&#13;<br \/>\n&#13;\n<\/p>\n<p>11. Now you are ready to install Laravel. Execute the command provided below:&#13;\n<\/p>\n<pre class=\"prettyprint\">php -c php.ini \/home\/username\/public_html\/directory\/composer.phar create-project laravel\/laravel --prefer-dist<\/pre>\n<p><b>NOTE:<\/b> make sure that you replace the default details with the actual ones \u2013 <i>username <\/i>should be replaced with your cPanel username, <i>directory <\/i>should be replaced with the name of the folder you installed Composer to.&#13;<br \/>\n&#13;<\/p>\n<p>You will see the output like it is shown in the screenshot which means that some dependencies are installing:&#13;<br \/>\n&#13;<br \/>\n&#13;\n<\/p>\n<p><img class=\"kb-image\" src=\"https:\/\/oxhosting.com\/blog\/wp-content\/uploads\/2021\/05\/1621642472_401_How-to-install-Laravel-on-our-server-Hosting.png\"\/><\/p>\n<p>Once the installation is successfully completed, you will get this output:<\/p>\n<p><img class=\"kb-image\" src=\"https:\/\/oxhosting.com\/blog\/wp-content\/uploads\/2021\/05\/1621642472_64_How-to-install-Laravel-on-our-server-Hosting.png\"\/><\/p>\n<p>&#13;<br \/>\nBy default Laravel installation will be installed in <b>laravel <\/b>folder in the same directory chosen for Composer installation.<\/p>\n<div>After installing Laravel, you should configure your web server&#8217;s document\/web root to be the public directory. The <b>index.php<\/b> file in this directory serves as the front controller for all HTTP requests entering your application. <\/p>\n<p>In order to create an <b>index.php<\/b> file, navigate to the root directory of Laravel installation in <b>cPanel<\/b> &gt;&gt; <b>File Manager<\/b> &gt;&gt; root folder of the installation (in this case it is <b>public_html <\/b>&gt;&gt; <b>laravel_folder <\/b>&gt;&gt; <b>laravel<\/b>).<\/p>\n<p>There you may create an <b>index.php<\/b> file if it was not created automatically. In order to add the file click <b>+File<\/b> and type the name:\u00a0 <b>index.php <\/b>&gt;&gt; <b>Create new file<\/b>:&#13;\n<\/p>\n<p><img class=\"kb-image\" src=\"https:\/\/oxhosting.com\/blog\/wp-content\/uploads\/2021\/05\/1621642472_560_How-to-install-Laravel-on-our-server-Hosting.png\"\/><\/p>\n<p>Right click on the <b>index.php<\/b> file &gt;&gt;<b> Edit<\/b> and paste the code below:<\/p>\n<\/div>\n<div>\n<pre class=\"prettyprint\"> &lt;?php<br\/>header(\"refresh: 5; http:\/\/yourdomain.com\/laravel\/public\/\");<p>\u00a0\u00a0\u00a0 echo '&lt;title&gt;Laravel Installed&lt;\/title&gt;&lt;div style=\"background: #e9ffed; border: 1px solid #b0dab7; padding: 15px;\" align=\"center\" &gt;<br\/>\u00a0\u00a0\u00a0 &lt;font size=\"5\" color=\"#182e7a\"&gt;Laravel is installed successfully.&lt;\/font&gt;&lt;br \/&gt;&lt;br \/&gt;<br\/>\u00a0\u00a0\u00a0 &lt;font size=\"4\"&gt;Laravel is a Framework and doesn't have an index page.&lt;br \/&gt;&lt;br \/&gt;<br\/>\u00a0\u00a0\u00a0 You will be redirected to its \"public\" folder in 5 seconds...&lt;br \/&gt;&lt;br \/&gt;<br\/>\u00a0\u00a0\u00a0 Laravel is a clean and classy framework for PHP web development.<\/p><p>Freeing you from spaghetti code, Laravel helps you create wonderful applications using simple, expressive syntax. Development should be a creative experience that you enjoy, not something that is painful. Enjoy the fresh air.<br\/>&lt;\/font&gt;&lt;\/div&gt;';<br\/>?&gt;<\/p><\/pre>\n<p><\/div>\n<div>Click <b>Save<\/b>. <\/p>\n<p><b>NOTE<\/b>: Do not forget to change <i>http:\/\/yourdomain.com\/laravel\/public\/ <\/i>link to your actual domain name.<\/p>\n<\/div>\n<\/div>\n<script data-ad-client=\"ca-pub-3214842754935876\" async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\n","protected":false},"excerpt":{"rendered":"<p>&#13; Laravel is a free, open-source PHP web application framework. It provides an expressive, elegant syntax and is used for the development of web applications&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/oxhosting.com\/blog\/wp-json\/wp\/v2\/posts\/6351"}],"collection":[{"href":"https:\/\/oxhosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/oxhosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/oxhosting.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oxhosting.com\/blog\/wp-json\/wp\/v2\/comments?post=6351"}],"version-history":[{"count":0,"href":"https:\/\/oxhosting.com\/blog\/wp-json\/wp\/v2\/posts\/6351\/revisions"}],"wp:attachment":[{"href":"https:\/\/oxhosting.com\/blog\/wp-json\/wp\/v2\/media?parent=6351"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oxhosting.com\/blog\/wp-json\/wp\/v2\/categories?post=6351"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oxhosting.com\/blog\/wp-json\/wp\/v2\/tags?post=6351"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}