PDA

View Full Version : Help with previewing my PHP sites




jmort
Oct 1, 2005, 05:53 PM
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



edwardk9
Oct 1, 2005, 06:28 PM
here (http://maczealots.com/tutorials/textpattern/#php)

The actual tutorial is about textpattern but this will give you an idea on how to enable php and apache.

Poeben
Oct 1, 2005, 06:41 PM
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:

# 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:

LoadModule php4_module libexec/httpd/libphp4.so


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

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
Oct 2, 2005, 02:49 AM
yan can also use Pico, it's a much more frienldier (but less powerful) text editot in Terminal:

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 ;)

Mitthrawnuruodo
Oct 2, 2005, 07:12 AM
Taco HTML Edit (http://tacosw.com/htmledit/) has PHP preview as a feature.

jmort
Oct 2, 2005, 05:32 PM
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