Avatar of Ess Kay
Ess KayFlag for United States of America

asked on 

Apache, not running php on top level

Hi guys/gals,

We were playing with our deb linux server with some upgrades and looks like something was misadjusted


What he have now is PHP not rendering the top level domain showing source code instead.  

www.example.com  - >> shows the php source code as plain text


www.example.com/test  - >> php works fine


We just updated php 5.5 to php 5. 6
Everything was working fine before.

I know its something easy we missed,  any ideas?  thanks
PHPApache Web ServerLinux

Avatar of undefined
Last Comment
Ess Kay
Avatar of Randy Downs
Randy Downs
Flag of United States of America image

Maybe there is another page being executed rather than index.php.

This in .htaccess?

DirectoryIndex index.php
ASKER CERTIFIED SOLUTION
Avatar of gplana
gplana
Flag of Spain image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Ess Kay
Ess Kay
Flag of United States of America image

ASKER

read full question please

php WORKS just not top level
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Can we see your httpd.conf
Avatar of Ess Kay
Ess Kay
Flag of United States of America image

ASKER

heres an example

Doesn't work :
example1.com


works:
example1.com/index.php
example1.com/bla/
example1. com/bla/index.php
Avatar of Randy Downs
Randy Downs
Flag of United States of America image

example1.com will open default page. How about example1.com/index.php?
Avatar of Ess Kay
Ess Kay
Flag of United States of America image

ASKER

example1.com opens index.php  but doesn't run php,  just shows  raw code


example1.com/index.php  executes the php,  shows desired output
Avatar of Randy Downs
Randy Downs
Flag of United States of America image

Is there another index.html file or something similar (e.g., index,htm) that is opening or is it really index.php that is showing the code?
Avatar of gplana
gplana
Flag of Spain image

I think the problem can be on .htaccess file on the root. Maybe if you attach this file we can help you.
Avatar of Ess Kay
Ess Kay
Flag of United States of America image

ASKER

i doubt that is the issue,  as we host about 80 domains on the server and issue is for each domain after the update
Avatar of Ess Kay
Ess Kay
Flag of United States of America image

ASKER

heres on htaccess

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

    RewriteEngine On

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

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

Open in new window

Avatar of Randy Downs
Randy Downs
Flag of United States of America image

Try adding this to .htacess

DirectoryIndex index.php
Avatar of Ess Kay
Ess Kay
Flag of United States of America image

ASKER

index.php is default already,  just doesn't render the php,  shows code instead
Avatar of Ess Kay
Ess Kay
Flag of United States of America image

ASKER

Thanks fellas.  Looks like issue was local.  

But what fixed the issue originally was this comment so hes getting some points.



Was seeing the cached version of page.

Simple refresh fixed issue locally,  Otherwise it was working the entire time


Thanks again
PHP
PHP

PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.

125K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo