PDA

View Full Version : mysql / php / dev on a mac?




jvaska
May 26, 2002, 10:36 PM
anybody know if this is possible?

i'd like to use dreamweaver mx to create some php pages on my mac...but...is there a way to setup and edit a mysql database on a mac? anybody know of some utility or something for this? can i just use filemaker to create the database?

i know i can create php stuff on the mac (although i've done it in the past with asp)...but i don't think i can test it on my machine...i'll have to upload (tediously) to do that...unless somebody knows something i don't...

thanks for any thought...comments...people telling me i'm stupid...jv



Rower_CPU
May 26, 2002, 10:51 PM
OS X has apache built in, even on the client version. PHP is already there, waiting to be enabled via the Apache config file.

Just turn on Web Sharing and place your files in the /Library/Webserver/Documents folder and test them out in a browser.


I don't know of any mysql tools. I've only dabbled with it enough to create databases and tables and update them with calls from PHP.

You can get great info for all these topics over at www.oreillynet.com

firewire2001
May 26, 2002, 10:55 PM
heh.. dont you mean ;), ;), ::nudge::, ::nudge::

Rower_CPU
May 26, 2002, 11:00 PM
Originally posted by firewire2001
heh.. dont you mean ;), ;), ::nudge::, ::nudge::

Well, since he actually says the words...I don't know...maybe.

I'm glad there are a few people out there who get the reference...especially someone in SoCal. :D

kishba
May 26, 2002, 11:03 PM
my linux friend helped me setup the php & mysql servers on OS X

he also helped me install a nice server called webmin... it looked relatively easy to do (just basically type install/setup in the terminal after unpackaging it)

webmin lets me edit the mysql databases & tables without having to type the sql manually; although the terminal can be just as nice

i'll look for links on setting up these servers tomorrow and post them up here if you guys are still interested

kishba
May 26, 2002, 11:07 PM
oh, by the way, i almost forgot to mention that of the OS's i've used within the last few months during the construction of a web site for a competition, mac os x was PERFECT for working with php & mysql

bbedit offers really nice code-highlighting and nifty find/replace features... also, when you double click near parentheses it will select the text between them (useful when look for missing (),{},[],etc)

i'm beginning to think that apple has transformed their os from one that couldn't edit code or serve worth a darn to the choice platform for both (bbedit & photoshop also put X over linux/windows for web design)

apple's really got one great package...

Rower_CPU
May 26, 2002, 11:10 PM
Originally posted by kishba
my linux friend helped me setup the php & mysql servers on OS X

he also helped me install a nice server called webmin... it looked relatively easy to do (just basically type install/setup in the terminal after unpackaging it)

webmin lets me edit the mysql databases & tables without having to type the sql manually; although the terminal can be just as nice

i'll look for links on setting up these servers tomorrow and post them up here if you guys are still interested

I'll have to check out webmin, sounds interesting.

O'reilly has all the documentation I used for setting up PHP. It's simply a matter of uncommenting a couple of lines in the httpd.conf file for Apache.

And O'reilly is also nice enough to provide links to a double-clickable installer for mysql, as well as a patch to make it start on system start.

jvaska
May 26, 2002, 11:12 PM
ok...next questions guys...

DO I DARE INSTALL OS X ON MY G4/400?

geezus...i didn't think i would need it this soon...but wow! if i could do php and mysql stuff...

oh yes...a linux buddy of mine did tell me that i could use filemaker pro to do some database stuff...i'm just not sure how much...it might be possible...maybe...

thanks for the info...this is really great!!!!

jv

Rower_CPU
May 26, 2002, 11:16 PM
On a G4...absolutely!

I've even been able to do work on a G3 with OS X.

My TiBook has only a 400MHz G4, but that's plenty good for OS X. My one caveat is that if you're going to be using Classic as well, make sure you have plenty of RAM or else you'lll be paging out all day...not pretty.

jvaska
May 26, 2002, 11:22 PM
how much is plenty?

i didn't think i would touch OS X for another year...but holllllllllyyyyyyyyy...

