# PHP & mySQL revisited: Help needed



## MacLuv (Nov 29, 2002)

Hi 

I've just installed PHP and mySQL on OS X so that I can use Dreamweaver MX on my local machine to create dynamic web pages before sending them to my live server.

I know there's a script I have to install if I want to start mySQL at bootup... I haven't done that yet.

Do I need mySQL and PHP to be running when I access them from Dreamweaver MX? Or will Dreamweaver access them automatically?

How to I know if mySQL is running? I try the "top" command and see mysql and mysqld. I don't see httpd for PHP.

How do I start both manually? 

Am I correct in assuming that PHP doesn't have to have a daemon running all the time, it just gets accessed when needed?

Thanks in advance for all your help.


----------



## kendall (Nov 29, 2002)

The URL below should answer any MySQL and PHP questions you may have.

Never run Dreamweaver MX, can't help you there.

http://www.entropy.ch/software/macosx/mysql/


----------



## MacLuv (Nov 30, 2002)

thanks for the reply itanium... unfortunately i've been to marc's site many times and haven't been able to find answers for the direct questions i'm looking for.. 

Have you installed PHP or mySql on OSX yet?


----------



## uoba (Nov 30, 2002)

Hi Macluv

Okay, MySQL will stop working upon a Restart or Shutdown, therefore you will have to start it up once your machine has started-up. Once it's running (MySQL), it'll stay running until you turn off/restart your machine, or it crashes...

I presume you've already installed the MySQL package from entropy.ch?

Anyway, once it's running it'll stay running... if you want to start it up, do the following in the terminal:


cd /usr/local/mysql

sudo ./bin/safe_mysqld --user=mysql &

 Occassionaly, I cannot start the mysql daemon with the sudo command in front of the ./bin etc... therefore do the following instead:


cd /usr/local/mysql

sudo -s
 
 Enter your root password here 

./bin/safe_mysqld --user=mysql &
 
 A quick scroll of info should happen; if all goes well, type:

exit
 
Make sure you exit since you'll be logged-in as root!

To test if it works, type: mysql in the terminal, this'll log you into MySQL from the command line (type exit to get out of it)... 

A quick point, your root user for MySQL has no password initially, so make sure to figure this out (see www.entropy.ch for references).


As for PHP, once installed, it'll work whenever Apache is running, since it is only a module for Apache... I presume that you are running Apache for web serving all the time (at least for testing).


----------



## billbaloney (Dec 2, 2002)

It is possible, as with just about any application, to have a working startup script for MySQL.  Apple and other sites (probably including MacOSX.com, if you take a look around) have primers on how to write startup scripts.

I believe Marc at Entropy provides a startup script.  A script I'd acquired previously from someone, maybe Marc, failed in Jaguar.  The guts of the working script that I have goes like this:

cd /usr/local/mysql
./bin/safe_mysqld &

This is assuming that you have a /usr/local/mysql.

A previous command, which was no longer working after a few MySQL and OS X updates, was this:

/usr/local/share/mysql/mysql.server start

safe_mysqld is, as it says, a safe way to start up the daemon: the script makes several different checks to make sure there aren't any other MySQL instances running on the system, and starts the server as the mysql user.

For more on startup scripts, do a quick search on this site.


----------

