Hi there all of SuSErs,
After a LONG LONG LONG and mindboggling weekend, I finally solved MOST if not ALL the troubles I was having with Apache2 running with PHP4 and MySQL together with all the modules including Mod_Auth module for MySQL authentication from PHP in SuSE 9.1.
I decided to post this thread because I know by now, how many of us SuSErs are facing this trouble of having all these three programs together. I myself asked for NUMEROUS people here on LinuxQuestions without any luck. So, if you find this instructions helpful, please drop a note. If you need any further help, feel free to ask. I have faced ALL of the issues possible to find the EASIEST way to do this. And I can guarantee you that if you do the steps correctly, YOU will have these programs running without any problem.
Problem starts .. Apache or Apache2
The problems started with Apache2. Most of the ONLINE manuals of PHP installations require Apache 1.13 or something old installed. My question was "why should I use an older version of Apache when Apache2 is already built in SuSE 9.1?" so, I installed Apache2 while re-installing SuSE last Thursday night. I had no idea what modules it loaded and what modules it didn't. I checked my httpd.conf file and found that it didn't install a lot of modules I needed. Now, if i was using manual installation method, I could have turned on all these modules by using ...
--enable-module= "name of module"
at the installation or ./configure script which now I can't as Apache2 is going to be installed using Yast (the Beast I call it).
Life is Tough with Yast the Beast
If this was only the story, I would be happy. To make my life more miserable, MySQL is another monster, I had to fix. The problem of MySQL is mainly permissions to exact folders and location of files in SuSE boxes. For instance, you have to have a group named mysql, a user named mysql (without password) and give this user permission to some folders like /usr/local/mysql and /usr/local/mysql/data etc.
If you install MySQL while installing SuSE or at any time later, you will
NOT see the /var/local/mysql folder. This was soooo frustrating for me as I couldn't give permission to any of these mandatory folders to my user mysql.
First strategy to solve issues
First I decided to the hundreds of mails I recieved from SuSE users to download Apache 1.13.xxx + Php4 + MySQL 4.0.18.xxx tarballs and do the installation manually instead of using YAST. I said "NO" to this approach as I wanted YaST to install these. I didn't just want to install and use Apache2, I wanted to use it with PHP4 and MySQL. The reason was, Apache2 comes with OpenSSL and Mod_Auth modules built in to make life MUCH MUCH MUCH easier. So, a BIG
NO to this approach.
Second strategy to solve issues
So, I decided to look for different threads online for using Apache2 with PHP and installing these with YaST. No luck there. No one looks like did this (I don't blame them, SuSE 9.1 is pretty new in the market). The small fragments of instruction I found, I wrote them down in order to try later all together. After 8/9 hours of gruesome search and reading millions of threads, I sketched out my strategy.
Strategy and Tasks
I decided to do the following in exact order (I guess the order is important, cause I had goofed up this before. But, some of these may be interchanged I guess.). Hey, I am a newbie, and I am not using SuSE for YEARS like you guys
.
1. FIre up YaST and click install software.
2. Type PHP and select all the
modules at the end of the list. All you need are the ]b]modules[/b] and ofcourse PHP itself with the Development packages and other PHP stuff. What I did, I checked all of them and clicked finish. I had some conflicts, and decided not to install the conflicting packages.
3. Once that is done, do the same with MySQL (all the packages you need, and of course the
modules. I didn't installed any of the Perl, Python stuff, as I don't need them.
4. Once that is done, install Apache2. Type Apache and search. You will see Apache2 server, the development tools, the libraries, and the
modules at the end of the list. Select the modules you want to install (like Openssl, Mod_auth etc.)
5. After this, we need to make a user and a group for mysql database. Do it from YaST again. Click on "security and users"
6. Create a group (Mysql is a system user and it is already there) named mysql
7. Select "mysql" group and click on edit.
8. Make "mysql" a user of this group (mysql user will be on the right side list)
9. Click finish. Now we have our mysql group and mysql user in this group.
Everything is there, NOTHING is working yet
At this point, your apache won't work if you don't start it manually. Once you start it manaully, php will work (thats a RELIEF!!!! huh??) flawlessly. You can scroll down to see the modules, and you will be glad to see that it is running with all the modules you wanted.
But, the BEAST MySQL is nowhere near to be ready. If you have gone through DAYS and DAYS to look for easy installation of MySQL, you know that you have to type -
$scripts/mysql_install_db
to get all the tables and databases ready. You can't do this with SuSE as
scripts is not there. Fortunately, mysql_install_db is there (in /var/lib/myslq/ folder, later I found).
DON'T issue this command!!!! It will just mess up your life in future. If you do, it will fail as you don't have any permission to create anything in /var/lib/mysql folder. So, you could be
Root and do this. But, that will create these under root and your mysql user won't have any privilage. You can't chown -R the privilages either as you don't have any /data/ folder as in /usr/local/mysql/data (where you have to have your privilages set). Now, you could type
mysql_install_bd --user=mysql to get the MySQL server running as mysql user. Nice Nice!!!
Now, as you know, you have to type
$/var/lib/mysql/mysqld_safe --user=mysql &
to start the server.
It is not going to work. Guaranteed... . You will get a "socket error" of some sort. No matter what you do, you are pretty much TOAST here.
At this point, it was 5:00 am and I had to take a decision of giving it up or call SuSE people. I went to bed totally frustrated and angry, as I couldn't figure out what in heaven is wrong with this. I knew that I was missing something that YaST could do for me as it installed everything by itself.
Next morning, at sqare ONE MySQL is not working yet
I restarted my system to see if my Apache2 starts automatically with PHP. It didn't, BUMMER!!!!
I started digging down to my PILE of instructions I had collected over the week. I had tried
most if not all of these already. All of a sudden, I found an instruction which I thought worth giving a try. It was about something different than MySQL trouble, but, the user was trying to start Apache2 automatically. So, I decided to do it before I fried my brain with MySQL once more. To start apache2 automatically,
1. Fire up YaST
2. Select
system from the left panel
3. Select
runlevel editor from the right side
4. Look at Apache2 on the right side (leftmost column)
5. It should say "No" beside it. If it is a "No" click on Enable button. If it is "Yes" leave it as it is.
at this point, I was just curious to scroll down to check if it has a mysql server entry.
VOILA!!!!! there is one!!!. I almost jumped out of my chair to find this. So, I clicked on "Enable" .... finger crossed.
It didn't work!!! "Whats new???" I thought. "Sun of a gun!!!!" I followed. I restarted my machine to see the effect of Apache2 and it worked. My apache2 daemon was starting during boot up process.
I dug into my papers and found one other link where someone tried to turn on some other service from Runlevel editor in Expert mode. This is where I found my break through. This is what you have to do to get your MySQL running FINALLY!!!!
1. Go to runlevel Editor again.
2. Click on Expert mode
3. Find mysql entry and select it.
4. Click on runlevel 3 and 5
5. Click on Set/Reset button and select
enable the service
6. Click on Start/Stop/Refrest button on the left side and select
start now
It will "Successfully" start mysql daemon this time. WHAT A BREAK!!!!!
Almost there.. finishing up
Now, close YaST and do the following to get things the way you want it to be. These commands are needed in the following order. Don't mess it up. These are for privilages.
$mysql_install_db --user=mysql
$mysql_safe --user=mysql &
$mysqladmin -u root -p
root password
$mysql -u root -p
You will see
mysql> prompt ....
mysql> show databases;
You will see 2 databases... as usual... mysql and test
mysql>quit;
$mysql -u mysql
You will see
mysql> prompt ....
mysql> show databases;
You will see only 1 database ... test ... PERFECT!!!!
mysql>quit;
Back to prompt.
$
YOU ARE DONE!!!!! You can log in using root access to mysql and add users, drop users, give privilages... what ever you want. But, for me, I use phpMyAdmin from my browser. That is another story. If you need to install it and use it, let me know as a reply to this thread. I shall get back to you PRONTO!!!!
During my journey through this exciting, frustrating, upsetting, mindboggling process, I learned a lot from millions of threads posted on the net. But, not a SINGLE thread was this detail and covered all three of these MUST have Softwares on any Server or a Development box. I hope this thread will help a lot of newbies and users of SuSE.
I knew SuSE can fix this using YaST, and I was not wrong. Once more, I scream from the top of my lunx....
SuSE ROX!!!!
Thank you everyone for all the helps I got. See you guys soon with new problems like Baghira or KxDocker ..
Adios y Buena suerte ....