Experts Round Table Network
Navigate
Home
ArticleWiki
Forum
Journal
Search
Newsletter
Links
Tech News
expertsrt.com
Welcome Guest.
Username:
Password:
Remember me
Forgot your password?
Register
Apache 2.2 and PHP 5 not working
Welcome,
Guest
. Please
login
or
register
.
November 23, 2008, 07:24:03 AM
11307
Posts in
1250
Topics by
501
Members
Latest Member:
rosaline
Home
Help
Search
Login
Register
Experts Round Table Network
|
Serverside Technology
|
PHP
|
Apache 2.2 and PHP 5 not working
« previous
next »
Pages:
[
1
]
Print
Author
Topic: Apache 2.2 and PHP 5 not working (Read 1605 times)
Jack
Offline
Posts: 2
Apache 2.2 and PHP 5 not working
«
on:
January 09, 2008, 06:39:41 AM »
Hi all. I am new to this environment and I hope you can help me with my test server running as Localhost on my laptop.
I have installed Apache2.2 and php5 together with MySql 5 and PHPMyAdmin. On the face of it all seems to be working, I can view the Apache test page, phpinfo page and the PHPMyAdmin home page with Mysql database. However, when I try to view an file called test.htm with php code embeded in the html and all I get is the HTML in the localhost browser window not the php. The directory for Apache and php has been changed to D:\www, does this make a difference? Any suggestions please?
Regards
Jack
Logged
GrandSchtroumpf
Mentor
Offline
Posts: 409
Re: Apache 2.2 and PHP 5 not working
«
Reply #1 on:
January 09, 2008, 01:59:27 PM »
That's because your Apache server is not configured to process php on files that end in ".htm".
Rename your file from "test.htm" to "test.php" and it should work.
Another solution is to change your Apache configuration, but i don't recommend that. If you want to work with ".htm" uri's instead of ".php" uri's, then it's better to use mod-rewrite.
Cheers.
Logged
VGR
Mentor
Offline
Posts: 682
Re: Apache 2.2 and PHP 5 not working
«
Reply #2 on:
January 10, 2008, 02:47:02 PM »
IMHO you should definitely change this line in your httpd.conf file and then restart Apache :
AddType application/x-httpd-php .php
into :
AddType application/x-httpd-php .php .htm .html .phtml
you'll lose less than 3% CPU speed on pure static HTML but on the reverse side you'll be able NOT to rename all your pages once they get dynamic.
It's better than play silly games with mod_rewrite ;-)
Logged
techie overlord, answers all kind of questions on
http://www.europeanexperts.org
Jack
Offline
Posts: 2
Re: Apache 2.2 and PHP 5 not working
«
Reply #3 on:
January 11, 2008, 10:43:28 AM »
I have changed the httpd.conf file as you suggested and its ok now. thank's for your help.
Regards
Jack
Logged
GrandSchtroumpf
Mentor
Offline
Posts: 409
Re: Apache 2.2 and PHP 5 not working
«
Reply #4 on:
January 11, 2008, 12:26:57 PM »
> It's better than play silly games with mod_rewrite ;-)
Depends if you want your pages to work on mutualized hosting plans where you often cannot change apache's settings.
And who talked about renaming all the pages? AFAIK, for the time being, there is only one file named "test.htm".
I love mod-rewrite and pretty uri's. Decoupling uri and file-name is great for flexibility and ease of management.
Logged
CrYpTiC_MauleR
Site Builder
Offline
Posts: 489
Re: Apache 2.2 and PHP 5 not working
«
Reply #5 on:
January 12, 2008, 07:36:35 PM »
Also isn't that a security risk running .html and .htm as PHP files. Many times those types of files are assumed trusted serverside and not expected to contain executable PHP code. I suggest still using .php extensions and just make a simple 1 line mod_rewrite rule that will make xyz.html redirect transparently in background to xyz.php so user sees xyz.html in browser but server runs the file xyz.php that way you know only .php files will contain executable code and you limit the risk of some code your's or a 3rd party's from accidentally running malicious code in what would have been a benign .html file.
Logged
[
x
]
Fight
|
www.crypticmauler.com
"You must be
Pages:
[
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
ERT 1.5
-----------------------------
=> Round Table Learning Center
=> Bug reports
-----------------------------
Legacy
-----------------------------
=> The next level
=> History of ERT
-----------------------------
Community Affairs
-----------------------------
=> Introductions
=> Ballot Box
===> Closed Polls
=> Soapbox
=> Propose and Consult
===> Propose and Consult...CLOSED
-----------------------------
Bits and Bytes
-----------------------------
=> Tips, Tricks, Snippets, Tidbits And General Pearls Of Wisdom
-----------------------------
Serverside Technology
-----------------------------
=> PHP
=> ASP
-----------------------------
Webservers
-----------------------------
=> Apache
=> IIS
-----------------------------
Databases
-----------------------------
=> MySQL
=> Access
=> MS SQL Server
-----------------------------
Clientside Technology
-----------------------------
=> HTML
=> CSS
=> Javascript
=> Flash
=> WAP/WML
-----------------------------
Web Technologies
-----------------------------
=> General Web Dev
=> Web Standards
=> XML
=> Online Marketing
-----------------------------
Graphics
-----------------------------
=> Graphics Design and Animation
-----------------------------
Programming
-----------------------------
=> .NET
=> JAVA
=> MS DOS Batch Scripting
=> Mathematics
=> C & C++
=> VB
=> Delphi
=> Algorithm design
-----------------------------
Operating Systems
-----------------------------
=> Windows (General)
=> NT Based (2K, 2K-03, NT, XP, Vista)
=> Open Source (All)
-----------------------------
Hardware
-----------------------------
=> Hardware General
=> Gamers Hardware (Advanced)
-----------------------------
Networking
-----------------------------
=> Home (small)
=> Office (large)
=> Internet
-----------------------------
Security
-----------------------------
=> General Security Issues
-----------------------------
Rants/Opinions/Proposals
-----------------------------
=> Site operation
Powered by SMF 1.1 RC2
|
SMF © 2001-2005, Lewis Media
Joomla Bridge by
JoomlaHacks.com