0

I'm new to Linux and PHP and I'm trying to access a Laravel app from another device. Server is running a Centos and it's IP is 192.168.1.250 and my Laravel directory is /var/www/html/vls. At first it was showing directory listing when I wen to 192.168.1.250/vls in my browser. After some search I added these lines to httpd.con:

<Directory /var/www/html/vls>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>


<VirtualHost *:80>
    DocumentRoot "/var/www/html/vls/public"
    ServerName vls.dev
    <Directory /var/www/html/vls/>
        AllowOverride All
        Order deny,allow
        Allow from all
        Require all granted
    </Directory>
</VirtualHost>

Now when I go to 192.168.1.250/vls it shows index.php content as text in browser.

I even followed the solution described here: How to stop laravel directory browsing

But then it showed directory listing of /public directory.

Any help is appreciated in advance.

EDIT: If I make a directory and place an index.php code that includes some PHP code it works fine. But Laravel app doesn't work and shows index.php code on the browser.

Beginner
  • 1,010
  • 4
  • 20
  • 42
  • Possible duplicate of [PHP code is not being executed, instead code shows on the page](https://stackoverflow.com/questions/5121495/php-code-is-not-being-executed-instead-code-shows-on-the-page) – Alex Tartan Jul 01 '17 at 13:52
  • make sure you have `libapache2-mod-php` (or some similar name) installed – Alex Tartan Jul 01 '17 at 13:53

1 Answers1

0

Change your dir from <Directory /var/www/html/vls/> to <Directory /var/www/html/vls/public>

online Thomas
  • 8,864
  • 6
  • 44
  • 85