|
|
|
|
| |
Frankly speaking, writing such a manual has never occurred to me. With so many articles written on the topic I was sure that there is no place for another one.
Nevertheless, endless requests convinced me to change my mind. The following article is focused on the installation process of Apache, PHP and MySQL for which some basic knowledge of Unix OS is required.
The process starts with downloading of three files and saving them in /usr/local/src directory. The files are as follows:
httpd-2.0.47.tar.gz http://httpd.apache.org/download.cgi
php-4.3.3.tar.gz http://www.php.net/downloads.php
mysql-4.0.16.tar.gz http://www.mysql.com/get/Downloads/MySQL-4.0/mysql-4.0.16.tar.gz/from/pick#mirrors
The next step involves Apache installation according to the instructions listed below:
1. create a group named websrv
[[email protected]]#groupadd websrv
2. add a user with minimum privileges
[[email protected]]#adduser websrv -g websrv -s /sbin/nologin -d /usr/local/apache
3. unpack a source archive
[[email protected]]#tar -zxvf httpd-2.0.47.tar.gz
4. enter the unpacked directory
[[email protected]]#cd httpd-2.0.47
5. configure the Apache server with DSO support
[[email protected]]#./configure --prefix=/usr/local/apache --enable-mods-shared=all --enable-so
6. compile the sources
[[email protected]]#make
7. install the compiled binaries and other files
[[email protected]]#make install
8. add the line "/usr/local/apache/modules" into /etc/ld.so.conf
[[email protected]]#echo "/usr/local/apache/modules" >> /etc/ld.so.conf
9. create cache & links for shared libs
[[email protected]]#ldconfig
The following operations requires your intent attention:
10. open /usr/local/apache/conf/httpd.conf using your favorite editor, find AddType directive and add after it the following lines:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Note: after the .php extension you can add as much other extensions as you wish in accordance with the syntax: AddType MIME-type extension [extension] [extension]...
11. find DirectoryIndex Directive and set the list of files to look for. The server will return the first available one. In the further example, index.php will be shown if it exists, otherwise the server will look for index.html:
DirectoryIndex index.php index.html
12. find User Directive and Group Directive. Change whatever you have there to:
User websrv
Group websrv
13. double check your changes, save the file and move forward.
14. change Apache ownership to websrv.websrv
[[email protected]]#chown -R websrv.websrv /usr/local/apache
MySQL installation:
1. create a group named mysql
[[email protected]]#groupadd mysql
2. add a user with minimum privileges
[[email protected]]#adduser mysql -g mysql -s /sbin/nologin -d /usr/local/mysql
3 unpack a source archive
[[email protected]]#tar -zxvf mysql-4.0.16.tar.gz
4. enter the unpacked directory
[[email protected]]#cd mysql-4.0.16
5. configure the MySQL server with all charsets
[[email protected]]#./configure --prefix=/usr/local/mysql --with-charset=latin1 --with-extra-charsets=all
6. compile the sources
[[email protected]]#make
7. install the compiled binaries and other files
[[email protected]]#make install
8. add the line "/usr/local/mysql/lib/mysql" into /etc/ld.so.conf
[[email protected]]#echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
9. create cache & links for shared libs
[[email protected]]#ldconfig
10. create and install default MySQL databases
[[email protected]]#/usr/local/mysql/bin/mysql_install_db
11. make a symbolic link for mysql binary
[[email protected]]#ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
12. make a symbolic link for mysqladmin binary
[[email protected]]#ln -s /usr/local/mysql/bin/mysqladmin /usr/bin/mysqladmin
13. change MySQL ownership to mysql.mysql
[[email protected]]#chown -R mysql.mysql /usr/local/mysql
PHP installation:
1. unpack a source archive
[[email protected]]#tar -zxvf php-4.3.3.tar.gz
2. enter the unpacked directory
[[email protected]]#cd php-4.3.3
3. configure PHP as Apache module with MySQL support
[[email protected]]#./configure --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql
4. compile the sources
[root@s[email protected]]#make
5. install the compiled Apache module
[[email protected]]#make install
6. copy php.ini-dist to /usr/local/lib/php.ini
[[email protected]]#cp ./php.ini-dist /usr/local/lib/php.ini
7. Give Apache ownership to websrv.websrv
[[email protected]]#chown -R websrv.websrv /usr/local/apache
** On some systems, there is no ld.so.conf file, or it is not in use. You can use LD_LIBRARY_PATH environment variable to specify additional directories where shared libs can be found.
If you use tcsh compatible shell you should add the line below to the .tcshrc file in your home dir:
setenv LD_LIBRARY_PATH $LD_LIBRARY_PATH:/usr/local/mysql/lib/mysql:/usr/local/apache/modules
For bash compatible shell you should add the following lines to the .bash_profile file in your home dir:
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/mysql/lib/mysql:/usr/local/apache/modules
export LD_LIBRARY_PATH
Then, check what you have in the library loading path:
echo $LD_LIBRARY_PATH
There is only one open question left: how to startup MySQL and Apache servers?
It's very simple:
[[email protected]]#/usr/local/apache/bin/apachectl start
[[email protected]]#/usr/local/mysql/share/mysql/mysql.server start
(For bringing these servers down, you can use the commands mentioned above replacing start with stop)
To test your installation, create in /usr/local/apache/htdocs directory the php file:
index.php
<?
phpinfo();
?>
Load it in your browser: http://localhost/index.php
Then, you should see PHP Configuration settings.
To be continued... |
|
| |
| Beginners guide to PHP and MySQL Categories : PHP, Beginner Guides, Databases, MySQL, Installation | | | Counting - Creating a more sophisticated GIF based counter using PHP and MySQL Categories : Beginner Guides, MySQL, PHP, To PHP, To MySQL | | | Jump Start to Easy URLs Categories : PHP, Beginner Guides, MySQL, File System, To PHP | | | Beginners guide to PHP and MySQL - Creating a simple guest book Categories : Beginner Guides, To PHP, To MySQL, PHP, MySQL | | | How To add paging (Pagination) with PHP and MySQL Categories : PHP, Beginner Guides, Databases, MySQL, HTML and PHP | | | Counting - Creating a simple counter Categories : PHP, MySQL, Beginner Guides, To PHP, To MySQL | | | Counting - Creating a GIF based counter using PHP and MySQL Categories : Beginner Guides, PHP, To PHP, To MySQL, MySQL | | | Creating an IE-Only Database Driven Menu System With PHP, MySQL and DHTML Categories : PHP, MySQL, Databases, DHTML | | | PHP 101 Part 15 of 15 : No News Is Good News Categories : PHP, Beginner Guides, Content Management | | | Who's Linking? Categories : PHP, Beginner Guides, To PHP | | | PHP, MySQL and Authentication 101 Categories : PHP, Databases, MySQL, Authentication | | | PHP 101 Part 5 of 15 : Rank And File Categories : PHP, Beginner Guides, Filesystem | | | Building A Persistent Shopping Cart With PHP and MySQL Categories : PHP, MySQL, Databases, Ecommerce | | | Case Study: Handling MySQL Growth With a PHP Class Categories : Databases, MySQL, PHP | | | Practical Date and Time examples with PHP and MySQL Categories : Databases, MySQL, PHP, Date/time | |
| | | | Rurouni Alucard wrote : 393 Hey Mr. Igal i think you don't have any Idea about how MUCH
this tutorial has help me xDDD ..
Thank you very much! | |
|
|
|