Why register for free on WebRadiance? |
Why register for free on WebRadiance? |
![]() |
Welcome to WebRadiance forums! WebRadiance is a place for discussion and help on a large range of web design and development related topics such as HTML, CSS, ASP & .NET, PHP and SEO. It is provided for free, without ads and is a friendly place for beginners and professionals alike. By joining us today you can take part in our rapidly growing community. Registering enables you to:
|
![]() ![]() |
Nov 3 2006, 08:11 PM
Post
#1
|
|
![]() W.R. General Group: Administrators Posts: 2,799 Joined: 4-April 06 From: Massachusetts - USA Member No.: 5 |
As a web developer, I am constantly creating and/or editing php-based web sites on my Mac. I have my own web space to upload these files to and test my work, but the extra step of FTP'ing a file to my web server each time I wanted to see my edits was a large annoyance for me. I wanted to streamline my process and increase productivity.
I knew it was time to take advantage of the built in web server in OS X, using Apache and the PHP module that comes preinstalled. Since I keep all web sites in the default “Sites†directory, I wanted to use it as the directory which Apache served files from. Here is what I did, and how you should do it… By default OS X ships with Apache and PHP, but PHP is disabled. In order to enable it you must do the following:
-------------------- |
|
|
|
Nov 3 2006, 09:23 PM
Post
#2
|
|
![]() Pedantic Whinger Group: Members Posts: 237 Joined: 1-August 06 From: Southampton, UK Member No.: 23 |
Nice little guide herkalees
-------------------- QUOTE(MSN) Benbramz says: i had orgasmic thoughts at the excitement of that |
|
|
|
Nov 4 2006, 10:28 AM
Post
#3
|
|
![]() W.R. General Group: Administrators Posts: 2,799 Joined: 4-April 06 From: Massachusetts - USA Member No.: 5 |
It's funny, I was going to use pico, but as a much-smarter-than-me friend was walking me through the keyboard commands, he mentioned that VI is much better. I'm certain it is simply a matter of preference
-------------------- |
|
|
|
Nov 26 2006, 08:33 PM
Post
#4
|
|
![]() The buddy system:never fails Group: Administrators Posts: 1,766 Joined: 4-April 06 Member No.: 1 |
Great clear article by Marc, im going to carry on with the flow of things and show how to install MySql.
I advise following the steps in the above post first. Firstly we need to grab the files. Make sure you get the latest version, its not essential but advised. Once you have the files downloaded, run them. now, here you need to make a descion.. do you want mysql to start each time you start the computer? (i reccomend this). If so, install the PKG file named MYSQLstartupitem.pkgb Have you run the package files? good. lets move on. If you have installed the Startup Item, use this command: (PRESS CONTROL-D OR ENTER "EXIT" TO EXIT THE SHELL) If you don't use the Startup Item, enter the following command sequence: CODE cd /usr/local/mysql CODE sudo ./bin/mysqld_safe (ENTER YOUR PASSWORD, IF NECESSARY) (PRESS CONTROL-Z) shell> bg (PRESS CONTROL-D OR ENTER "EXIT" TO EXIT THE SHELL) You should be able to connect to the MySQL server, for example, by running `/usr/local/mysql/bin/mysql'. You should be up and running ;-) this was just a brief article to cut the fat from the chunk of the readme file, not in anyway the most complex article. but hey, they're macs, they practically run themselves! -------------------- |
|
|
|
Nov 27 2006, 08:32 AM
Post
#5
|
|
|
Allegedly Legendary Group: Members Posts: 512 Joined: 31-July 06 From: Winder, GA Member No.: 11 |
So it ships with php4?
Pico is a lot easier to use than vi, but I've never spent much time with either. -------------------- |
|
|
|
Nov 27 2006, 08:47 AM
Post
#6
|
|
![]() W.R. General Group: Administrators Posts: 2,799 Joined: 4-April 06 From: Massachusetts - USA Member No.: 5 |
So it ships with php4? Yes, though it's disabled by default. -------------------- |
|
|
|
Oct 10 2007, 01:49 PM
Post
#7
|
|
![]() W.R. Private First-Class Group: Members Posts: 253 Joined: 30-August 07 From: Vienna, Austria Member No.: 586 |
I a having an odd problem: I type "sudo vi /etc/httpd/httpd.conf" into Terminal (step one from the original post) and it then asks for root password; though I can't type anything into the window?!
-------------------- ![]() |
|
|
|
Oct 10 2007, 02:23 PM
Post
#8
|
|
![]() W.R. General Group: Administrators Posts: 2,799 Joined: 4-April 06 From: Massachusetts - USA Member No.: 5 |
I a having an odd problem: I type "sudo vi /etc/httpd/httpd.conf" into Terminal (step one from the original post) and it then asks for root password; though I can't type anything into the window?! While you type the password, it WON'T appear as though you are typing (on purpose). Just type the password and hit enter... should work. -------------------- |
|
|
|
Oct 10 2007, 02:50 PM
Post
#9
|
|
![]() W.R. Private First-Class Group: Members Posts: 253 Joined: 30-August 07 From: Vienna, Austria Member No.: 586 |
Oops, didn't know that
I am almost there! Just when I press cmd+s this window appears... How do I give the "wq" command? This is the first time for me using Terminal PS: http://www.freewebs.com/elalcon/ImageHost/...ing%20httpd.png This post has been edited by temhawk: Oct 10 2007, 02:51 PM -------------------- ![]() |
|
|
|
Oct 11 2007, 04:52 AM
Post
#10
|
|
![]() Loose bits sink chips Group: Administrators Posts: 2,068 Joined: 4-April 06 From: Kent, UK Member No.: 2 |
I've split Billy's post into a new topic: Mac OS X, Apache and JBOS
Temhawk: To give any command in vi, press escape, then type : and then the command. So: escape -> : -> wq -> enter Will save and quit. And the link to an image you've posted is the ability to save a terminal shortcut, not to save the file you're editing in vi! -------------------- |
|
|
|
Oct 11 2007, 05:49 AM
Post
#11
|
|
![]() W.R. Private First-Class Group: Members Posts: 253 Joined: 30-August 07 From: Vienna, Austria Member No.: 586 |
Thank you!
But I think I might have done something wrong. Yesterday, I closed the Terminal window after I typed "sudo vi /etc/httpd/httpd.conf", entered my password and made the few changes. But I didn't save it since I didn't know how to write the "wq" command. So the popup came up and asked me if I wanted to Terminate "login bash" etc. whatever, I can't remember. I thought Terminate means it will be closed without saving the changes. Today, when I found out how to do everything properly, something different happened when I wrote "sudo vi /etc/httpd/httpd.conf" and hit enter; This text came up. I tried some random stuff, hit F13 and suddenly I got what I had yesterday again (unchanged). I did the couple changes, and then typed ":wq". This appeared. (not "disappeared" So I am wondering whether everything is still 'ok' here, or if I have done something improperly. By the way, I always get this message now when I type "sudo vi /etc/httpd/httpd.conf", the one in the first link of this post. Do I just have to delete the httpd.conf.swp file, that message is talking about? I just want to get reassurance in case I fug up my mac more and more; I don't really know how much terror Terminal is capable of, but I imagine it can mess things up a lot, and since I've never used Terminal before... Thanks ahead! This post has been edited by temhawk: Oct 11 2007, 06:45 AM -------------------- ![]() |
|
|
|
Oct 12 2007, 04:23 AM
Post
#12
|
|
![]() Loose bits sink chips Group: Administrators Posts: 2,068 Joined: 4-April 06 From: Kent, UK Member No.: 2 |
Yes, you can delete the .swp file. It's a temporary file used by vi to prevent more than 1 person modifying a file at once and to allow you to recover any changes you make if, for whatever reason, your editing is interrupted.
I think there's also a command to do that for you... when you get that message up you can press the space bar to read more and it may well tell you there how to do that. The reason this problem arose is because you didn't close vi properly (by using :wq or :q, or if you've made changes and don't want to save them :q!). -------------------- |
|
|
|
Oct 12 2007, 05:39 AM
Post
#13
|
|
![]() W.R. Private First-Class Group: Members Posts: 253 Joined: 30-August 07 From: Vienna, Austria Member No.: 586 |
Thank you, what you said worked!
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - I just tried to load "http://localhost/test.php" but Safari said it couldn't locate the remote server. I checked "sudo vi /etc/httpd/httpd.conf" in Terminal, and it was set properly. So I figured maybe I have to restart apache, so I typed "sudo apachectl graceful" and then tried opening the page again, and it worked. How come? "http://localhost/" worked (mac os x's index.html page) but what was going on? Also, when I clicked "Preview" in Taco HTML Edit (also for PHP) it opened in FF and worked (though it was a temporary file created by Taco; in the Taco preferences, I specified the path for the PHP (/Users/Hawk/Sites/) so it would work) That's weird, isn't it? This post has been edited by temhawk: Oct 12 2007, 05:57 AM -------------------- ![]() |
|
|
|
Oct 12 2007, 06:07 AM
Post
#14
|
|
![]() Loose bits sink chips Group: Administrators Posts: 2,068 Joined: 4-April 06 From: Kent, UK Member No.: 2 |
I'm not sure what you're asking?
localhost/ works, but localhost/test.php doesn't? -------------------- |
|
|
|
Oct 12 2007, 06:13 AM
Post
#15
|
|
![]() W.R. Private First-Class Group: Members Posts: 253 Joined: 30-August 07 From: Vienna, Austria Member No.: 586 |
That's what I mean!
And I've just encountered another problem. This post has been edited by temhawk: Oct 12 2007, 06:15 AM -------------------- ![]() |
|
|
|
Jul 10 2008, 02:59 PM
Post
#16
|
|
![]() W.R. Private First-Class Group: Members Posts: 253 Joined: 30-August 07 From: Vienna, Austria Member No.: 586 |
Alright Marc, now I need to reverse all these steps. I want to/am using MAMP and when I tell it to stop apache, I can still go to http://localhost/ and run PHP files. And there was also this website that showed me how to make apache automatically start on login or system boot (so I don't have to type "sudo apachectl graceful" every time) and I think I should probably reverse that configuration as well. Essentially I want to reset my Mac's apache and PHP settings to their original state, because that's what MAMP assumes to work properly.
Problem is I am afraid of playing with Terminal on my own, and I would be happy if someone could find that link/site that I used to make a small edit in some configuration file to auto-start apache. I remember that site was very blue! Edit: I found the link: http://b.lesseverything.com/2007/8/17/apac...re-s-how-to-fix (the site isn't as blue as it was back then This post has been edited by temhawk: Jul 10 2008, 03:16 PM -------------------- ![]() |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 8th January 2009 - 07:20 AM |