my brain is on fire with this revelation...i just haven't really been paying attention to things...

yo!...jv

Rower_CPU
May 26, 2002, 11:26 PM
Depends on the apps you'll be running.

I would say that 256 is a BARE minimum. 512 should be ample.

jvaska
May 26, 2002, 11:28 PM
cool...i'm more than ready to go then...

yeah...post those links you mentioned please...i'd like to know more!

jv

Rower_CPU
May 26, 2002, 11:34 PM
These articles should get you well on your way:
http://www.onlamp.com/pub/ct/49

jvaska
May 26, 2002, 11:35 PM
hmmm...it's funny...i've done this stuff before...but i never had to know these things until now...very strange...

is mysql the same thing as microsoft sql?

filemaker can do the latter...but i'm not sure if it's the same...and/or...if they will work together...i'm not sure how else i could create the database if this won't work...the last time i did and database stuff it was on a pc...but i'm completely fed up with using them...

jv

Rower_CPU
May 26, 2002, 11:38 PM
I'm gonna go out on a limb here and say an emphatic NO.

mysql is an open-source, free database. MS is, well...MS.

jvaska
May 26, 2002, 11:45 PM
yeah...i was just tinkering...

looks like i'll be using the pc to make the database...

they must have something a mac can use to do that?

i looked through that link already...good info...

thanks much!...jv

Rower_CPU
May 26, 2002, 11:55 PM
You mean besides FileMaker...?

jvaska
May 26, 2002, 11:59 PM
yeah...but...i found this thing called MACSQL...i think it makes things possible...think i can do this...ALLLLLLLL mac...no pc...

jv

Rower_CPU
May 27, 2002, 12:04 AM
There's something to be said for that indeed.

It feels...purer, somehow. :D

Choppaface
May 27, 2002, 12:25 AM
i believe that macsql is an app for doing mysql db management in OS 9


you should also be able to run PHPmyAdmin on OS X for that mysql management, no?

LimeiBook86
May 27, 2002, 12:36 AM
hee hee hee.....

wink, wink, nudge, nudge......

Monthy Python.... hee hee hee

Good one! :D

Rower_CPU
May 27, 2002, 12:45 AM
Originally posted by Choppaface
i believe that macsql is an app for doing mysql db management in OS 9


you should also be able to run PHPmyAdmin on OS X for that mysql management, no?

I'm not familiar with PHPmyAdmin, and I looked on Versiontracker and didn't see it. Could you give us some more info?

Choppaface
May 27, 2002, 01:37 AM
I've never used it, but from what I read it's a very helpful tool....written in PHP so it shouldnt need to be ported to work on OS X

as always, google.com search for phpmyadmin reveals:

http://www.phpwizard.net/projects/phpMyAdmin/

as the home page for it


BTW, isn't mysql supposed to be installed as its own user (for security reasons)?

not that security is a big issue here because 1) we're mainly doing site dev not server dev and 2)we're privately testing
but I was wondering since I read it somewhere that it should have its own user.

also does anybody have a link to that 'double clickable' installer for mysql? I installed it a while ago to OS X and got lots of config warnings, but i never ran it so I never knew if it made a difference. i was wondering cuz this installer in question might have an OSX friendly config or something

kishba
May 27, 2002, 10:17 AM
my webhost has phpmyadmin installed on their server and it's very similar to webmin, except a little better in some aspects

either is nice for managing myself databases

jaykk
May 27, 2002, 10:53 AM
try SQL4X Manager J, a demo version is available from Apple's Download page.
http://www.apple.com/downloads/macosx/development_tools/sql4xmanagerj.html

Rower_CPU
May 27, 2002, 12:03 PM
Originally posted by Choppaface
...also does anybody have a link to that 'double clickable' installer for mysql? I installed it a while ago to OS X and got lots of config warnings, but i never ran it so I never knew if it made a difference. i was wondering cuz this installer in question might have an OSX friendly config or something

It's in one of the articles I linked to above:
http://www.macdevcenter.com/pub/a/mac/2002/03/08/apache_mac_5.html?page=2

There is a compilable source there as well.

