Laravel showing code of index.php on home page
I'm using Apache 2.4 on Ubuntu 16.04, it shows the content of the index.php in browser.

here's the code of my site's conf file:
<VirtualHost *:80>
DocumentRoot /var/www/laravel/public
ServerName laravel.dev
<Directory /var/www/laravel/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Why the home page renders index.php as text file?
Note: I have set 777 permissions to laravel folder. PHP is also installed.
php apache laravel laravel-5 ubuntu-16.04
add a comment |
I'm using Apache 2.4 on Ubuntu 16.04, it shows the content of the index.php in browser.

here's the code of my site's conf file:
<VirtualHost *:80>
DocumentRoot /var/www/laravel/public
ServerName laravel.dev
<Directory /var/www/laravel/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Why the home page renders index.php as text file?
Note: I have set 777 permissions to laravel folder. PHP is also installed.
php apache laravel laravel-5 ubuntu-16.04
1
Possible duplicate of why are my php files showing as plain text?
– Ross Wilson
Mar 21 '17 at 8:25
But he said he tested other PHP sites and they are working.
– Amarnasan
Mar 21 '17 at 8:28
Yes, actually I renamed apache's default index.html to index.php and it works when I pointed to /var/www/html
– Faizan Ali
Mar 21 '17 at 8:56
Just checked PHP isn't working on any site either. What happened is when I renamed Apache's defaultindex.htmltoindex.phpit rendered the same html content and I thought it's working but when I added<?php phpinfo ?>at the top, it showed the code instead.
– Faizan Ali
Mar 21 '17 at 9:02
1
Possible duplicate of PHP code is not being executed, instead code shows on the page
– user3603486
Mar 21 '17 at 9:16
add a comment |
I'm using Apache 2.4 on Ubuntu 16.04, it shows the content of the index.php in browser.

here's the code of my site's conf file:
<VirtualHost *:80>
DocumentRoot /var/www/laravel/public
ServerName laravel.dev
<Directory /var/www/laravel/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Why the home page renders index.php as text file?
Note: I have set 777 permissions to laravel folder. PHP is also installed.
php apache laravel laravel-5 ubuntu-16.04
I'm using Apache 2.4 on Ubuntu 16.04, it shows the content of the index.php in browser.

