简体   繁体   中英

My index.php is downloading as a file instead of executing when i run it

I don't know Why my PHP file is downloading instead of executing when I run it? I am trying to execute a PHP project on my local host using wamp, but whenever I try to run it on my browser, the file is downloading into my "downloads" instead of executing or running it.

Please, does anyone know anything that can help? This is my.env and .htaccess file below, accordingly.

APP_NAME=""
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost/

LOG_CHANNEL=stack
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=
DB_USERNAME=root
DB_PASSWORD=

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Send Requests To Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>


<IfModule mime_module>
  AddHandler application/x-httpd-ea-php74 .php .php7 .phtml
</IfModule>

you should probably have a look at the answer in the following question: Laravel Shared Hosting .htaccess

The Public Folder of Laravel should be the one which adressed by the server and not index.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM