Linux compiled installation php5.4

Source: Internet
Author: User
Tags mcrypt php script fully qualified domain name

Download
wget http://cn2.php.net/distributions/php-5.4.44.tar.gz
Extract
Tar zxvf php-5.4.44.tar.gz
Install some dependent packages in advance
Yum install-y libjpeg-devle libxml2-devel OpenSSL openssl-devel bzip2 bzip2-devel libpng libpng-devel freetype freetype-d Evel Epel-release Libmcrypt
Yum Install-y libmcrypt-devel
To configure the compilation parameters:
CD php-5.4.44
./configure \
--prefix=/u01/php \
--WITH-APXS2=/U01/APACHE2/BIN/APXS \
--WITH-CONFIG-FILE-PATH=/U01/PHP/ETC \
--with-mysql=/u01/mysql \
--with-libxml-dir \
--WITH-GD \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-iconv-dir \
--with-zlib-dir \
--WITH-BZ2 \
--WITH-OPENSSL \
--with-mcrypt \
--ENABLE-SOAP \
--ENABLE-GD-NATIVE-TTF \
--enable-mbstring \
--enable-sockets \
--ENABLE-EXIF \
--disable-ipv6

Possible errors and workarounds
Configure:error:xml2-config not found. Please check your LIBXML2 installation.
The solution is:
Yum Install-y libxml2-devel
There are also errors:
Configure:error:Cannot find OpenSSL ' s <evp.h>
The solution is:

Yum Install-y OpenSSL Openssl-devel

Error:
Checking for BZIP2 in default path ... not found
Configure:error:Please Reinstall the BZIP2 distribution
Workaround:

Yum install-y bzip2 Bzip2-devel

Error:
Configure:error:png.h not found.
Workaround:

Yum install-y libpng Libpng-devel

Error:
Configure:error:freetype.h not found.
Workaround:

Yum install-y FreeType Freetype-devel

Error:
Configure:error:mcrypt.h not found. Please reinstall Libmcrypt.
Workaround:

Yum install-y Epel-releaseyum install-y libmcrypt-devel

Because the CENTOS6 default yum source does not libmcrypt-devel this package, it can only be assisted by the Epel Yum source.

Make&&make Install

To copy a PHP configuration file:

CP Php.ini-production/usr/local/php/etc/php.ini

Modifying the Apache configuration file

Vi/usr/local/apache2/conf/httpd.conf

Found it:
<directory/>
Options FollowSymLinks
AllowOverride None
Order Deny,allow
Deny from all
</Directory>
Switch
<directory/>
Options FollowSymLinks
AllowOverride None
Order Deny,allow
Allow from all
</Directory>
Description: If you do not modify this place, we visit the site will be forbidden to access, display 403.
Then find:
AddType application/x-gzip. gz. tgz
Under this line, add the following:
AddType application/x-httpd-php. php
Note that to support PHP script parsing, you must add the corresponding type.
Find again:
<ifmodule dir_module>
DirectoryIndex index.html
</IfModule>
Change the line to read:
<ifmodule dir_module>
DirectoryIndex index.html index.htm index.php
</IfModule>
Description: Increase the index for PHP, if a site default page is index.php, then you have to add this
Index.php's support.
Find again:
#ServerName www.example.com:80
Modified to:
ServerName localhost:80
If you do not remove #, when you start Apache, there will be a warning message "httpd:could not reliably determine the
Server ' s fully qualified domain name, using Localhost.localdomain for ServerName ", looks like a
Error, actually has no effect.
See if there is a problem with the configuration file:
/usr/local/apache2/bin/apachectl-t
If the Syntax OK is displayed, the configuration is no problem. Then start the service:
/usr/local/apache2/bin/apachectl start
The command to check if Apache starts properly is:
PS aux |grep httpd
See if there is a list of processes.

Linux compiled installation php5.4

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.