PHP test fails

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

PHP test fails

Postby wideEyedPupil » 23. March 2011 07:09

Having come from the Leopard install of LAMP (Leopard, Apache, SQLite and PHP) then MAMP, I've now installed XAMMP on advice it is more current and better supported.

Unfortunately I'm having the same problem I did with Leopard default install, PHP test is not returning the PHP test page. (It did return results in my MAMP build)

I don't know where to start looking as I'm new to the Shell Terminal app and it's commands etc. Is this maybe a permissions issue? When I set up on Leopard default install I had to set some permission with chmod command.

I hope I get this going soon, I been trying for days.
wideEyedPupil
 
Posts: 7
Joined: 23. March 2011 05:20

Re: PHP test fails

Postby MegaChriz » 23. March 2011 09:16

Can it be that the built-in webserver that comes with Mac OS X is turned on? It has to be turned off in order to run XAMPP.

1. Open System preferences.
2. Go to "Share".
3. Turn off "Webserver" if it is turned on.
4. Start XAMPP.

If this is not the problem, it can be a permission issue. The webserver should have at least read access to your file. I had written a simpler solution to change permissions of a file here:
viewtopic.php?f=29&t=41776#p164981

If this is also not the problem, check where you placed the file. With the default setup in XAMPP, files should go in:
/Applications/XAMPP/xamppfiles/htdocs
The files can then be accessed when you go to http://localhost/ or http://127.0.0.1/ in your browser.
MegaChriz
 
Posts: 158
Joined: 16. February 2009 15:04
Location: Amersfoort, The Netherlands
Operating System: Mac OS X

Re: PHP test fails

Postby wideEyedPupil » 28. March 2011 10:44

Thanks for reply Chris, I thought I would get a notification (but didn't) so I missed this.

Web Sharing is definitely Off. Before XMAPP I was trying to use the pre-installed Apache and SQLite that comes with Leopard (had same problem). I also have same problem with my MAMP install (which is also Off when I run XAMPP).

So permissions for XAMPP directory was r w for system and r for admin. I changed to r w for admin. When I opened the index.html file located at Applications/XAMPP/htdocs/ in TextWranggler it told me I didn't have permission to write would I like permission. Interesting I thought I had just done that!

Anyhow still not getting PHP in my HTML files working, even though the XAMPP for OS X page that links to phpinfo() works. Note I have exactly the same problem in MAMP. :/ Thanks for comments.
wideEyedPupil
 
Posts: 7
Joined: 23. March 2011 05:20

Re: PHP test fails

Postby MegaChriz » 29. March 2011 08:14

.html is not parsed as PHP by default in XAMPP. If you want to use PHP between HTML, the file extension should be .php.

On a Mac, if you want write access to a file, you need to have write access to both the file and the folder the file is in.
MegaChriz
 
Posts: 158
Joined: 16. February 2009 15:04
Location: Amersfoort, The Netherlands
Operating System: Mac OS X

Re: PHP test fails

Postby wideEyedPupil » 04. April 2011 07:41

Thanks Chris. Correct solution! +5 points

I eventually figured this out for myself while away from the Mac. Perhaps I got a nudge through the ether after your post ;-). Only just got around to confirming in my OS X install of Apache/PHP I'm sure I was making same error in both contexts.

Is there a way to set up email notification on my Apache Friends Support Forum account? I could have done with this info when you posted it?
wideEyedPupil
 
Posts: 7
Joined: 23. March 2011 05:20

Re: PHP test fails

Postby MegaChriz » 04. April 2011 13:13

In the footer there is a little button that says "Subscribe topic".

An alternative way to subscribe:
When you write a comment, underneath the comment form there are a number of options, where one of them is "Notify me when a reply is posted".

In think that will notify you via e-mail.
MegaChriz
 
Posts: 158
Joined: 16. February 2009 15:04
Location: Amersfoort, The Netherlands
Operating System: Mac OS X

Re: PHP test fails

