How to configure Php with Http

Published on Author bloggereight1 Comment

PHP with HTTP2 on Linux.

# yum install bzip*
# yum install libjpeg-devel
# yum install libpng*
# yum install gmp-devel*
# yum install ncurses-devel*
# yum install pspell-devel
# yum install curl*
# yum install gcc*
# yum install libxml2*
# yum install gdbm*

Download this package or latest.

# wget
# wget

# tar -zxvf httpd-2.2.10.tar.gz
# tar -zxvf php-5.2.6.tar.gz

# cd httpd-2.2.10

# ./configure –prefix=/usr/local/apache –enable-so –enable-cgi–enable-info –enable-rewrite –enable-speling–enable-usertrack –enable-deflate –enable-ssl –enable-mime-magic

# make

# make install

# cd ../php-5.2.6

# ./configure  –with-apxs2=/usr/local/apache/bin/apxs –prefix=/usr/local/apache/php –with-config-file-path=/usr/local/
apache/php –enable-force-cgi-redirect –disable-cgi –with-zlib –with-gettext –with-gdbm –with-curl=/usr/bin/curl –with-gd –with-jpeg-dir=/usr/lib –enable-wddx –enable-sysvsem –enable-sysvshm –enable-sockets –enable-shmop –with-openssl –with-bz2 –with-pspell –with-ncurses –with-gmp –enable-ftp  –enable-exif –enable-bcmath –enable-calendar

# make
# make install

# cp -p .libs/ /usr/local/apache/modules
# cp -p php.ini-recommended /usr/local/apache/php/php.ini

# vi /usr/local/apache/conf/httpd.conf

Make sure the following paramets are present
LoadModule php5_module        modules/
AddHandler php5-script php
DirectoryIndex index.html index.php
AddType text/html       php
AddType application/x-httpd-php-source phps

# /usr/local/apache/bin/apachectl start

# /usr/local/apache/bin/httpd -t

# cd /usr/local/apache/htdocs

# vi info.php

Add the following entrys in the file exactly.

<title>PHP Test</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=ISO-8859-1″>
<h1>PHP Test</h1>
<b>An Example of PHP in Action</b><br />
<?php echo “The Current Date and Time is: <br>”;
echo date(“g:i A l, F j Y.”);?>

<h2>PHP Information</h2>
<?php phpinfo(); ?>


In browser, type



To re Compile PHP for mysql support,

# yum install mysql*

# cd php-5.2.6

# vi config.status

# ./configure  –with-apxs2=/usr/local/apache/bin/apxs –prefix=/usr/local/apache/php –with-config-file-path=/usr/local/apache/php –enable-force-cgi-redirect –disable-cgi –with-zlib –with-gettext –with-gdbm –with-curl=/usr/bin/curl –with-gd –with-jpeg-dir=/usr/lib –enable-wddx –enable-sysvsem –enable-sysvshm –enable-sockets –enable-shmop –with-openssl –with-bz2 –with-pspell –with-ncurses –with-gmp –enable-ftp –enable-exif –enable-bcmath –enable-calendar

Add the –with-mysql in the last.


# ./configure –with-apxs2=/usr/local/apache/bin/apxs –prefix=/usr/local/apache/php –with-config-file-path=/usr/local/apache/php –enable-force-cgi-redirect –disable-cgi –with-zlib –with-gettext –with-gdbm –with-curl=/usr/bin/curl –with-gd –with-jpeg-dir=/usr/lib –enable-wddx –enable-sysvsem –enable-sysvshm –enable-sockets –enable-shmop –with-openssl –with-bz2 –with-pspell –with-ncurses –with-gmp –enable-ftp –enable-exif –enable-bcmath –enable-calendar –with-mysql

# make

# /usr/local/apache/bin/apachectl stop

# make install

# cp -p .libs/ /usr/local/apache/modules

# cp -p php.ini-recommended /usr/local/apache/php/php.ini

# /usr/local/apache/bin/apachectl start





One Response to How to configure Php with Http

  1. I also agree that it is not good to be loading PHP for every style sheet. If you load one PHP page with two dyanmic’ style sheets, that’s 3 PHP calls for every loaded page, for every visitor. That will add up real quick if/when your website starts to pull traffic.The best thing to do is leave the stylesheets static. If you need to add dyanmic style information, include it in the actual web page in style tags.cigraphics is on the right track for re-generating static style sheets when changes are made to the website, but then you have to worry about browsers caching their CSS sheets because they are expected to be static. I know there are workarounds for that, but why worry about it? Just include any dyanmic content in the main web page.

Leave a Reply

Your email address will not be published. Required fields are marked *