{"id":136,"date":"2021-03-13T10:33:20","date_gmt":"2021-03-13T10:33:20","guid":{"rendered":"http:\/\/tiruppurwebhosting.com\/blog\/?p=136"},"modified":"2021-03-12T10:35:46","modified_gmt":"2021-03-12T10:35:46","slug":"how-to-install-laravel-5-5-on-centos-7","status":"publish","type":"post","link":"https:\/\/tiruppurwebhosting.com\/blog\/how-to-install-laravel-5-5-on-centos-7\/","title":{"rendered":"How to install Laravel 5.5 on CentOS 7"},"content":{"rendered":"<h4>Introduction<\/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\/\" target=\"_blank\" rel=\"noopener\">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>Prerequities<\/h4>\n<p>1.Server with SSH<\/p>\n<h4>Article contains:<\/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>Install Apache<\/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>Install PHP 7.1<\/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>Download Composer<\/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<figure id=\"attachment_1034\" aria-describedby=\"caption-attachment-1034\" style=\"width: 1241px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" 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\" \/><figcaption id=\"caption-attachment-1034\" class=\"wp-caption-text\">laravel<\/figcaption><\/figure>\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\/\" target=\"_blank\" rel=\"noopener\">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 7.0+ so we are going<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[58,59,60,61],"class_list":["post-136","post","type-post","status-publish","format-standard","hentry","category-home","tag-apache","tag-composer-dependency-manager","tag-laravel","tag-webstatic-repo"],"_links":{"self":[{"href":"https:\/\/tiruppurwebhosting.com\/blog\/wp-json\/wp\/v2\/posts\/136","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tiruppurwebhosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tiruppurwebhosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tiruppurwebhosting.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tiruppurwebhosting.com\/blog\/wp-json\/wp\/v2\/comments?post=136"}],"version-history":[{"count":0,"href":"https:\/\/tiruppurwebhosting.com\/blog\/wp-json\/wp\/v2\/posts\/136\/revisions"}],"wp:attachment":[{"href":"https:\/\/tiruppurwebhosting.com\/blog\/wp-json\/wp\/v2\/media?parent=136"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tiruppurwebhosting.com\/blog\/wp-json\/wp\/v2\/categories?post=136"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tiruppurwebhosting.com\/blog\/wp-json\/wp\/v2\/tags?post=136"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}