Postby wideEyedPupil » 05. April 2011 02:43

Thanks Chris.

One more thing… in my mucking around I lost the default XAMPP/htdocs/index.php file when I replaced it with my on code.

Can you provide a link to the page source code or should I just reinstall, that page might be handy I seem to remember that it links to the SQL admin tools etc.
Last edited by wideEyedPupil on 05. April 2011 03:04, edited 1 time in total.
wideEyedPupil
 
Posts: 7
Joined: 23. March 2011 05:20

Re: PHP test fails

Postby Sharley » 05. April 2011 02:52

In Windblows that index.php in the htdocs directory is just a redirect to \XAMPP\htdocs\xampp\index.php so if you have replaced the index.php in the htdocs directory with your own then all you need do is call the index.php in the htdocs\xampp directory direct and again in Windblows that is http://localhost/xampp/index.php - give it a try and if OS X is similar then it will save you a hassle.

Also you may be able to open and extract only the index.php file from the .dmg source binary using
Stuffit or 7zip without the need to reinstall XAMPP but I can't confirm that as I don't have OS X but you may like to give it a go and confirm it is possible.

Good luck and best wishes.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: PHP test fails

Postby wideEyedPupil » 05. April 2011 03:40

Thanks Sharley

I read your forum netiquette tips, it seems I went off-topic (my thread so maybe that's okay?)!

The link you provided worked. When I searched in that directory there was no index.php file, infact no .php/.html file at all there so it's getting redirected somehow. How and where?

I searched entire XAMPP directory and found a few index.php files but they all resulted in error messages in my browser but I'm pretty sure they were not the same file as the one that generates the 'splash screen' page, ie.:
Image
Image
Image
wideEyedPupil
 
Posts: 7
Joined: 23. March 2011 05:20

Re: PHP test fails

Postby Sharley » 05. April 2011 03:52

Your welcome and really you are not off topic when you add to an already running topic that you had started, but I suppose in strict terms it is another topic and so would need a new topic opened but not required in all cases like yours, but again if another person had added to your topic with a similar issue to losing the index.php file then not only would it be off topic but would also be a hijacking. :)


Did you look in the htdocs\xampp directory as that is where the index.php file should be located along with the rest of the files needed for the orange XAMPP Welcome Demo page?

Your thumb image says XAMPP for LINUX is that perhaps a problem as it should look like the image on this page:
http://www.apachefriends.org/en/xampp-macosx.html#5469

...and in that image on the above page the URI in the browser is the link I gave above so it looks very similar to how Windblows is setup.

How did you go opening the .dmg file and extracting the index.php file as you can then read the source code and it will finally tell you what it actually does.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: PHP test fails

Postby wideEyedPupil » 05. April 2011 06:52

Sharley wrote:Your welcome and really you are not off topic when you add to an already running topic that you had started, but I suppose in strict terms it is another topic and so would need a new topic opened but not required in all cases like yours, but again if another person had added to your topic with a similar issue to losing the index.php file then not only would it be off topic but would also be a hijacking. :)

okay then…
Sharley wrote:Did you look in the htdocs\xampp directory as that is where the index.php file should be located along with the rest of the files needed for the orange XAMPP Welcome Demo page?

Yes that's the file I changed to my own code so it's no good.
Sharley wrote:Your thumb image says XAMPP for LINUX is that perhaps a problem as it should look like the image on this page:
http://www.apachefriends.org/en/xampp-macosx.html#5469

I just copied the image links from the apache friends website, that's why one piece is missing the link is: "data:image/png;base64,iVBORw0K…II="
Sharley wrote:How did you go opening the .dmg file and extracting the index.php file as you can then read the source code and it will finally tell you what it actually does.

Yes that was easiest way in the end, thanks.
wideEyedPupil
 
Posts: 7
Joined: 23. March 2011 05:20


Return to XAMPP for macOS

Who is online

Users browsing this forum: No registered users and 19 guests