Choppaface
May 27, 2002, 08:52 PM
muy bien thanks man :D :D

cleo
May 31, 2002, 03:18 PM
Originally posted by Rower_CPU


O'reilly has all the documentation I used for setting up PHP. It's simply a matter of uncommenting a couple of lines in the httpd.conf file for Apache.

OK, i'm resurrecting this not-quite-cold thread because I'm really, really dense. :D

Kishba has been kind enough to introduce me to PHP and MySQL, and I found out today that I can use them on my school servers, which means (hopefully) that I can recode some terribly complex websites that I manage and turn them over to the departments that they belong to.

The thing is, I want to learn how to use this stuff on my machine before have to upload stuff. SO... Rower, since you've figured it out, exactly which lines do I have to change in the Apache config file? Do you have the o'reilly link to the specific instructions (I can't find them on that site)? I've been at this all afternoon and am still at square one. :(

Rower_CPU
May 31, 2002, 03:25 PM
No prob, cleo.

This article show you which lines of the apache config file to modify:
http://www.macdevcenter.com/pub/a/mac/2002/01/04/apache_macosx_pt3.html

And this one walks you through the mysql setup/installation:
http://www.macdevcenter.com/pub/a/mac/2002/03/08/apache_mac_5.html

You may just want to go through them all, from the first one, just to familiarize yourself with the overall process, instead of just jumping in.

You'll learn a lot of really interesting stuff that's built into X!

kishba
May 31, 2002, 05:14 PM
isn't it amazing how simple users (which i used to be) switched from pc's to macs because they were less confusing... and now they're playing with linux-like config files and programming!

i love the mac and all apple has done for me... i've certainly expanded my skills in everything and my productivity is at an all-time high since i keep wanting to do more with my mac....

ain't it grand?

xelterran
May 31, 2002, 06:15 PM
cool i have been wanting to use a database program for mac for a while now - i have been using asp with txt files as a database (ugh), damn osx rules!!!

cleo
May 31, 2002, 07:30 PM
::Sigh:: Three hours with little to show for it. I got PHP running smoothly (thanks for the link, Rower!), but MySQL just has it out for me or something. I've tried installing it via package, via compiling, via binary distribution... two different builds... installing as root... and nada. It seems to have a massive problem with my mysql.sock in /tmp/, but the FAQ's aren't at all helpful (they say that the error message I receive when trying to start the server - 2002 - is because I already have an instance of mysql running and thus occupying the socket - but I most certainly do not!). I've given everybody permission to everything (well, just about ;)), and still no dice. I give up. Blah.

Unless someone here wants to help me....? :D

Rower_CPU
May 31, 2002, 08:16 PM
Weird. I haven't had any problems with installing it on X server or on X client.

Did you follow the directions for the double-clickable? Starting mysql, creating the user, etc?

cleo
May 31, 2002, 08:40 PM
Yup. And it runs just perfectly till I actually go to start the server.

[localhost:~] cleo% cd /usr/local/mysql
[localhost:/usr/local/mysql] cleo% sudo bin/safe_mysqld --user=mysql &
[1] 718
[localhost:/usr/local/mysql] cleo% Starting mysqld daemon with databases from /usr/local/mysql/data
020531 21:30:26 mysqld ended


[1] Done sudo bin/safe_mysqld --user=mysql
[localhost:/usr/local/mysql] cleo% mysql
ERROR 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (61)
[localhost:/usr/local/mysql] cleo%

Corresponding error log:
020531 21:30:25 mysqld started
020531 21:30:25 /usr/local/mysql/bin/mysqld: Can't create/write to file '/usr/local/mysql/data/localhost.pid' (Errcode: 13)
020531 21:30:26 /usr/local/mysql/bin/mysqld: Table 'mysql.host' doesn't exist
020531 21:30:26 /usr/local/mysql/bin/mysqld: Error on delete of '/usr/local/mysql/data/localhost.pid' (Errcode: 2)
020531 21:30:26 mysqld ended

I've chmod'ed absolutely everything to 777.

macabre
May 31, 2002, 08:49 PM
The fist time I tried to install php and mysql on os x it was with the command line. I failed when trying to connect to the database or start up the server and then gave up. Cleo, I would recommend visiting http://www.macosguru.de/us/download.html and download eSuite4xmySQl edition. It gives you a ten day trial, but more impotantly installs and configures mysql and php for you. I have had success doing this on 3 os x machines so far, without a single problem. Just make sure you set up a user named mysql first.

macabre
May 31, 2002, 08:51 PM
Originally posted by macabre
but more impotantly installs and configures mysql and php for you.

oops.. I mean "IMPORTANTLY":rolleyes:

cleo
May 31, 2002, 09:00 PM
Originally posted by macabre
The fist time I tried to install php and mysql on os x it was with the command line. I failed when trying to connect to the database or start up the server and then gave up. Cleo, I would recommend visiting http://www.macosguru.de/us/download.html and download eSuite4xmySQl edition. It gives you a ten day trial, but more impotantly installs and configures mysql and php for you. I have had success doing this on 3 os x machines so far, without a single problem. Just make sure you set up a user named mysql first.

Cool, thanks for the tip! Should I somehow try to remove the stuff I've already put on, first? And after the 10-day trial expires, is MySQL still functioning?

kishba
May 31, 2002, 09:19 PM
hmm.... i installed the double clickable thing on a clean install of X on my laptop and it worked perfectly... i can get to mysql with the terminal too... maybe something's up with your system?

::sigh:: i'm sorry this isn't working out too well... i can let you work with mysql & stuff off of kishba.com if you would like...

cleo
Jun 1, 2002, 09:03 AM
It's funny that you mention that you installed MySQL on a clean install of OS X. When I logged in as root yesterday, I noticed that everything seemed much snappier than it does under my normal login. I've also ben noticing a general slowdown of everything lately. I've run the Disk Utility that comes on the OS X CD, but it comes up clean. How difficult would it be for me to somehow start from scratch and wipe everything clean? I could easily back up my mp3's and other stuff in my Home folder. And, with 10.1.5 supposedly on the way, this would be a good time. What do you all think? How would I go about doing this?

Rower_CPU
Jun 1, 2002, 01:10 PM
What are your backup options? I'm not familiar with your system.

Do you have separate disks/partitions you can transfer files to?
Do you have a CD burner?

cleo
Jun 1, 2002, 02:09 PM
I'm on a G4 iMac 800, just 1 partition. I can easily backup mostly everything onto CD's... mp3's I'd just send over to my iBook temporarily via FireWire. So backup wouldn't be a big deal at all.

Is reinstalling a difficult thing to do? Would it be better to first try to defrag or something (although I don't have or know what ools I'd need for that, either)?

macabre
Jun 1, 2002, 02:18 PM
Originally posted by cleo


Cool, thanks for the tip! Should I somehow try to remove the stuff I've already put on, first? And after the 10-day trial expires, is MySQL still functioning?

I dont think you have to remove anything first, I didnt. After the trial MySQL works fine, its just the database manager software that expires. But you can work around that by temporarily setting you date back a year and then opening it. But thats not nice! Right now I am still trying to decide what software I like best, so I can say the ten day evaluation period was not long enough. I use the terminal mostly though. It helped when I was first learning to understand how to talk to the database.

Rower_CPU
Jun 1, 2002, 02:38 PM
Originally posted by cleo
I'm on a G4 iMac 800, just 1 partition. I can easily backup mostly everything onto CD's... mp3's I'd just send over to my iBook temporarily via FireWire. So backup wouldn't be a big deal at all.

Is reinstalling a difficult thing to do? Would it be better to first try to defrag or something (although I don't have or know what ools I'd need for that, either)?

Reinstalling isn't difficult to do, but if you've never done it, it can seem pretty daunting.

Backup your mp3s and other documents you may have on your machine. You may also want to back up your user folder, which contains many of your preference files, mailboxes, etc. OS X makes it very easy to backup and reinstall that way.

Once you're sure that you've backed everything up (double-check, I almost always find a file or two that I've foregotten), put the OS X install CD in and restart from CD by holding "c" down on startup (in case you didn't know).

Now you have some decisions to make. If you left the iMac the way it came from Apple (X and 9 on the same disk/parttion), you will just need to do a "clean install" of X. If you only have X on your drive, I would suggest reformmating the hard drive and then do a fresh install of X.

The process is fairly user firendly, in the usual Apple fashion, but certain terms and choices are not neccessarily obvious to someone who has never been through the process before.

I'm glad to help, so keep the questions coming. :)

PyroTurtle
Jun 1, 2002, 04:23 PM
wink wink, nudge nudge, say no more say no more
a winks as good as a nod to a blind bat....
oh, flying circus is so classic...i like british humour though....
monty python, douglass adams, terry pratchett....
maybe i should make a SQL batabase of all the cool british humour-ish stuff i find and then make a php page to acess it all then post the results on my web site....
or just sit back, laugh, and actually sleep sence school is almost out....

Macette
Jun 11, 2002, 06:41 PM
Originally posted by Rower_CPU



I'm glad to help, so keep the questions coming. :)

okay, a question for ya... (or anybody who can help... kishba, it sounds like you might be able to help with this too)

i've been going through the apache and terminal tutorials on macdevcenter.com, and have ******** up a bit, i think.

in the terminal tutorial that teaches you how to activate SSI, I think i did something wrong.. and now apache won't start up. when i try, i get the message (in terminal) that:
"sudo apachectl start
Syntax error on line 1 of /etc/httpd/httpd.conf:
Invalid command '/etc/httpd/httpd.conf', perhaps mis-spelled or defined by a module not included in the server configuration
/usr/sbin/apachectl start: httpd could not be started"

AND I DIDN'T KEEP A BACKUP OF MY HTTPD.CONF

can anybody help? how do i begin to debug this without a backup?

macette xx

Macette
Jun 11, 2002, 06:44 PM
And also, how do i open a hidden file in BBEdit, like it says in the SSI tutorial? i opened my httpd.conf file in pico, because i could work out how to do it in BBEdit (even using the 'open hidden file' thing)

in fact, does anybody know of a good BBEdit tutorial or six on the web somewhere?

kishba
Jun 11, 2002, 06:58 PM
Originally posted by Macette
can anybody help? how do i begin to debug this without a backup?

macette xx

hmmm... i looked in my /etc/httpd folder and there are two older files called "httpd.conf.bak" and "httpd.conf.default" in there... maybe if you just rename one of those to "httpd.conf" (the command would be "cp httpd.conf.default httpd.conf") your problem would be fixed

you might have to fix php/mysql if they're broken, but it might be what you're looking for... as for BBEdit the "Open Hidden" works on my computer... i can see the linux folders such as "etc" by going to the root directory of the hard drive... you might want to check that you are logged in as an administrator (other than that i don't know what's wrong with the silly thing)

g'luck and if you continue to have some crappy problems post them, or e-mail me@kishba.com

Choppaface
Jun 11, 2002, 07:46 PM
ya I believe httpd.conf.bak is a backup copy of the default settings put there by the OS installation.

open hidden... works for me. you also might try getting Tinker Tool to reveal hidden items. that way you can see all the hidden folders and things right in the finder

Rower_CPU
Jun 11, 2002, 08:27 PM
What they said.:) Use your .bak file.

