View previous topic :: View next topic |
Author |
Message |
maxmc Guru
Joined: 14 Oct 2002 Posts: 480 Location: Linköping, Sweden
|
Posted: Mon May 12, 2003 2:10 pm Post subject: request: Dummy guide on how to get Apache and MySQL to work |
|
|
I've been trying for 3 days now to get Apache and MySQL to work together with the phpWebsite. All it says is that it can't connect to the database, I've made a phpwebsite user that is a member of both apache and mysql groups. It's also added to the mysql user table with all rights.
What am I doing wrong, it took me like 5 reinstalls of MySQL to get that to work. A step by step from emerging to fully functional apache/mysql communication document would be preferable.
Thanks |
|
Back to top |
|
|
pjp Administrator
Joined: 16 Apr 2002 Posts: 20067
|
Posted: Mon May 12, 2003 4:22 pm Post subject: |
|
|
Moved from Other Things Gentoo. _________________ Quis separabit? Quo animo? |
|
Back to top |
|
|
darktux Veteran
Joined: 16 Nov 2002 Posts: 1086 Location: Coimbra, Portugal
|
Posted: Mon May 12, 2003 4:34 pm Post subject: Re: request: Dummy guide on how to get Apache and MySQL to w |
|
|
maxmc wrote: | I've been trying for 3 days now to get Apache and MySQL to work together with the phpWebsite. All it says is that it can't connect to the database, I've made a phpwebsite user that is a member of both apache and mysql groups. It's also added to the mysql user table with all rights.
What am I doing wrong, it took me like 5 reinstalls of MySQL to get that to work. A step by step from emerging to fully functional apache/mysql communication document would be preferable.
Thanks |
Post the error you get, that would help. Also, keep in mind that the users on mysql aren't the same as the ones on MySQL. _________________ Lego my ego, and I'll lego your knowledge
www.tuxslare.org - My reborn website |
|
Back to top |
|
|
rizzo Retired Dev
Joined: 30 Apr 2002 Posts: 1067 Location: Manitowoc, WI, USA
|
Posted: Mon May 12, 2003 4:38 pm Post subject: |
|
|
Most people will tell you to do this:
Code: | emerge apache mysql mod_php |
However at the end of mysql and mod_php there are instructions you need to perform. So do this:
Code: | # emerge apache mysql (then do mysql instructions)
# emerge mod_php (then do mod_php instructions)
# /etc/init.d/mysql start
# /etc/init.d/apache start |
Note that you may need to specify if you want apache 1.x or 2.x. If you are doing 2.x, you need to have "apache2" in your USE flag. You'll also need "mysql" in your USE flag.
So once you have apache and mysql running, you'll want to create mysql users for phpwebsite:
Code: | # mysql -uroot mysql
mysql> create database phpws;
mysql> grant all privileges on phpws.* to phpwsuser@localhost identified by 'password_here';
|
Now download and untar phpwebsite into your /home/httpd/htdocs dir (unless you changed DocumentRoot) and point your browser to that webserver dir to begin setup. I've made an ebuild for phpwebsite 0.9.1 to do that download and untarring but it is held up in committee.
For reference I'm on the phpWebSite dev team and am on #phpwebsite on freenode as rizzo. |
|
Back to top |
|
|
maxmc Guru
Joined: 14 Oct 2002 Posts: 480 Location: Linköping, Sweden
|
Posted: Mon May 12, 2003 5:51 pm Post subject: |
|
|
rizzo wrote: | Most people will tell you to do this:
So once you have apache and mysql running, you'll want to create mysql users for phpwebsite:
Code: | # mysql -uroot mysql
mysql> create database phpws;
mysql> grant all privileges on phpws.* to phpwsuser@localhost identified by 'password_here';
|
|
Ok that was what I was missing. As I understood it phpWebsite would create it's own database if it had the sufficient rights to do so.
Now I got it working, thanks everyone! |
|
Back to top |
|
|
rizzo Retired Dev
Joined: 30 Apr 2002 Posts: 1067 Location: Manitowoc, WI, USA
|
Posted: Mon May 12, 2003 5:54 pm Post subject: |
|
|
maxmc wrote: | As I understood it phpWebsite would create it's own database if it had the sufficient rights to do so. |
Perhaps it will, but to have sufficient rights to create a new database that doesn't already exist means being the root mysql user, and you definitely don't want a web app running around as the root user for anything. |
|
Back to top |
|
|
spbecker Retired Dev
Joined: 10 Dec 2002 Posts: 73
|
Posted: Tue May 27, 2003 6:24 pm Post subject: |
|
|
rizzo wrote: | Most people will tell you to do this:
Code: | emerge apache mysql mod_php |
However at the end of mysql and mod_php there are instructions you need to perform. So do this:
Code: | # emerge apache mysql (then do mysql instructions)
# emerge mod_php (then do mod_php instructions)
# /etc/init.d/mysql start
# /etc/init.d/apache start |
Note that you may need to specify if you want apache 1.x or 2.x. If you are doing 2.x, you need to have "apache2" in your USE flag. You'll also need "mysql" in your USE flag.
So once you have apache and mysql running, you'll want to create mysql users for phpwebsite:
Code: | # mysql -uroot mysql
mysql> create database phpws;
mysql> grant all privileges on phpws.* to phpwsuser@localhost identified by 'password_here';
|
Now download and untar phpwebsite into your /home/httpd/htdocs dir (unless you changed DocumentRoot) and point your browser to that webserver dir to begin setup. I've made an ebuild for phpwebsite 0.9.1 to do that download and untarring but it is held up in committee.
For reference I'm on the phpWebSite dev team and am on #phpwebsite on freenode as rizzo. |
I've been trying to get this to work lately too, and I just can't figure it out. I followed the instructions for making a phpwebsite user that you posted above, but I still get "Unable to connect to your server's database.
Please reenter your settings." every time I try to run the install for it. I'm using mysql 4.0.13 on an SGI Indy (Gentoo/mips). I've almost come to the conclusion that it may be an issue with mysql...perhaps it doesn't work properly on mips. Is there a specific version of mysql that phpwebsite works with?
On a side note...I got phpBB to work just fine, but I had to use the root mysql user to do it. Anything else wouldn't work. |
|
Back to top |
|
|
rizzo Retired Dev
Joined: 30 Apr 2002 Posts: 1067 Location: Manitowoc, WI, USA
|
Posted: Tue May 27, 2003 6:30 pm Post subject: |
|
|
I'm using phpwebsite with mysql 4.0.12 so I don't think 4.0.13 would be a problem. Were you able to log into mysql as the mysql root user and create the phpws database and user? |
|
Back to top |
|
|
spbecker Retired Dev
Joined: 10 Dec 2002 Posts: 73
|
Posted: Tue May 27, 2003 6:40 pm Post subject: |
|
|
rizzo wrote: | I'm using phpwebsite with mysql 4.0.12 so I don't think 4.0.13 would be a problem. Were you able to log into mysql as the mysql root user and create the phpws database and user? |
Yes, I was able to do this with no problems other than having to add the -p switch to the line you posted above. |
|
Back to top |
|
|
rizzo Retired Dev
Joined: 30 Apr 2002 Posts: 1067 Location: Manitowoc, WI, USA
|
Posted: Tue May 27, 2003 6:43 pm Post subject: |
|
|
Can you paste the contents of your config.php in a code block here? |
|
Back to top |
|
|
spbecker Retired Dev
Joined: 10 Dec 2002 Posts: 73
|
Posted: Tue May 27, 2003 6:47 pm Post subject: |
|
|
Hmm, that's interesting...seems it may not even be writing to config.php when I click submit. It looks default to me:
Code: | <?php
if ($_GET["print_config"]){
echo nl2br(htmlspecialchars(config_maker($_GET)));
exit();
}elseif($_GET["save_config"]){
echo config_maker($_GET);
exit();
}
function config_maker($data){
return "<?php
\$dbversion = \"".$data["dbversion"]."\";\n
\$dbhost = \"".$data["hostname"]."\";\n
\$dbuser = \"".$data["username"]."\";\n
\$dbpass = \"".$data["password"]."\";\n
\$dbname = \"".$data["database"]."\";\n
\$table_prefix = \"".$data["tbl_prefix"]."\";\n
\$source_http = \"".$data["http_src"]."\";\n
\$source_dir = \"".$data["filepath"]."\";\n
\$hub_hash = \"".$data["hubhash"]."\";\n
\$install_pw = \"".$data["install_pass"]."\";\n
?>";
}
?> |
|
|
Back to top |
|
|
spbecker Retired Dev
Joined: 10 Dec 2002 Posts: 73
|
Posted: Tue May 27, 2003 7:02 pm Post subject: |
|
|
Hmm, I suppose I could just try editing config.php by hand to enter the proper information. Is that all it takes to get phpwebsite working properly? |
|
Back to top |
|
|
rizzo Retired Dev
Joined: 30 Apr 2002 Posts: 1067 Location: Manitowoc, WI, USA
|
|
Back to top |
|
|
spbecker Retired Dev
Joined: 10 Dec 2002 Posts: 73
|
Posted: Tue May 27, 2003 7:56 pm Post subject: |
|
|
Ahh...no...it seems there *is* no conf/config.php at all. By the way I did try 0.9.2-RC1 and it did the same thing. |
|
Back to top |
|
|
rizzo Retired Dev
Joined: 30 Apr 2002 Posts: 1067 Location: Manitowoc, WI, USA
|
Posted: Tue May 27, 2003 7:58 pm Post subject: |
|
|
So you enter your database/login info and hit submit and it tells you that it created the config.php? If it can't create the config.php for various reasons it will present you with other options to either cut and paste or save and upload the file. |
|
Back to top |
|
|
spbecker Retired Dev
Joined: 10 Dec 2002 Posts: 73
|
Posted: Tue May 27, 2003 8:03 pm Post subject: |
|
|
Actually it says nothing about having created the config.php file. It just gives an error about not being able to connect the the mysql server (which is up and running btw). Something I should have mentioned probably is the version of mod_php I'm using. I don't know if it would affect anything, but I'm using 4.2.3 at the moment. |
|
Back to top |
|
|
rizzo Retired Dev
Joined: 30 Apr 2002 Posts: 1067 Location: Manitowoc, WI, USA
|
Posted: Tue May 27, 2003 8:11 pm Post subject: |
|
|
If you don't have a config.php then it shouldn't even be trying to connect to the mysql server. It would take you through the setup process to get the database and server information.
What hardware are you on? |
|
Back to top |
|
|
spbecker Retired Dev
Joined: 10 Dec 2002 Posts: 73
|
Posted: Tue May 27, 2003 8:26 pm Post subject: |
|
|
It goes to the screen where I have to enter the database information with no problems (database name, database username, password, etc...). It is only after I hit submit there that it tries to connect to mysql. The hardware is an SGI Indy (R5000 mips processor, 160mb of ram).
I was thinking of trying a different sql server to see if perhaps mysql is definitely the problem. I did have to compile mysql with -berkdb use flag because when I used berkdb, it complained something about that arch not supporting fast mutexes whenever I tried to start mysql (don't remember exactly what the error was, but that sounds right). |
|
Back to top |
|
|
rizzo Retired Dev
Joined: 30 Apr 2002 Posts: 1067 Location: Manitowoc, WI, USA
|
Posted: Tue May 27, 2003 8:29 pm Post subject: |
|
|
Oh yeah then it tries to make a test connection to make sure that your login information is correct.
So if I were a betting man I'd say that either:
1. mysql isn't running properly or at all
2. php isn't compiled with mysql support (probably would get a different error first though)
Do you have a phpinfo page that shows that mysql support is enabled? Should I assume you followed the directions specified earlier in this thread? |
|
Back to top |
|
|
spbecker Retired Dev
Joined: 10 Dec 2002 Posts: 73
|
Posted: Tue May 27, 2003 8:39 pm Post subject: |
|
|
rizzo wrote: | Oh yeah then it tries to make a test connection to make sure that your login information is correct.
So if I were a betting man I'd say that either:
1. mysql isn't running properly or at all
2. php isn't compiled with mysql support (probably would get a different error first though)
Do you have a phpinfo page that shows that mysql support is enabled? Should I assume you followed the directions specified earlier in this thread? |
I do have mysql in my use flags, and I'm pretty sure mysql+php works because I was able to get phpBB working properly with what I currently have installed. Right now I'm trying to compile mod_php 4.3.1 and see what that does. Previously I couldn't get anything higher that 4.2.3 to produce a libphp4.so (was a mips issue...but I think that's fixed now). |
|
Back to top |
|
|
spbecker Retired Dev
Joined: 10 Dec 2002 Posts: 73
|
Posted: Tue May 27, 2003 9:31 pm Post subject: ok, I'm dumb |
|
|
In an attempt to make sure I didn't do anything stupid, I found out I had done something stupid. I made a typo when I created the phpwebsite user privileges in mysql, and didn't realize what I had done. So, in entering the info for the phpwebsite setup, I was typing the username without making the mistake, screwing everything up.
I think it's all working now....thanks for the help |
|
Back to top |
|
|
|