Machine environment rhel3: Some RPM packages, such as GCC and make, are installed during system installation.
1. install Apache
1. Download Apache
2. Extract
Tar-xzvf httpd-2.0.63.tar.gz
3. Enter the Directory
CD httpd-2.0.63
4. Configuration
Some options
-- Prefix installation directory
-- Enable-modules enable DSO (dynamic module) configuration (-- enable-so is equivalent to -- enable-module = So)
-- Enable-Rewrite to enable URL rewriting
-- Enable-Dav
SVN requires this option: otherwise, an error is returned.
Httpd: syntax error on line 58 of/usr/local/apache2/CONF/httpd. conf: cannot load/usr/local/apache2/modules/mod_dav_svn.so into server:/usr/local/apache2/modules/mod_dav_svn.so: Undefined Symbol: dav_register_provider
(-- Enable-Dav -- enable-so -- prefix SVN requires at least these items)
-- Enable-maintainer-mode enable extended dependency check and compilation warning
Run the command to enter the configuration
./Configure -- prefix =/usr/local/Apache -- enable-Rewrite -- enable-Dav -- enable-so -- enable-maintainer-Mode
5. Compile and install
Make
Make install
6. Related Directories
/Usr/local/Apache as the base Directory
Bin/some commands
Cgi-bin/cgi File
Htdocs/Webpage files
Conf/httpd. conf configuration file
Logs/log file
7. Start and Stop
/Usr/local/Apache/bin/apachectl start/stop/restart
8. Automatic Start
VI/etc/rc. d/rc. Local
Join
/Usr/local/Apache/bin/apachectl start
Ii. install PHP
1. Download
2. Extract
Tar-xzvf php-5.2.8.tar.gz
CD php-5.2.8
3. Configuration
In addition to basic functions, some extension functions of PHP are provided by independent modules. To enable PHP to support these functions, you must add related options during compilation (see the corresponding installpage in http://cn.php.net/manual/en/funcref.php)
For example:
MySQL: functions used to access the MySQL database
Curl: HTTP access library
Ibxml2: XML Parsing Library
Zlib: open-source compression library
Pcntl: process control library
Iconv: character encoding conversion function
Shmop: Shared Memory Operation Function
Sysvsem: semaphore related functions
Sysvmsg: message exchange function
Run the following command:
. /Configure -- prefix =/usr/local/PHP -- with-apxs2 =/usr/local/Apache/bin/apxs -- With-mysql =/usr/local/MySQL/-- With-curl =/usr/local/curl -- enable-FTP -- With-libxml-Dir =/usr/local/libxml2 -- With-expat-Dir =/usr/lib -- enable-soap -- with-zlib-Dir =/usr/lib -- enable-mbstring -- With-iconv =/usr/local/iconv -- enable-shmop -- enable-sysvsem -- enable-sysvmsg
4. Compile and install
Make
Make install
5. Copy the configuration file
Because PHP. ini files are not automatically generated, you should copy them.
CD php-5.2.8
Cp php. ini-Dist/usr/local/PHP/lib/PHP. ini
6. Configure httpd. conf
VI/usr/local/Apache/CONF/httpd. conf
After PHP is installed, the following line is automatically added to httpd. conf (if not, add it manually ):
Loadmodule php5_module modules/libphp5.so
Find addtype application/X-gzip. GZ. tgz and add the following content under it:
Addtype application/X-httpd-PHP. php
Addtype application/X-httpd-PHP-source. PHPs
Restart Apache
/Usr/local/Apache/bin/apachectl restart
7. Some problems during installation
(1) Configure: Error: libxml2 version 2.6.11 or greater required.
The version of libxml2 is too low. Download and update later versions.
Rpm-IVH -- force libxml2-2.6.16-1.1.el3.rf.i386.rpm
Libxml2-python-2.6.16-1.1.el3.rf.i386.rpm
Libxml2-devel-2.6.16-1.1.el3.rf.i386.rpm
(2) No related libraries, such as libiconv
Download and install, such as: libiconv-1.12.tar.gz
./Configure -- prefix =/usr/local
Make
Make install
(3)/usr/lib/MySQL/libmysqlclient. So: no such file or directory
It is because the libmysqlclient. So file cannot be found in/usr/lib/MySQL, possibly because:
1. mysql-shared-community (MySQL shared library is not installed)
Rpm-IVH MySQL-shared-community-5.1.35-0.rhel3.i386.rpm
2. If the file cannot be found after it is installed, find the libmysqlclient. So file. Generally, create a symbolic link under/usr/lib.
Ln-S/usr/lib/libmysqlclient. So/usr/lib/MySQL/libmysqlclient. So, you can solve the problem.
8. Test
Write a test. php file and put it in/usr/local/Apache/htdocs.