Fedora 14: Install apache 2.2.17 and PHP 5.3.4

Follow these steps to install apache on minimal Fedora 14 installation:
Before compiling apache make sure the following is present:

  • The wget utility
  • The make utility
  • A C compiler; or you will get the error configure: error: no acceptable C compiler found in $PATH
  • OpenSSL (if you want to use SSL); or you will get the error configure: error: …No recognized SSL/TLS toolkit detected

Install:

yum install wget make gcc openssl-devel
  • As root go to /usr/src
wget --passive http://mirror.serverius.nl/apache/httpd/httpd-2.2.17.tar.gz
tar -xvzf httpd-2.2.17.tar.gz
cd httpd-2.2.17

Now we are going to run the apache configure script:

Configure with bundled APR:

./configure --prefix=/usr/local/etc/httpd --enable-mime-magic --enable-ssl --enable-cgi --enable-rewrite --enable-so --with-suexec-uidmin=100 --with-included-apr

Configure with bundled APR and mod_dav:

./configure --prefix=/usr/local/etc/httpd --enable-mime-magic --enable-ssl --enable-cgi --enable-rewrite --enable-so --with-suexec-uidmin=100 --with-included-apr --enable-dav
  • Prefix is the filesystem path under which the server should be installed. If not specified, it defaults to /usr/local/apache2
  • mod_mime_magic: Determines the MIME type of a file by looking at a few bytes of its contents
  • mod_ssl: Strong cryptography using the Secure Sockets Layer (SSL) and Transport Layer Security (TLS) protocols
  • mod_cgi: Execution of CGI scripts
  • mod_rewrite: Provides a rule-based rewriting engine to rewrite requested URLs on the fly
  • mod_so: Loading of executable code and modules into the server at start-up or restart time
  • with-suexec-uidmin: Define this as the lowest UID allowed to be a target user for suEXEC. For most systems, 500 or 100 is common. Default value is 100
  • Optional: mod_dav: mod_dav is an Apache module to provide DAV capabilities for your Apache web server

After the configure we are going to build apache:

make

When the compilation process has completed we can start the installation of apache:

make install

Change the user Apache is running:

vi /usr/local/etc/httpd/conf/httpd.conf
User daemon
Group daemon

 After a successful installation we can start apache:

/usr/local/etc/httpd/bin/apachectl start

If you get the error: httpd: apr_sockaddr_info_get() failed for domain, add 127.0.1.1 domain to /etc/hosts.

For easy access you can add the following to the PATH:

vi /etc/profile.d/path.sh
PATH="$PATH:/usr/local/etc/httpd/bin/"

Before building php make sure the following is present:

  • Perl
  • libpng
  • libjpeg
  • freetype
  • zlib
  • libxml
  • bzip2
  • libcurl
  • tidy

Install libraries:

yum install perl libpng-devel libjpeg-devel freetype-devel libxml2-devel bzip2-devel curl-devel libtidy-devel

Now we are going to install PHP 5.3.4. First stop apache if it is running:

/usr/local/etc/httpd/bin/apachectl stop
  • As root go to /usr/src
wget --passive http://nl3.php.net/get/php-5.3.4.tar.gz/from/nl.php.net/mirror
tar -xvzf php-5.3.4.tar.gz
cd php-5.3.4

Now we are going to run the php configure script:

./configure --prefix=/usr/local/etc/httpd/php --with-apxs2=/usr/local/etc/httpd/bin/apxs --with-config-file-path=/usr/local/etc/httpd/php --enable-sockets --with-zlib --with-gd --with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib --with-freetype-dir=/usr/lib --enable-exif --enable-mbstring --with-openssl --enable-ftp --enable-soap --with-bz2 --with-gettext --with-curl --with-tidy --enable-zip
  • –with-apxs[=FILE]: Build shared Apache 2.0 module. FILE is the optional pathname to the Apache apxs tool; defaults to apxs
  • –with-config-file-path=PATH: Sets the path in which to look for php.ini, defaults to PREFIX/lib
  • –enable-sockets: enable socket support. If sockets are not pre-compiled with PHP, you may have to dynamically load the socket extension, by uncommenting this line: ;extension=sockets.so. The socket extension implements a low-level interface to the socket communication functions, providing the possibility to act as a socket server as well as a client
  • –with-mysql[=DIR]: [DIR] points to the MySQL installation directory. For example: –with-mysql=/usr/local/mysql. In PHP 5.3.0 and above the MySQL-related database extensions use the MySQL Native Driver by default. This means that the MySQL Client Library (libmysql) is no longer required in order to support connection to a MySQL database. The extensions mysql, mysqli, and PHP_PDO_MYSQL are all enabled by default in PHP 5.3.0+. In each case no further installation steps are required in order to use these extensions, although you may want to set some preferences in php.ini depending on your requirements
  • –with-zlib[=DIR]: enable zlib support. This module enables you to transparently read and write gzip (.gz) compressed files
  • –with-gd[=DIR]; enable GD-support. Where DIR is the GD base install directory. To use the recommended bundled version of the GD library (which was first bundled in PHP 4.3.0), use the configure option –with-gd. GD library requires libpng and libjpeg to compile
  • –with-zlib-dir[=DIR]. Where DIR is the ZLib base install directory. libpng requires the zlib library
  • –enable-exif: enable exif-support. With the exif extension you are able to work with image meta data
  • –enable-mbstring: Enable mbstring functions. This option is required to use mbstring functions
  • –with-openssl[=DIR]. Enable OpenSSL support
  • –enable-ftp. Enable FTP functions
  • –with-mcrypt[=DIR]. Enable mcrypt. DIR is the mcrypt install directory. This is an interface to the mcrypt library, which supports a wide variety of block algorithms
  • –with-dom[=DIR]. This extension is enabled by default
  • –enable-soap: enable SOAP support
  • –with-bz2[=DIR]: enable Bzip2 support. DIR is the bzip2 install directory
  • –with-gettext[=DIR]. DIR is the gettext install directory. The gettext functions implement an Native Language Support API which can be used to internationalize your PHP applications
  • –with-curl[=DIR].  DIR is the location of the directory containing the lib and include directories. In the include directory there should be a folder named curl which should contain the easy.h and curl.h files. There should be a file named libcurl.a located in the lib directory. Curl is a library that allows you to connect and communicate to many different types of servers with many different types of protocols
  • –with-tidy. This extension is bundled with PHP 5 and greater. Tidy is a binding for the Tidy HTML clean and repair utility which allows you to not only clean and otherwise manipulate HTML documents, but also traverse the document tree
  • –with-zip[=DIR]. DIR is the prefix of the ZZIPlib library install

In PHP 5.3.0 and above the MySQL-related database extensions use the MySQL Native Driver by default. This means that the MySQL Client Library (libmysql) is no longer required in order to support connection to a MySQL database. The extensions mysql, mysqli, and PHP_PDO_MYSQL are all enabled by default in PHP 5.3.0+, and all use the MySQL Native Driver by default. In each case no further installation steps are required in order to use these extensions, although you may want to set some preferences in php.ini depending on your requirements.

If you get the error:

./configure: /usr/local/etc/httpd/bin/apxs: /replace/with/path/to/perl/interpreter: bad interpreter: No such file or directory
configure: error: Aborting

vim /usr/local/etc/httpd/bin/apxs
 
Replace first line of from,
 
#!/replace/with/path/to/perl/interpreter
 
with
 
#!/usr/bin/perl -w

Leave a Reply