Content

blog, portfolio, and links

Linux tribulations

Monday 30 January 2006 - Filed under Default

Today was a big day for me and Linux. I started the day with a Linux web server with PHP but no MySQL. That’s a LAP server for all you techies. Pretty decent for serving static pages but not too great when it comes to doing anything with data.

Never had MySQL working on this thing so I did a “yum install MySQL-server” to install MySQL. Then it was time to start this server up! Nothing. Well, not nothing. I got an error and a message that MySQL ended. Did a little searching and found a thread on this problem recommending that SELinux was the problem. It was keeping MySQL from accessing it’s database storage files. I used the command “setenforce 0” and all was well. I’m not sure if that’s a permanent change but hopefully it is. (A tip I got in my chatroom was to use “tail -f /path/to/logfile” to watch a file when something’s going wrong. It shows you a live view of the log so you’ll want to open it in a separate terminal)

Once I had the MySQL server running, I set a new password and I thought I’d install phpmyadmin to see if I could control it using the web interface I’m so familiar with. Not so fast bucko. PhpMyAdmin complained that MySQL support was not available to PHP! I created a test script to show me phpinfo() and then saw that PHP was compiled with –with-MySQL=shared,/usr

That’s supposed to mean that MySQL support is loaded as an extension to PHP but I could not find a suitable extension on my system. So I thought, I’ll just compile PHP. I downloaded the latest stable source for PHP4, compiled it, configured it and tested my PhpMyAdmin again. Nothing. Seems PHP was compiled into apache so my changes really didn’t take effect.

Finally, I decided to compile apache and PHP from source. Apache would be compiled to load PHP as a module and PHP would be compiled with built-in support for MySQL. I downloaded and compiled apache 2 from source. Once both of those were built and installed, I manually added lines to the httpd.conf to activate PHP. At this point, things were running well. I had a LAMP server!

I could use PhpMyAdmin but unfortunately so could anyone else with access to my webserver.
The solution to that: add .htaccess to the PhpMyAdmin folder so a username and password are required to get in there. It’s been a great learning experience and I kind of want to do it again on another box to see just how much of what I’ve learned applies to my next LAMP setup.

2006-01-30  »  David Sterry