{"id":1289,"date":"2023-11-02T19:32:24","date_gmt":"2023-11-02T19:32:24","guid":{"rendered":"https:\/\/www.devopssupport.in\/blog\/?p=1289"},"modified":"2023-11-27T19:53:15","modified_gmt":"2023-11-27T19:53:15","slug":"how-to-download-and-installer-php-and-how-to-add-path-in-apace-and-vhost","status":"publish","type":"post","link":"https:\/\/www.devopssupport.in\/blog\/how-to-download-and-installer-php-and-how-to-add-path-in-apace-and-vhost\/","title":{"rendered":"How to download and installer php and How to add path in apace and vhost"},"content":{"rendered":"\n<p>To download and install PHP and Laravel on your machine and configure Apache with a virtual host, follow these steps. This guide assumes you are using a Windows environment. If you&#8217;re using a different operating system, some steps might vary.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. Download and Install PHP:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Visit the <a href=\"https:\/\/windows.php.net\/download\/\">official PHP website<\/a> to download the PHP installer for Windows.<\/li>\n\n\n\n<li>Choose the PHP version that fits your requirements. As of my last knowledge update in January 2022, PHP 8.1 might be the latest stable version.<\/li>\n\n\n\n<li>Run the installer and follow the installation prompts. During installation, make sure to add PHP to your system PATH.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">2. Download and Install Composer:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Visit the <a href=\"https:\/\/getcomposer.org\/download\/\">Composer website<\/a> to download and install Composer.<\/li>\n\n\n\n<li>Run the installer and follow the installation prompts.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">3. Install Laravel:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open a command prompt and navigate to the directory where you want to install Laravel.<\/li>\n\n\n\n<li>Run the following command to create a new Laravel project:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>composer create-project --prefer-dist laravel\/laravel your-project-name\r\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Replace &#8220;your-project-name&#8221; with the desired name for your Laravel project.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">4. Configure Apache and Virtual Host:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Locate your Apache configuration files. This is typically in the <code>conf<\/code> directory where Apache is installed.<\/li>\n\n\n\n<li>Open the <code>httpd.conf<\/code> file and make sure that the following lines are uncommented:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>LoadModule rewrite_module modules\/mod_rewrite.so\r\n<\/code><\/pre>\n\n\n\n<p>Create a virtual host for your Laravel project. Open the <code>httpd-vhosts.conf<\/code> file and add the following:<\/p>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;VirtualHost *:80>\r\n    DocumentRoot \"C:\/path-to-your-laravel-project\/public\"\r\n    ServerName your-laravel-project.local\r\n\r\n    &lt;Directory \"C:\/path-to-your-laravel-project\/public\">\r\n        Options Indexes FollowSymLinks\r\n        AllowOverride All\r\n        Require all granted\r\n    &lt;\/Directory>\r\n&lt;\/VirtualHost>\r\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Replace &#8220;C:\/path-to-your-laravel-project&#8221; with the actual path to your Laravel project and &#8220;your-laravel-project.local&#8221; with your desired local domain.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">5. Edit Hosts File:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open the <code>hosts<\/code> file located at <code>C:\\Windows\\System32\\drivers\\etc\\hosts<\/code> with a text editor with administrative privileges.<\/li>\n\n\n\n<li>Add the following line:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>127.0.0.1    your-laravel-project.local\n\nReplace \"your-laravel-project.local\" with the same ServerName used in your virtual host configuration.\n\n<strong>6. Edit Hosts File:<\/strong>\nRestart Apache to apply the changes.\n\n<strong>7. Access Your Laravel Application:<\/strong>\nOpen your web browser and navigate to http:\/\/your-laravel-project.local.<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>To download and install PHP and Laravel on your machine and configure Apache with a virtual host, follow these steps. This guide assumes you are using a&#8230; <\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[529,528,526,527,525],"class_list":["post-1289","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-configure-apache-and-virtual-host","tag-download-and-install-composer","tag-how-to-add-path-in-apace-and-vhost","tag-how-to-download-and-installer-php","tag-how-to-download-and-installer-php-and-how-to-add-path-in-apace-and-vhost"],"_links":{"self":[{"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/posts\/1289","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/comments?post=1289"}],"version-history":[{"count":1,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/posts\/1289\/revisions"}],"predecessor-version":[{"id":1290,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/posts\/1289\/revisions\/1290"}],"wp:attachment":[{"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/media?parent=1289"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/categories?post=1289"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/tags?post=1289"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}