How to install PHP

By | March 16, 2016

PHP Installation

PHP is a server-side scripting language designed for web development.

Download php-4.3.4.tar.gz from one of the mirrors at http://www.php.net/downloads.php


# tar xvzf php-4.3.4.tar.gz
# cd php-4.3.4
export CFLAGS=”-O2 -march=i686 -funroll-loops -D_REENTRANT -fPIC”
export LIBS=”-lttf -lfreetype -ljpeg -lz -lnsl”
export EXTENSION_DIR=/usr/lib/php4
./configure \
–prefix=/usr \
–with-layout=GNU \
–with-config-file-path=/etc/httpd \
–enable-force-cgi-redirect \
–with-apxs2=/usr/sbin/apxs \
–with-exec-dir=/usr/bin \
–with-openssl \
–with-zlib \
–with-gd \

–with-zlib-dir=/usr/include \
–with-ttf \
–with-png \
–with-jpeg-dir=/usr \
–with-png-dir=/usr \
–with-freetype-dir=/usr \
–with-pear=/usr/share/pear \
–with-mysql=/usr/mysql \
–with-mysql-sock=/tmp/mysql.sock \
–disable-debug \
–disable-rpath \
–disable-posix \
–enable-pic \
–enable-discard-path \
–enable-safe-mode \
–enable-magic-quotes \
–enable-bcmath \
–enable-dio \
–enable-track-vars \
–enable-inline-optimization \
–enable-memory-limit
# make
# make install
# ln -sf /usr/lib/httpd/build/libtool /home/httpd/build/libtool
# install -m0644 php.ini-dist /etc/httpd/php.ini
# strip –strip-debug -R .comment /usr/lib/php4/*.s


The default php.ini file is set up for development purposes and not a secure web server.
The following changes to /etc/httpd/php.ini could cause errors in your PHP code so it is recommended to make a backup copy of the file for troubleshooting purpose.

# cp /etc/httpd/php.ini /etc/httpd/php.ini.bak


 

# vi +85 /etc/httpd/php.ini

Change
y2k_compliance = On
to
y2k_compliance = Off


 

# vi +117 /etc/httpd/php.ini

Change
zlib.output_compression = Off
to
zlib.output_compression = On


 

# vi +154 /etc/httpd/php.ini

Change

allow_call_time_pass_reference = On
to
allow_call_time_pass_reference = Off


# vi +223 /etc/httpd/php.ini

Change
expose_php = On
to
expose_php = Off


# vi +277 /etc/httpd/php.ini

Change
display_errors = On
to
display_errors = Off


# vi +287 /etc/httpd/php.ini

Change
log_errors = Offs
to
log_errors = On


# vi +311 /etc/httpd/php.ini

Change
;html_errors = Off
to
html_errors = Off


# vi +332 /etc/httpd/php.in

Change
;error_log = syslog
to
error_log = syslog
Add the following line to /etc/httpd/conf/httpd.conf
AddType application/x-httpd-php .php .php4 .php3 .phptml


# /etc/init.d/httpd restart

 

 

 

 

 

Leave a Reply

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