Home Ask Login Register

Developers Planet

Your answer is one click away!

Shivam February 2016

Laravel Access forbidden on localhost xampp

I just got stuck in the very begining. I have installed laravel and when i run php artisan serv command then this(Laravel development server started on http://localhost:8000/) line appears but when i access it through browser(http://localhost:8000/) then the following error gets displayed.

Access forbidden! You don't have permission to access the requested object. It is either read-protected or not readable by the server. If you think this is a server error, please contact the webmaster. Error 403 localhost Apache/2.4.18 (Win32) OpenSSL/1.0.2e PHP/7.0.2

Please help me out. Any help would be greatly appreciated. I am beginner in laravel.

Answers


Roj Vroemen February 2016

It seems to me that you already have Apache running on port 8000.

Try running the serve command like this: php artisan serve --port=9000

After it's running navigate to http://localhost:9000


BKF February 2016

Follow the steps below to create a virtual host:

Change to your XAMPP installation directory (typically, C:\xampp) and open the " httpd-vhosts.conf " and " httpd-xampp.conf " files in the apache\conf\extra\ subdirectory using your favourite text editor. Add these lines into both files with the following directives:

<VirtualHost *:80>
       DocumentRoot "C:\Users\Shivam\Desktop\laravel_project\blog"
       ServerName blog.dev
   <Directory "C:\Users\Shivam\Desktop\laravel_project\blog">
    Options Indexes FollowSymLinks MultiViews   
    AllowOverride all 
    Order Deny,Allow
    Allow from all
    Require all granted
  </Directory>  
</VirtualHost>

This contains two virtual host configuration blocks:

The first block is the default or fallback virtual host, which is used for all requests that are not matched by subsequent blocks. The second block sets up a virtual host named wordpress.localhost. The DocumentRoot directive specifies the directory to be used when serving requests for this virtual host (in this case, the WordPress installation directory), while the ServerName directive specifies the custom domain name for the virtual host.

To add more virtual hosts, simply duplicate the second virtual host block and modify the port number, DocumentRoot and ServerName directives as per your requirements. For example, if you want to use SSL with your custom domain name, you can add a new virtual host block for port 443. If you plan to have a large number of virtual hosts with very similar configuration, consider using wildcard-based subdomains with your virtual hosts.

Restart Apache using the XAMPP control panel for your changes to take effect.

At this point, your virtual host is configured. However, if you try browsing to the wordpress.localhost domain, your browser will show a failure notice, since this domain does not exist in reality. To resolve this,

Post Status

Asked in February 2016
Viewed 3,540 times
Voted 13
Answered 2 times

Search




Leave an answer


Quote of the day: live life