0

I want to create a more realistic dev environment for my laravel app. I want to start my laravel app with apache.

The issue is, I always get this error if I try to access the project through the URL (localhost.eu):

Forbidden
You don't have permission to access / on this server.

What I have done so far:

  1. Edited the httpd.conf in Apache\conf, I uncommented this line:

LoadModule rewrite_module modules/mod_rewrite.so

  1. Edited the httpd-vhosts.conf in Apache\conf\extra, I added:
<VirtualHost *:80>
    DocumentRoot "Y:/PHP-Projects"
    ServerName localhost 
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "Y:/PHP-Projects/Project-Admin-PHP/public"
    ServerName localhost.eu 
    <Directory Y:/PHP-Projects/Project-Admin-PHP/public>
        AllowOverride all
        Require all granted
    </Directory>
</VirtualHost>
  1. Edited the hosts file in Windows\System32\drivers\etc, I added:

127.0.0.1 www.localhost.eu localhost.eu

  1. I also tried to edit the default laravel .htaccess, basically I tried all solutions in this thread.

  2. Edited the httpd.conf in Apache\conf:

<Directory Y:/PHP-Projects/Project-Admin-PHP/public>
    AllowOverride all
    Require all granted
</Directory>

It was:

<Directory />
    AllowOverride none
    Require all denied
</Directory>

After every step I restarted the apache24 service.

NOTE: If I try to access, f.e. localhost.eu/robots.txt I see the file, so it correctly connected to the project folder.

If I type in http://localhost.eu/index.php I see the code of the index.php, it is somehow not executed?

Roman
  • 3,563
  • 5
  • 48
  • 104
  • P.S.: In step 5 I edited the Directory argument in the httpd.conf file, dont do this. Also you will need to add this `DirectoryIndex index.php` in `httpd-vhosts.conf` in the `Directory` block. – Roman Jul 25 '19 at 09:07

1 Answers1

1

I suggest, you forgot enable php module. In httpd.conf uncomment enabling php extension. I recomend you installing all in one web server package like wamp http://www.wampserver.com/en/ or xamp. They solve all these problems related with configuring web server.

Add this to your httpd.conf file of apache:

AddHandler application/x-httpd-php .php
AddType application/x-httpd-php .html .htm
LoadModule php7_module "C:/PHP7/php7apache2_4.dll"
PHPIniDir "C:/PHP7"
Roman
  • 3,563
  • 5
  • 48
  • 104
potiev
  • 546
  • 2
  • 11
  • Sadly there is no enabling php extension var in the httpd.conf file. I know that there is XAMP, but I discovered it too late. I have already setup everything myself and I'd like to finish this and understand whats going on. Thanks again for the reply. – Roman Jul 25 '19 at 08:46
  • Probably something is wrong in the php.ini, I use php 7. – Roman Jul 25 '19 at 08:47
  • You can't find line like that `LoadModule php5_module "c:/wamp/bin/php/php5.4.12/php5apache2_4.dll"` in httpd.conf file – potiev Jul 25 '19 at 08:49
  • Thats the weird issue, I have no LoadModule php at all in my apache httpd.conf. Also why php5_module? I use PHP7 – Roman Jul 25 '19 at 08:53
  • I found this file in my PHP folder: `php7apache2_4.dll` what now? – Roman Jul 25 '19 at 08:55
  • try to add this line in your httpd.conf file `LoadModule php7_module "C://path_to_php_folder/php7apache2_4.dll"` – potiev Jul 25 '19 at 08:58
  • Yeah I fixed it. Thanks for the help. May I edit your question with the relevant code and accept it? – Roman Jul 25 '19 at 09:00
  • Ok. I glad help you – potiev Jul 25 '19 at 09:01