Also, if you're running the full version of BBEdit, you should be able to open files from the command line similar to the way you use pico. Just type "bbedit filename" and it should pop open...from what I've been told.

Macette
Jun 11, 2002, 08:46 PM
ah ha, the FULL version of BBEdit. i'm just running the demo - so that would be my problem (and the reason i had to use Pico last time)

thanks for your help.

kishba
Jun 11, 2002, 08:48 PM
Originally posted by Rower_CPU
What they said.:) Use your .bak file.

Also, if you're running the full version of BBEdit, you should be able to open files from the command line similar to the way you use pico. Just type "bbedit filename" and it should pop open...from what I've been told.

yep, that works with the command line all thanks to the genius's who wrote bbedit (i love them a bunch)

i remember reading an article on resexcellence about how to open any file with any app from the command line through *nix's alias's... sigh... if only apple could make a simple applescript to do this... the terminal is really growing on me :)

kishba
Jun 11, 2002, 08:51 PM
Originally posted by Macette
ah ha, the FULL version of BBEdit. i'm just running the demo - so that would be my problem (and the reason i had to use Pico last time)

thanks for your help.

i remember using the bbedit demo on my laptop several years ago... i was dreadfully confused (my mac friends had been gushing over bbedit and i didn't understand why...)

i really do hope that the creators of bbedit will either lower the price on bbedit (i think it's currently $160) or make the demo a tad more powerful... i think nearly every web designer has heard of bbedit (even my pc dev friends know of it) and they could really convince more people to buy it if they could easily access all of its functionality

bbedit is truly a great app and is worth every penny of its price

Macette
Jun 11, 2002, 09:43 PM
another prob...

i'm doing the terminal things again (on a different computer) and have come across the following error when I try to sendmail (having previously attempted to change the permissions so that i would be allowed):

insite% can not chdir(/var/spool/clientmqueue/): Permission denied
Program mode requires special privileges, e.g., root or TrustedUser.

i think i may have screwed up when chmod'ing... i wrote "sudo chmod g-w/
instead of "sudo chmod g-w /" (note the extra space), and got the following, which i don't remember seeing last time i did this tutorial:

"usage: chmod [-R [-H | -L | -P]] mode file ..."

is this the reason i can't send mail? what have i stuffed up now?

i've repeated the (correct) chmod, but it hasn't changed anything.

kishba
Jun 11, 2002, 09:51 PM
"usage: chmod [-R [-H | -L | -P]] mode file ..." usually just means chmod did absolutely nothing

i don't think that would have caused any damage but perhaps you should try using "chown" ("chown filename user" - i think that's the context)

it might do something different... but i could be wrong :)

