/    Sign up×
Community /Pin to ProfileBookmark

Using PHP on home page (index.php)

I’ve built a website and some of the pages are php pages (e.g. SomePage.php). It all works fine; both the html pages and the php pages come up and work just fine.

I then made a change to the main index.html file and made it so that it’s an index.php file instead, and it has some php code embedded in it, not much different than any of the other php pages on my site.

But when I try to go to that index.php file, as the first file to bring up for the site, it fails to bring up the page but instead pops up an Open File dialog, asking if I want to Open or Save the index.php file. It’s as if the server is not recognizing index.php as being a php file that needs the normal php pre-processing on the server side. I used to get similar prpoblems with the other php pages before I had my server properly set up with Apache and php and such. But all of that is indeed properly set up. The OTHER php pages come up OK. It’s just the very first, index.php page, that doesn’t come up correctly.

What am I doing wrong?

Is there a standard way for making it bring up the first page as a php file?

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@scragarJun 12.2007 — why not just keep it as aHTML file and give itPHP permitions using htaccess untill you can find the problem?
RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html
Copy linkTweet thisAlerts:
@RogerInHawaiiauthorJun 12.2007 — scragar,

Thanks. It's working now.

I modified the

AddType application/x-httpd-php .php

line in the httpd.conf file so that it is now...

AddType application/x-httpd-php .php .htm .html

I also changed the...

DirectoryIndex index.html index.html.var

line so that it is now...

DirectoryIndex index.php index.html index.html.var

and now it's bringing up the index.php page properly.
×

Success!

Help @RogerInHawaii spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...