Setup Apache2, MySQL5, PHP5 on Unix
Setup Apache2, MySQL5, PHP5 on Unix
Setup Apache2, MySQL5, PHP5
Setup MySQL
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
shell> cd mysql-VERSION
shell> ./configure --prefix=/usr/local/mysql
shell> make
shell> make install
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> cd /usr/local/mysql
shell> bin/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql var
shell> chgrp -R mysql .
shell> bin/mysqld_safe --user=mysql &
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/local/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h linux-x86 password 'new-password'
You can start the MySQL daemon with:
cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &
Setup Apache2.
cd /usr/local/src
tar -zxvf httpd-2.0.53.tar.gz
cd httpd-2.0.53
./configure --prefix=/usr/local/apache2 --enable-so --enable-auth-digest --enable-rewrite --enable-setenvif --enable-mime --enable-deflate --enable-headers
make
make install
Next we have to modify (alter) main Apache config file located at /usr/local/apache2/conf/httpd.conf (this also assumes your web root is located at /home/www):
DocumentRoot "/home/www"
And we well add support for PHP 5 (as a module):
LoadModule php5_module modules/libphp5.so
DirectoryIndex index.html index.htm index.php
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
We also have to allow / create basic mod_rewrite rules:
Options Indexes Includes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
And dissalow clients to access .htaccess:
Order allow,deny
Deny from all
Setup PHP5
cd /usr/local/src
tar -jxvf php-5.0.3.tar.bz2
cd php-5.0.3
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql-sock=/tmp/mysql.sock --with-sqlite --enable-sqlite-utf8 --with-zlib --with-zlib-dir --with-bz2 --with-gd --enable-gd --enable-gd-native-ttf --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-ttf --with-freetype-dir=/usr/local --with-iconv=/usr/local --with-curl=/usr/local --enable-track-vars --with-gettext --with-config-file-path=/usr/local/apache2/conf --enable-trans-id --enable-ftp --with-cpdflib=/usr/local --enable-mbstring --with-openssl=/usr/local
make
make install
cp php.ini-dist /usr/local/apache2/conf/php.ini
Next, we have to modify PHP configuration in file /usr/local/apache2/conf/php.ini, including basic PHP security settings:
mysql.default_socket = /tmp/mysql.sock
short_open_tag = Off
register_globals = Off
allow_url_fopen = Off

0 Comments:
Post a Comment
<< Home