if that's not it hopefully another commandline guru can come up with a fix/answer (sorry)

Macette
Jun 11, 2002, 10:04 PM
what is chown? (i haven't done all the tutorials yet..)

and what does this mean:

"insite% can not chdir(/var/spool/clientmqueue/): Permission denied
Program mode requires special privileges, e.g., root or TrustedUser."

( i mean, i think i sort of know..)

does chdir mean change directory?

does this mean my mail is not sending?

and why would i not have a ~/Library/Mail/ directory, when the tutorial reckons i should?

maybe i should go back to school..

Rower_CPU
Jun 11, 2002, 10:38 PM
Originally posted by Macette
what is chown? (i haven't done all the tutorials yet..)

and what does this mean:

"insite% can not chdir(/var/spool/clientmqueue/): Permission denied
Program mode requires special privileges, e.g., root or TrustedUser."

( i mean, i think i sort of know..)

does chdir mean change directory?

does this mean my mail is not sending?

and why would i not have a ~/Library/Mail/ directory, when the tutorial reckons i should?

maybe i should go back to school..

Don't lose hope.:)

chown changes the owner of a file.

How are you trying to use sendmail? From a PHP or MySQL page?

Yes, chdir changes directory, but you're probably more familiar with its abbreviation "cd".

So you don't have a Mail directory in your Users/username/Library/ hunh? Are you using Mail.app?

Macette
Jun 11, 2002, 10:41 PM
ahh. i've run the sendmail changes needed for 10.1.5 - how did i miss that? - and now my mail probs are solved.

Rower_CPU
Jun 11, 2002, 10:45 PM
Originally posted by Macette
ahh. i've run the sendmail changes needed for 10.1.5 - how did i miss that? - and now my mail probs are solved.

Don't you just hate it when you overlook something like that.:p

Macette
Jun 12, 2002, 12:40 AM
OMG, Streamripper is way cool. I love Terminal! I love nerdy stuff! OMG, am becoming massive nerd (first hint was joining macrumors, I suspect)

(do the Terminal tutorials on http://www.macdevcenter.com to find out what i'm talking about, if you don't know already)

xxxx