Need to set up a web server with MySQL and PHP support? That's exactly what I needed to do when I
decided to create a photo gallery using the gallery2 open source software package. Prior to using VL, I actually did the equivalent in Windows using gallery2 and the wamp open source package. However, using VL lets me dedicate an old PIII-800 to web server duties with VL running nicely on the Pentium III.
Below is how I got AMP (Apache, MySQL, and PHP) up and running under VectorLinux 5.9 Gold Standard.
This information is based on the Slackware guide for AMP athttp://www.linuxquestions.org/questions/slackware-14/slackware-guide-for-amp-apache-mysql-and-php-311344/
First I Installed httpd, MySQL, and PHP using GSLAPT
httpd was 2.2.8-i486-1_slack12.0.tgz
mysql was 5.051-i486-1_slack12.0.tgz
php was 5.2.6-i486-1_slack12.0.tgz
all 3 came from fromhttp://slackware.mirrors.tds.net/pub/slackware/slackware-12.0/
create a group called mysql
create user mysql (if doesn't exist.. to see if it does,
type su - mysql).
If it says "Unknown id: mysql" then that user does not exist.
(note: this user was alrady present in my system)
useradd -g mysql mysql
give user mysql access
chown -R mysql.mysql /var/lib/mysql
install a database from user mysql
su - mysql
create a my.cnf file
cp /etc/my-medium.cnf /etc/my.cnf
keep the socket in /var/run/mysql/, its more secure than /tmp
don't modify anything else
chmod +x /etc/rc.d/rc.mysqld
su - mysql
set a password for mysql root user
/usr/bin/mysqladmin -u root password 'new-password'
Download mysqlcc 0.9.8 from sourceforge and compile it per
the instructions that come with it.
cd mysqlcc-0.9.8-src/ (had this directory inside my home - the location mysqlcc was compiled in)
file > new
socket file: /var/run/mysql/mysql.sock
click on test, it should be successful
If you need to create a database for a specific application,
such as gallery2, then do the following:
su - mysql (using mysql user at this point)
mysql -h localhost -u root -p (connect to mysql server)
Then enter your mysql root password when promted
Then you will see somethinglike the following:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.0.51-log Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
At the mysql prompt above, type SHOW DATABASES; including
the semicolon to see what databases are already present
and to make sure the one you want to create is not already
next at the mysql prompt, type CREATE DATABASE gallery2;
(or whatever your new database is)
SHOW DATABASES; will show the newly created database
in the list.
quit at the mysql> prompt will drop the connection
exit will then exit out of the mysql user
edit httpd.conf and make sure this line is at the
bottom of the file
make sure the line looks similar to this
LoadModule php5_module usr/lib/httpd/modules/libphp5.so
start apache & php
(had to right click rc.httpd in Thunar running
as root and make the file executable first)
When started, go to your web browser, and go tohttp://localhost
you should see a website. Good.
next test php
create a file called test.php and add the following to it
<? phpinfo(); ?>
You should now be able to see all the php configurations.
If you search for mysql, you won't find it.
Let us link mysql to apache and php now.
go back to /etc/apache2, and edit php.ini
search for mysql
ctrl + w mysql
uncomment the line ;extension=mysql.so by removing the ';'
refresh the http://localhost/test.php
and search for mysql
now you will find it halfway through the webpage.