I tried sometime to install apache and configure php to work with it.I have some things to share.I have noted the steps I followed and found out the answers to few questions that came into my mind.See if this helps you.
Installation Instructions (Apache Shared Module Version) for PHP
Download the Packages:
1. First download the required packages to a directory.
Apache Download (http://httpd.apache.org/)
PHP Download (http://www.php.net/downloads.php)
MySql? Download (http://dev.mysql.com/downloads/)
2.
Extract the Apache and PHP Packages into that directory:
tar xfz apache_xxx.tar.gz
tar xfz php_xxx.tar.gz
Installing Apache with PHP:
Following are the steps to install Apache and PHP in the directory /usr/local/apache
1.
Go to Apache src directory
cd apache_xxx
2. ./configure --prefix=/usr/local/apache
3.
Go to PHP src directory
cd php-xxx
4.
./configure --with-mysql \
--with-xml \
--enable-track-vars \
--with-apache=../apache_xxx \
5. make
6. make install
If you decide to change your configure options after installation, you only need to repeat the last three steps. You only need to restart apache for the new module to take effect. A recompile of Apache is not needed.
Note that unless told otherwise, 'make install' will also install PEAR, various PHP tools such as phpize, install the PHP CLI, and more.
In Apache src directory
1.
./configure --prefix=/usr/local/apache \
--enable-module=rewrite \
--activate-module=src/modules/php4/libphp4.a
2. make
3. make install
This will install Apache in the /usr/local/apache directory.
Configuring Apache and PHP
1.
To configure PHP copy php.ini-dist which is in the PHP src directory to /usr/local/lib/php.ini
cp php.ini-dist /usr/local/lib/php.ini
2. Edit this file setting the options you wish, generally nothing needs to be edited. However, you can set various options such as a default MySQL username and password. If you prefer your php.ini in another location, use --with-config-file-path=/some/path while configuring PHP with the command ./configure .
3.
To configure Apache edit /usr/local/apache/conf/httpd.conf and set the your document directory and any other Apache settings you may want.
The path on the right hand side of the LoadModule? statement must point to the path of the PHP module on your system.
For PHP 4
LoadModule php4_module libexec/libphp4.so
For PHP 5
LoadModule php5_module libexec/libphp5.so
4.
And in the AddModule? section of httpd.conf, somewhere under the ClearModuleList?, add this:
For PHP 4
AddModule mod_php4.c
For PHP 5
AddModule mod_php5.c
5.
Tell Apache to parse certain extensions as PHP.
To enable Apache and PHP to work together the following line needs to be added
AddType application/x-httpd-php .php
Look for this line or something similar already in the httpd.conf file and replace it with the above. Make sure to remove the # comment mark.
6. After editing the config file you need to restart Apache. The command to restart Apache is:
/etc/rc.d/init.d/httpd restart
---------------
Investigate few issues?
1. Do we get RPM for both installations?
2. is /usr/local/apache directory is already been there before installing apache?
3. What is other path to apache config file except /usr/local/apache/conf/httpd.conf?
1. Do we get RPM for both installations?
RPM:
The RPM Package Manager (RPM) is a powerful command line driven package management system capable of installing, uninstalling, verifying, querying, and updating computer software packages. Each software package consists of an archive of files along with information about the package like its version, a description, and the like. There is also a related API ("Application Program Interface"), permitting advanced developers to bypass 'shelling out' to a command line, and to manage such transactions from within a native coding language.
RPM For Apache:
Almost identical to a binary, an RPM is further customized to play nicely with other RPMs and provide a consistent interface to installing, updating, and removing binaries.
To find out whether an Apache RPM is installed or not, at the shell prompt, type
rpm -qa | grep apache
To get Apache RPM
ftp://ftp.redhat.com/pub/redhat/current/i386/RedHat/RPMS
First became a root user by using command su and then type the following command
rpm -ivh apache-1.3.9-4.i386.rpm
RPM For Php:
We get RPM for PHP.
2. is /usr/local/apache directory is already been there before installing apache?
If we install Apache maually then we need to create the directories for Apache.
# mkdir /usr/local/apache
# chmod 755 /usr/local/apache
# cd /usr/local/apache
# mkdir conf logs
# chmod 755 conf logs
3. What is other path to apache config file except /usr/local/apache/conf/httpd.conf?
/usr/local/apache/etc/httpd.conf
To actually run Apache, you execute the apachectl script. Assuming you used the default directories when you built Apache, the full command line would be:
/usr/local/apache/sbin/apachectl start
You would use apachectl stop to stop the server, and apachectl restart to restart it. If you want Unix to automatically start Apache whenever the computer boots up, copy the apachectl file into the /etc/rc.d/init.d directory.
Is that good ?
I am trying to talk to you friends about the things I like or are useful to me , please tell me if these are good or not.
Thursday, February 14, 2008
Subscribe to:
Posts (Atom)