Cant view php files in browser once XAMPP is installed

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

Cant view php files in browser once XAMPP is installed

Postby jimparker » 26. January 2009 16:42

Hi,
I seem to have installed everything for XAMPP successfully, I'm at the stage where you can open up the index.html in the htdocs/apache folder. It opens with the words... "It works!" in the page.

Now I'm tyring to create some simple php stuff and then view it in the browser. I keep trying to save the document as a .php file in the same place as where the index.html file is inside the htdocs folder. When I double click on this it just opens the code in dreamweaver!!?? I cant view it in a browser.

Obviously the whole purpose of XAMPP is to enable this function for working in and its pretty frustrating getting to this stage and not be able to use it!
Any help would be thoroughly appreciated especially I cant find any contact numbers to ring for advice!!! cheers guys

Jim
jimparker
 
Posts: 2
Joined: 26. January 2009 16:24

Re: Cant view php files in browser once XAMPP is installed

Postby Wiedmann » 26. January 2009 16:49

I cant view it in a browser.

If you don't want edit your file, open your browser and type the url for that file (http://localhost/file.php). It's exactly the same, if you want open a php file on every other webserver. (e.g. this forum)
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Cant view php files in browser once XAMPP is installed

Postby jmdirc » 26. January 2009 17:03

HTML and php are different, you can't open a php page like you do an html page. In order to open a php file to view in the browser it must be parsed by the php interpreter. The only way to do that is to open the file's url in the browser as Wiedmann said.

best of luck
An artist/designer/ and now programer exploring the creative sides.
User avatar
jmdirc
 
Posts: 154
Joined: 10. February 2008 22:44

Re: Cant view php files in browser once XAMPP is installed

Postby jimparker » 27. January 2009 21:43

Hi guys, thanks for the reply... for some reason when I type in

http://localhost/filename.php it still doesn't work?

any therioes? it works fine on my friends P.C. but not my Mac. Could there be something in the XAMMP Control Panel settings i could change??
jimparker
 
Posts: 2
Joined: 26. January 2009 16:24

Re: Cant view php files in browser once XAMPP is installed

Postby glitzi85 » 27. January 2009 21:57

Where did you save the file called filename.php?

glitzi
User avatar
glitzi85
 
Posts: 1920
Joined: 05. March 2004 23:26
Location: Dahoim

Re: Cant view php files in browser once XAMPP is installed

Postby jmdirc » 27. January 2009 23:55

Xampp is running?
No error messages starting Xampp?
File is in 'htdocs' folder, inside 'xampp' application folder?

you really need to give more info when you have a question or problem / Mac Tiger or Leopard?
An artist/designer/ and now programer exploring the creative sides.
User avatar
jmdirc
 
Posts: 154
Joined: 10. February 2008 22:44

Re: Cant view php files in browser once XAMPP is installed

Postby Ashu » 30. March 2010 14:20

I face the same situation as whenever i try to view my php.file in browser, it says to download it.So, i tried every browser like firefox, chrome, opera & explorer but same situation with every browser.It Directly opens in Dreamweaver after downloading the php.file.Also there was a problem with my CSS file it was only showing background stripe neglecting other format codings :?: .
So, i went through my CSS code and found un-closed id selector
eg. #h1 { font: ' Times New Roman', Arial; color: #FFFFFF;
// " }" --> Without this end parenthesis.

After Sorting this:
My Page loaded with complete CSS formating & my php.file error was also gone.

Hope it might help someone with same problem.... :D
Ashu
 
Posts: 1
Joined: 30. March 2010 14:02

Re: Cant view php files in browser once XAMPP is installed

Postby dickbronder » 11. May 2010 11:18

Try this,

In your htdocs folder you make another folder (ex: new site). In this folder you put all your php and other files, just make sure one of them is called index.php.
Then go to your browser and type http://localhost/new site or when using it on the mac in the sites folder http://localhost/~username/new site
Make sure that you use the exact name of the folder.

Dick
dickbronder
 
Posts: 2
Joined: 11. May 2010 11:09

Re: Cant view php files in browser once XAMPP is installed

Postby Fi3ndish » 26. August 2010 05:26

Hi, I am having this exact same problem and have tried the previous suggestion of the folder etc but its still not working.

http://localhost works, but i cant view any php files that are in my htdocs folder.
Fi3ndish
 
Posts: 1
Joined: 26. August 2010 05:23

Re: Cant view php files in browser once XAMPP is installed

Postby Altrea » 26. August 2010 05:46

Fi3ndish wrote:http://localhost works, but i cant view any php files that are in my htdocs folder.

Help us to help you.
Tell us a little bit more about your XAMPP installation and your php files you try to request
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Cant view php files in browser once XAMPP is installed

Postby MegaChriz » 27. August 2010 08:06

If http://localhost opens with the words "It works!", there is a chance of 99% you have an other webserver running, because XAMPP does not open with these words by default. It's very likely the built-in webserver of Mac OS X is running, because that webserver opens with "It works!" by default, when navigating to http://localhost

Check if webserver Mac OS X is running
1. Open System Preferences.
2. Go to 'Share'.
3. Check if 'Webserver' is active. If so, turn it off.
4. Turn on XAMPP.
MegaChriz
 
Posts: 158
Joined: 16. February 2009 15:04
Location: Amersfoort, The Netherlands
Operating System: Mac OS X


Return to XAMPP for macOS

Who is online

Users browsing this forum: No registered users and 43 guests