0

I don't want the file in my root directly to be hidden that include .env file of laravel maybe with .htaccess or any other way i have am trying to host it bt i don't want some to go to mysite.com/.env

APP_ENV=local
APP_KEY=base64:w8nPcK6CVaazC/WEv42hf+QOs4zWg2izt1pubH0KnQE=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306

I have this error from my server.

PHP Parse error:  syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/skycashs/public_html/public/index.php on line 50
dagogodboss
  • 483
  • 1
  • 4
  • 19
  • 3
    your server should be configured to serve from the 'public' folder so everything above that is not accessible and you can also set actual environmental variables on production if you wanted – lagbox Mar 06 '17 at 15:50
  • btw that error means you need to update your php version – lagbox Mar 06 '17 at 15:56

1 Answers1

2

You need to point web server (Apache or nginx) to the public directory which is inside Laravel project root

You're using wrong web server configuration. Point your web server to a public directory and restart it.

An example for Apache web server:

DocumentRoot "/project_root/public"
<Directory "/project_root/public">

And for nginx:

root /project_root/public;

Don't forget to restart web server to make changes work.

Community
  • 1
  • 1
Alexey Mezenin
  • 158,981
  • 26
  • 290
  • 279