Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jmort

macrumors member
Original poster
Jun 10, 2005
52
0
Southern CA
I'm a designer, and just starting to work with PHP. I want to be able to preview my work without uploading it to my site first, as this is very time consuming after a while. I know I have to setup some sort of server on my mac, but I have no idea how, where, what kind, etc. I'm not a programmer at all.

Anybody know a real simple tutorial or got any advice on how to do this?

Thanks
jmort
 

Poeben

macrumors 6502
Jul 29, 2004
346
0
It's not too difficult to do. First thing you need to know is turn on Personal Web Sharing in System Prefs -> Sharing.

Where to put the files? Library/Webserver/Documents

How to enable PHP? This is the tricky one.. Open terminal and type the following commands (ignore stuff in parenthesis):


cd /etc/httpd
sudo cp httpd.conf httpd.conf.bak (creates a backup of httpd.conf if you hose the original)
sudo vi httpd.conf (opens the vi text editor and opens the file you need to edit)
---scroll down until you see this section:

Code:
# Note: The order in which modules are loaded is important.  Don't change
# the order below without expert advice.
#
# Example:
# LoadModule foo_module libexec/mod_foo.so
#LoadModule vhost_alias_module libexec/httpd/mod_vhost_alias.so
#LoadModule env_module         libexec/httpd/mod_env.so
LoadModule config_log_module  libexec/httpd/mod_log_config.so
etc.....

type i (this will switch to insert mode)

---remove the # in front of this line:

Code:
LoadModule php4_module        libexec/httpd/libphp4.so


---Do the same for this line in the next section:

Code:
AddModule mod_php4.c


type ESC
type :wq! (hit enter this will force a Write then quit)


---Restart apache:

sudo apachectl graceful


---That should do it. It might look a bit daunting, but it will do what you asked. There may be a simpler way, but I don't know of one. Good luck.
 

whocares

macrumors 65816
Oct 9, 2002
1,494
0
:noitаɔo˩
yan can also use Pico, it's a much more frienldier (but less powerful) text editot in Terminal:

Code:
sudo cp /etc/httpd/httpd.conf /etc/httpd.httpd.conf.bak
sudo pico /etc/httpd/httpd.conf
And use arrows to scroll to where needed. Ctrl+O to write file and Ctrl+X to exit

Note: you need to have root user activated to do this (Applications->Netinfo Manager->Security->Activate root). Always be careful when user root, this is how you can really screw things up ;)
 

jmort

macrumors member
Original poster
Jun 10, 2005
52
0
Southern CA
Thanks for the advice guys.

I tried Poeben's advice first and it worked. This is much nicer than uploading every time I want to preview my work.

Thanks again
jmort
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.