[HOWTO] - Setup PHP & MySQL

Status
Not open for further replies.
get rid of all HTML and just put in the PHP. PHP doesn't need HTML to work. Just put

<?php phpinfo() ?>

Try that and see if it works.

Twister
 
I have just upgraded to 10.2 and now Apache doesn't seem to be working.
When I goto local host it presents the Library:Webserver:Documentation directory but non of the PHP files work. It just shows the code.
It was working before.

How do i go about re-installing?
Thanks
 
Managed to get it working ;)

One query though, when someone connects to my computer they get taken to the 'Library/WebServer/Documentation' directory.
I thought they were supposed to be taken to the 'Sites' directory in my home folder :confused:

Can someone clear this up for me? Thanks
 
I am simply telling them my IP address.
If i tell them to connect to my IP address with /~username then they goto the sites folder. Can I get them to goto my sites folder automatically just by putting my IP address in and not including the /~username bit?

Also how come browsers dont automatically goto index.php?
Instead i just get a directory/file list view when viewing in Internet Explorer.

Thanks
 
I don't know those answers. Sorry. The inxex.php is in some config file but i don't know where. You could put a 1 second refresh tag on your index.html page that takes them to the index.php page.

Twister
 
Hi all.

I very carefully followed part 1 (PHP) of the install process with no apparent hitch. I created some test php code to test the php server:
<?php phpinfo() ?>

in a file called "test.php"

1st I saved it to the root, library, webserver, documents folder and tried running it by http://localhost/test.php and just got the line, unprocessed, spit back in my web browser. So the file was found and accessed, but the php was not processed.

Then I tried putting it into my sites folder in my own user directory and tried http://127.0.0.1/~myusername/test.php and the same thing happened.

So in other words, my pages are there but not being processed by php.

Any thoughts would be appreciated. -- Larry

EDIT: OK. I figured it out. Sixthring's post helped a lot. I had everything right in my config file except this line was missing:

AddType application/x-httpd-php .php

Thanks, Sixthring! -- Larry
 
I think I have MySQL installed properly..... I think. Now I'm trying to install a message board. PHP works as the install file is install.php.... now it gets to the point where it's asking me for my:

1. Database server
2. Database name
3. Database user
4. Database password

As default my Database server was filled in as 'localhost'.

What is my Database name/user/password?

Would it be MySQL User/mysql/*******?

I'm trying everything I can think of and nothing seems to work. Thanks for any help!
 
ok you have to set up a database first. Some hosts come with that. You just have to go in and set it up. Usually give it a name and your done. Then the usernname and password is the same as it is to log into that database. Mine is the same as my hosting username and password.

Does that help?
 
Is there a way to get mysql running without having to cd into the mysql directory first? to start apache all i need to do is type apachectl start - why all the directory stuff for mysql?
 
I don't actually mind starting apache and mysql when i need them, just was wondering why i had to start mysql from its install directory and not apache. also, is there a way to make it so i don't have to sudo to start apache/mysql?
 
definately need to sudo them to get them to start. see:

ckline% apachectl start
Processing config directory: /private/etc/httpd/users
Processing config file: /private/etc/httpd/users/ckline.conf
fopen: Permission denied
httpd: could not open error log file /private/var/log/httpd/error_log.
/usr/sbin/apachectl start: httpd could not be started

and this is what i get for mysql:

ckline% cd /usr/local/mysql/
ckline% ./bin/safe_mysqld &
[1] 484
[Charles-Klines-Computer:/usr/local/mysql] ckline% The file /usr/local/mysql/libexec/mysqld doesn't exist or is not executable
Please do a cd to the mysql installation directory and restart
this script from there as follows:
./bin/safe_mysqld.

See... now if I sudo both of those, everything starts just fine. ...why is that? are those services installed incorrectly? do i need to change something? should i change something?
 
ah yes... that much I assumed. after i installed both apache and mysql (got the instructions to do this off http://www.phpmac.com/

the last step of which for mysql is to do this:

sudo scripts/mysql_install_db
sudo chown -R root /usr/local/mysql
sudo chown -R mysql /usr/local/mysql/data
sudo chown -R root /usr/local/mysql/bin

is this not the right way to set the permissions?
 
Sorry... more on this.

So... I am trying to get MySQL to load at startup so I followed the instructions in another thread and created the necessary files, but MySQL does not load.

The script has this to start mysql:

cd /usr/local/mysql ; /usr/local/mysql/bin/safe_mysqld --user=mysql &

but trying this in the terminal does not start mysql so i am not sure if that is the problem. anyone wanna help?

thanks
ck
 
I did a real dumb thing. I forgot to create a MySQL user account BEFORE I installed MySQL. The installer created one, called Other..., for me. But I have no idea what the password is so that I can start up MySQL. Is the a way to fix this? :rolleyes:

ListerMint
 
Status
Not open for further replies.
Back
Top