here's the code of my site's conf file:
<VirtualHost *:80>
DocumentRoot /var/www/laravel/public
ServerName laravel.dev
<Directory /var/www/laravel/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Why the home page renders index.php as text file?
Note: I have set 777 permissions to laravel folder. PHP is also installed.
php apache laravel laravel-5 ubuntu-16.04
php apache laravel laravel-5 ubuntu-16.04
edited Mar 21 '17 at 9:03
Faizan Ali
asked Mar 21 '17 at 8:22
Faizan AliFaizan Ali
356416
356416
1
Possible duplicate of why are my php files showing as plain text?
– Ross Wilson
Mar 21 '17 at 8:25
But he said he tested other PHP sites and they are working.
– Amarnasan
Mar 21 '17 at 8:28
Yes, actually I renamed apache's default index.html to index.php and it works when I pointed to /var/www/html
– Faizan Ali
Mar 21 '17 at 8:56
Just checked PHP isn't working on any site either. What happened is when I renamed Apache's defaultindex.htmltoindex.phpit rendered the same html content and I thought it's working but when I added<?php phpinfo ?>at the top, it showed the code instead.
– Faizan Ali
Mar 21 '17 at 9:02
1
Possible duplicate of PHP code is not being executed, instead code shows on the page
– user3603486
Mar 21 '17 at 9:16
add a comment |
1
Possible duplicate of why are my php files showing as plain text?
– Ross Wilson
Mar 21 '17 at 8:25
But he said he tested other PHP sites and they are working.
– Amarnasan
Mar 21 '17 at 8:28
Yes, actually I renamed apache's default index.html to index.php and it works when I pointed to /var/www/html
– Faizan Ali
Mar 21 '17 at 8:56
Just checked PHP isn't working on any site either. What happened is when I renamed Apache's defaultindex.htmltoindex.phpit rendered the same html content and I thought it's working but when I added<?php phpinfo ?>at the top, it showed the code instead.
– Faizan Ali
Mar 21 '17 at 9:02
1
Possible duplicate of PHP code is not being executed, instead code shows on the page
– user3603486
Mar 21 '17 at 9:16
1
1
Possible duplicate of why are my php files showing as plain text?
– Ross Wilson
Mar 21 '17 at 8:25
Possible duplicate of why are my php files showing as plain text?
– Ross Wilson
Mar 21 '17 at 8:25
But he said he tested other PHP sites and they are working.
– Amarnasan
Mar 21 '17 at 8:28
But he said he tested other PHP sites and they are working.
– Amarnasan
Mar 21 '17 at 8:28
Yes, actually I renamed apache's default index.html to index.php and it works when I pointed to /var/www/html
– Faizan Ali
Mar 21 '17 at 8:56
Yes, actually I renamed apache's default index.html to index.php and it works when I pointed to /var/www/html
– Faizan Ali
Mar 21 '17 at 8:56
Just checked PHP isn't working on any site either. What happened is when I renamed Apache's default
index.html to index.php it rendered the same html content and I thought it's working but when I added <?php phpinfo ?> at the top, it showed the code instead.– Faizan Ali
Mar 21 '17 at 9:02
Just checked PHP isn't working on any site either. What happened is when I renamed Apache's default
index.html to index.php it rendered the same html content and I thought it's working but when I added <?php phpinfo ?> at the top, it showed the code instead.– Faizan Ali
Mar 21 '17 at 9:02
1
1
Possible duplicate of PHP code is not being executed, instead code shows on the page
– user3603486
Mar 21 '17 at 9:16
Possible duplicate of PHP code is not being executed, instead code shows on the page
– user3603486
Mar 21 '17 at 9:16
add a comment |
2 Answers
2
active
oldest
votes
I got the solution over here..
Actually, I had to install libapache2-mod-php and activate it i.e. a2enmod php7.0
add a comment |
add below command :
sudo apt-get install libapache2-mod-php7.2
(this will pull the default PHP version)
Reload Apache configuration changes by restarting service using below command
sudo service apache2 restart
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f42921669%2flaravel-showing-code-of-index-php-on-home-page%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I got the solution over here..
Actually, I had to install libapache2-mod-php and activate it i.e. a2enmod php7.0
add a comment |
I got the solution over here..
Actually, I had to install libapache2-mod-php and activate it i.e. a2enmod php7.0
add a comment |
I got the solution over here..
Actually, I had to install libapache2-mod-php and activate it i.e. a2enmod php7.0
I got the solution over here..
Actually, I had to install libapache2-mod-php and activate it i.e. a2enmod php7.0
edited Apr 13 '17 at 12:22
Community♦
11
11
answered Mar 21 '17 at 9:15
Faizan AliFaizan Ali
356416
356416
add a comment |
add a comment |
add below command :
sudo apt-get install libapache2-mod-php7.2
(this will pull the default PHP version)
Reload Apache configuration changes by restarting service using below command
sudo service apache2 restart
add a comment |
add below command :
sudo apt-get install libapache2-mod-php7.2
(this will pull the default PHP version)
Reload Apache configuration changes by restarting service using below command
sudo service apache2 restart
add a comment |
add below command :
sudo apt-get install libapache2-mod-php7.2
(this will pull the default PHP version)
Reload Apache configuration changes by restarting service using below command
sudo service apache2 restart
add below command :
sudo apt-get install libapache2-mod-php7.2
(this will pull the default PHP version)
Reload Apache configuration changes by restarting service using below command
sudo service apache2 restart
answered Nov 19 '18 at 20:37
Saurabh MistrySaurabh Mistry
3,5421826
3,5421826
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f42921669%2flaravel-showing-code-of-index-php-on-home-page%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Possible duplicate of why are my php files showing as plain text?
– Ross Wilson
Mar 21 '17 at 8:25
But he said he tested other PHP sites and they are working.
– Amarnasan
Mar 21 '17 at 8:28
Yes, actually I renamed apache's default index.html to index.php and it works when I pointed to /var/www/html
– Faizan Ali
Mar 21 '17 at 8:56
Just checked PHP isn't working on any site either. What happened is when I renamed Apache's default
index.htmltoindex.phpit rendered the same html content and I thought it's working but when I added<?php phpinfo ?>at the top, it showed the code instead.– Faizan Ali
Mar 21 '17 at 9:02
1
Possible duplicate of PHP code is not being executed, instead code shows on the page
– user3603486
Mar 21 '17 at 9:16