Categories

See More
Popular Forum

MBA (4887) B.Tech (1769) Engineering (1486) Class 12 (1030) Study Abroad (1004) Computer Science and Engineering (988) Business Management Studies (865) BBA (846) Diploma (746) CAT (651) B.Com (648) B.Sc (643) JEE Mains (618) Mechanical Engineering (574) Exam (525) India (462) Career (452) All Time Q&A (439) Mass Communication (427) BCA (417) Science (384) Computers & IT (Non-Engg) (383) Medicine & Health Sciences (381) Hotel Management (373) Civil Engineering (353) MCA (349) Tuteehub Top Questions (348) Distance (340) Colleges in India (334)
See More

PHP file won't open in browser, only download

General Tech Bugs & Fixes

Max. 2000 characters
Replies

usr_profile.png

User

( 5 months ago )

I can't get .php files to run on my server. For example, I created a test file entitled "test.php" with the following content (only):

<?php
phpinfo() ;
?> 

When I try to open this or other php files through a web browser, it tries to download them rather than run them. Responses to similar questions suggest that this issue means the server isn't set up to run php. I looked up how to enable php on the server and found that I am supposed to uncomment the line

LoadModule php5_module libexec/apache2/libphp5.so

in the httpd.conf in the etc/apache2 directory. However, when I checked that file, the above line was already uncommented. Is there some other thing I need to change to make php work correctly?

usr_profile.png

User

( 5 months ago )

You also need to add the handler for the PHP extension, so that the scripts are actually handled by the PHP module.

AddHandler php5-script .php

what's your interest


forum_ban8_5d8c5fd7cf6f7.gif