0

When I run localhost/filename.php in the chrome web browser it does not display the output of the code using that filename but the underlying code. I have tried to eliminate as many of the possible factors, so I know that the same file works on a different mac when localhost/filename.php is used. I have also tried to use it on the safari web browser - same problem.

I am running out of ideas of how to fix or narrow down the problem so I am just asking on the of chance someone has been in the same situation and knows how to fix it?

3
  • Underlying code = PHP or HTML? Commented Oct 26, 2012 at 16:24
  • 4
    If you are loading from localhost we need to know what operating system you are on. If Windows you might not have PHP installed or enabled, if OSX you need to enable PHP in the native apache install. enable PHP in OSX Commented Oct 26, 2012 at 16:24
  • What OS? what Webserver? Commented Oct 26, 2012 at 16:25

2 Answers 2

1

I am assuming you have a mac and you are running on the latest version (Mac OS X Mountain Lion), assuming such, you will most likely have to install/enable php this is slightly more difficult than in previous versions of Mac OS X as apple has made some changes, but the link below shows it in pretty good detail, it allows you also to set up phpmyadmin and mysql in a local environment, it's what I used to set it up.

http://coolestguyplanettech.com/downtown/install-and-configure-apache-mysql-php-and-phpmyadmin-osx-108-mountain-lion

You can also do something easier and use sever software such as MAMP or XAMPP which are just a simple installer, however they don't offer as much freedom as installing it manually has (also not sure if they have mountain lion support yet)...

MAMP: http://www.mamp.info/de/mamp/index.html

XAMPP: http://www.apachefriends.org/en/xampp-macosx.html

Sign up to request clarification or add additional context in comments.

2 Comments

no i have apache already set up yet, still no luck with seeing the output :(
apache yes, but you also need to enable PHP it doesn't just come with apache. If php is installed go to your terminal and type php -vthis should return the version of php installed if it is installed
0

Your host is not executing the php so it is not an issue with the code but with PHP. Be sure your localhost is set to execute PHP otherwise it will show it as text.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.