dancingbush
dancingbush

Reputation: 2281

How to run PHP files on XAMMP on A Mac

I have saved a PHP file to my Applications/XAMMP/htdocs directory and I want to run it in a browser.

I have used all sorts of url combinations including: http://localhost/xammp/htdocs/HelloWord.php http://localhost/xammp/HelloWord.php

amongst others and I cannot find the right url.

I am using XAMPP on a Mac Majove.

Upvotes: 1

Views: 13882

Answers (4)

Zero Huang
Zero Huang

Reputation: 71

XAMPP's default root should be "htdocs" or "www". Put your PHP files into those folder and try again.

if it is not work, find the configuration of Apache and PHP in XAMPP folder.

Upvotes: 1

Slow Enter
Slow Enter

Reputation: 21

First of all, expecting the php file to have information that can be visualized in a web browser, inside xampp if you have the .php file in the htdocs folder you should be able to visualize it like this:

http://localhost/HelloWord.php

Upvotes: 2

CodeManX
CodeManX

Reputation: 11865

If you installed the XAMPP VM version, then you can probably access it via http://192.168.64.2/HelloWord.php (check the General tab in the XAMPP app for the IP address)

If you installed the native version, then I guess it is http://localhost/HelloWord.php

The htdocs/ folder is the document root. Its content is served under the server address. Neither the xampp nor the htdocs folder will be part of the URL. The paths are relative to the document root, and you shouldn't be able to access parent directories above htdocs/ (although server-side code such as PHP has access to the file system and may work with files outside of the document root).

Upvotes: 2

dancingbush
dancingbush

Reputation: 2281

Found it by trial and error, quite different from what I took from various instructions on line:

http://localhost/HelloWord.php

Upvotes: 1

Related Questions