{"id":1029,"date":"2018-07-04T09:44:00","date_gmt":"2018-07-04T04:14:00","guid":{"rendered":"https:\/\/www.coimbatorewebhosting.com\/blog\/?p=1029"},"modified":"2019-04-09T17:34:28","modified_gmt":"2019-04-09T12:04:28","slug":"install-laravel-5-5-on-centos-7","status":"publish","type":"post","link":"https:\/\/coimbatorewebhosting.com\/blog\/install-laravel-5-5-on-centos-7\/","title":{"rendered":"How to install Laravel 5.5 on CentOS 7"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/install-laravel-5-5-on-centos-7\/#Introduction\" >Introduction<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/install-laravel-5-5-on-centos-7\/#Prerequities\" >Prerequities<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/install-laravel-5-5-on-centos-7\/#Article_contains\" >Article contains:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/install-laravel-5-5-on-centos-7\/#Install_Apache\" >Install Apache<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/install-laravel-5-5-on-centos-7\/#Install_PHP_71\" >Install PHP 7.1<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/install-laravel-5-5-on-centos-7\/#Download_Composer\" >Download Composer<\/a><\/li><\/ul><\/nav><\/div>\n<h4><span class=\"ez-toc-section\" id=\"Introduction\"><\/span>Introduction<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>Laravel is a powerful MVC-PHP framework, designed for developers who need a simple and elegant toolkit to create full-featured web applications. Laravel was created by Taylor Otwell. In this guide, we will install <a href=\"https:\/\/laravel.com\/\" rel=\"nofollow noopener\" target=\"_blank\">Laravel<\/a> 5.5 on CentOS 7 and as you might already know Laravel 5.5 depends on PHP 7.0+ so we are going to install the latest stable version of PHP which is 7.1 and finally serve the whole thing with Apache web server.<\/p>\n<h4><span class=\"ez-toc-section\" id=\"Prerequities\"><\/span>Prerequities<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>1.Server with SSH<\/p>\n<h4><span class=\"ez-toc-section\" id=\"Article_contains\"><\/span>Article contains:<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<ul>\n<li>Installing Apache<\/li>\n<li>Installing PHP 7.1<\/li>\n<li>Download &amp; Install Composer<\/li>\n<li>Configuring Apache<\/li>\n<li>Set the Permissions<\/li>\n<li>Test<\/li>\n<\/ul>\n<h4><span class=\"ez-toc-section\" id=\"Install_Apache\"><\/span>Install Apache<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>You can install Apache 2 easily using \u201cyum\u201d with the following command:<\/p>\n<pre>yum install httpd<\/pre>\n<p>After the installation process is finished you can use the commands below to start your Apache service and make it run at startup:<\/p>\n<pre>systemctl start httpd\r\nsystemctl enable httpd<\/pre>\n<h4><span class=\"ez-toc-section\" id=\"Install_PHP_71\"><\/span>Install PHP 7.1<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>PHP 7.1 is not provided by the official RHEL repository so you have to\u00a0add \u201cWebtatic\u201d repo in order to install it easily.<\/p>\n<p>First, install EPEL repository with the following command:<\/p>\n<pre>yum install epel-release<\/pre>\n<p>Now you can add the Webtatic repo:<\/p>\n<pre>rpm -Uvh https:\/\/mirror.webtatic.com\/yum\/el7\/webtatic-release.rpm<\/pre>\n<p>Update your repository list with the command below:<\/p>\n<pre>yum repolist<\/pre>\n<p>execute the command below to easily install PHP 7.1 and the needed extensions:<\/p>\n<pre>yum install php71w\u00a0php71w-common\u00a0php71w-gd\u00a0php71w-phar\u00a0php71w-xml\u00a0php71w-cli\u00a0php71w-mbstring\u00a0php71w-tokenizer\u00a0php71w-openssl\u00a0php71w-pdo<\/pre>\n<h4><span class=\"ez-toc-section\" id=\"Download_Composer\"><\/span>Download Composer<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>For installing the latest version of Laravel we need to get the Composer dependency manager:<\/p>\n<pre>curl -sS https:\/\/getcomposer.org\/installer | php<\/pre>\n<p>Execute the following command to move your Composer binary file to the executable path:<\/p>\n<pre>mv composer.phar \/usr\/local\/bin\/composer<\/pre>\n<p>Now you can run the command below to download and install Laravel directly into your Apache document root:<\/p>\n<pre>composer create-project laravel\/laravel \/var\/www\/html\/laravel<\/pre>\n<p>Set the correct DocumentRoot<\/p>\n<p>Open the HTTPD global configuration file:<\/p>\n<pre>nano \/etc\/httpd\/conf\/httpd.conf<\/pre>\n<p>Find the line that refers to:<\/p>\n<p>DocumentRoot &#8220;\/var\/www\/html&#8221;<\/p>\n<p>and change it like below:<\/p>\n<pre>DocumentRoot \"\/var\/www\/html\/laravel\/public\"<\/pre>\n<p>Then save and exit.<\/p>\n<p>Restart Apache to take effect:<\/p>\n<pre>systemctl restart httpd<\/pre>\n<p>Set the Permissions<\/p>\n<p>Execute the following command one by one to set the proper permissions:<\/p>\n<pre>chown -R apache:apache \/var\/www\/html\/laravel\r\nchmod\u00a0-R 755 \/var\/www\/html\/laravel\/storage<\/pre>\n<p>If your Firewall is active you should execute the following commands in order to allow HTTP and HTTPS ports:<\/p>\n<pre>firewall-cmd \u2013permanent \u2013add-port=80\/tcp\r\nfirewall-cmd \u2013permanent \u2013add-port=443\/tcp<\/pre>\n<p>Test if everything works fine<\/p>\n<p>Now you can open your browser and see your public IP address or your Domain through it.<\/p>\n<p>You should see a page like below:<\/p>\n<div id=\"attachment_1034\" style=\"width: 1251px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-1034\" class=\"wp-image-1034 size-full\" src=\"https:\/\/www.coimbatorewebhosting.com\/blog\/wp-content\/uploads\/2018\/07\/laravel.jpg\" alt=\"laravel\" width=\"1241\" height=\"630\" srcset=\"https:\/\/coimbatorewebhosting.com\/blog\/wp-content\/uploads\/2018\/07\/laravel.jpg 1241w, https:\/\/coimbatorewebhosting.com\/blog\/wp-content\/uploads\/2018\/07\/laravel-300x152.jpg 300w, https:\/\/coimbatorewebhosting.com\/blog\/wp-content\/uploads\/2018\/07\/laravel-768x390.jpg 768w, https:\/\/coimbatorewebhosting.com\/blog\/wp-content\/uploads\/2018\/07\/laravel-1024x520.jpg 1024w\" sizes=\"auto, (max-width: 1241px) 100vw, 1241px\" \/><p id=\"caption-attachment-1034\" class=\"wp-caption-text\">laravel<\/p><\/div>\n<p>And you can verify that you installed Laravel 5.5 with the following command:<\/p>\n<p>cd \/var\/www\/html\/laravel php artisan -V<\/p>\n<p>Hope the above post will guide you to isntall laravel and to know more about <a href=\"https:\/\/www.coimbatorewebhosting.com\/blog\/easy-steps-to-install-and-configure-lamp-in-centos-7\/\">click here.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Laravel is a powerful MVC-PHP framework, designed for developers who need a simple and elegant toolkit to create full-featured web applications. Laravel was created by Taylor Otwell. In this guide, we will install Laravel 5.5 on CentOS 7 and as you might already know Laravel 5.5 depends on PHP [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1038,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[153,154],"tags":[83,82,80,81],"class_list":["post-1029","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos-7-rhel-7","category-cpanel-whm","tag-apache","tag-composer-dependency-manager","tag-laravel","tag-webtatic-repo"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/coimbatorewebhosting.com\/blog\/wp-content\/uploads\/2018\/07\/laravel.png","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pa2YU7-gB","_links":{"self":[{"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1029","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/comments?post=1029"}],"version-history":[{"count":0,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1029\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/media\/1038"}],"wp:attachment":[{"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/media?parent=1029"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/categories?post=1029"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/tags?post=1029"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}