How to test php offline?

Status
Not open for further replies.
Joined
Dec 10, 2007
Messages
6
Reaction score
0
Points
1
I am new to web stuff, and am running 10.5.4. I am trying to find if it is possible to test php offline, because where I volunteer in the day has no wi-fi, but I try to work on some php im learning.
I have php installed, obviously, as well as apache. I have uncommented the lines in httpd.conf file, and I have enabled websharing in system prefs.
I created a simple test.php file that calls phpinfo(), and it works I know because I ran it from terminal. But when I put the file into /library/websharing/documents and point localhost to it, all it does is display the code, not the info. Isn't it supposed to interpret the php that way? If not, is there anyway to do that?
Thank you for help!
 
OP
X
Joined
Dec 10, 2007
Messages
6
Reaction score
0
Points
1
I already have php and apache installed, thats why im stuck I think.
For example, if I open a browser and type in http://localhost I get an apache start page saying that installation of apache was succesful...
 

Del


Joined
Dec 24, 2006
Messages
901
Reaction score
15
Points
18
Location
N. Ireland
Your Mac's Specs
Mac Pro 2xQuad core 2.8GHZ
copy your php file in to the htdocs folder of your apache server then point your browser at the file you wish to test

eg

http://localhost/testthis.php
 
OP
X
Joined
Dec 10, 2007
Messages
6
Reaction score
0
Points
1
what is a hotdocs folder?
I had been putting the files into Mac->Library->webserver->documents
 
Joined
Jun 18, 2006
Messages
191
Reaction score
5
Points
18
Location
Minneapolis
Your Mac's Specs
MacBook Pro
the htdocs folder is the "local web server" this is where you would put your folder containing all of the html, php, images folder, other folders. Generally you would view through a web browser on your machine with the address http://localhost/webfoldername/filename.php
Check out www.apachefriends.org they have an apache/mysql setup for mac called xampp.
 
Joined
Jun 7, 2008
Messages
30
Reaction score
0
Points
6
Location
Denmark, Europe
Your Mac's Specs
None... :(
I think that MAMP sounds way easier. :) (Something a Mac worth)
 
Joined
Nov 25, 2008
Messages
5
Reaction score
0
Points
1
the htdocs folder is the "local web server" this is where you would put your folder containing all of the html, php, images folder, other folders. Generally you would view through a web browser on your machine with the address http://localhost/webfoldername/filename.php
Check out apache friends - very easy apache, mysql, php and perl installation without hassles they have an apache/mysql setup for mac called xampp.

I'm having issues with this part. It simply will not connect to htdocs!:[
 
Joined
Jun 18, 2006
Messages
191
Reaction score
5
Points
18
Location
Minneapolis
Your Mac's Specs
MacBook Pro
Make sure that you have started the xampp program, it does not automatically run on startup.
 
Joined
Dec 31, 2005
Messages
24
Reaction score
0
Points
1
I second MAMP as well. Select the htdocs folder, right click, make alias, then drag that to your home folder (I named mine www). Then start up MAMP and you are good to go.
 
Joined
Jan 31, 2009
Messages
6
Reaction score
0
Points
1
type this into google
typo3

get that and yout laughing
it sets up php and mysql localy all by its self and it runs smoooooth

its great basically
 
Status
Not open for further replies.

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top