[Lamp Environment Building three] PHP Installation

Source: Internet
Author: User
Tags mcrypt zts


Description: See it all again before you start the installation * * *

Get PHP Source Package Http://cn2.php.net/get/php-5.5.10.tar.gz/from/this/mirror
Wget

Installing Libxml2:wget ftp://xmlsoft.org/libxml2/libxml2-2.9.1.tar.gz
./configure--PREFIX=/USR/LOCAL/LIBXML2
# yum-y Install Python-devel

Installing Zlib:wget http://zlib.net/zlib-1.2.8.tar.gz
./configure--prefix=/usr/local/zlib
/*
Installing Libpng:wget Http://sourceforge.net/projects/libpng/files/libpng16/1.6.10/libpng-1.6.10.tar.gz/download
Tar
Cd
CP Scripts/makefile.linux Makefile
Make
Make install
Note: The makefile here is not generated by the./configure, but is copied directly from the script/directory, and at the end of this step, libpng is installed under/usr/local/lib
*/
./configure--prefix=/usr/local/libpng (I use this configuration above the Ignore)
Otherwise, the following installation of the GD library will not find the file

Installing FreeType
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.5.3.tar.gz
Tar
./configure--prefix=/usr/local/freetype
Make
Make install

Installing JPEG6
Create a Directory
Mkdir/usr/local/jpeg6
Mkdir/usr/local/jpeg6/bin
Mkdir/usr/local/jpeg6/lib
Mkdir/usr/local/jpeg6/include
Mkdir/usr/local/jpeg6/man
Mkdir/usr/local/jpeg6/man/man1
wget http://www.ijg.org/files/jpegsrc.v6b.tar.gz
TAR-ZXVF jpegsrc.v6b.tar.gz
CD jpeg-6b
./configure--prefix=/usr/local/jpeg6/--enable-shared--enable-static
Make
Make install
If make makes an error:
./libtool--mode=compile gcc-o2-i. C./jcapimin.c
Make:./libtool: Command not found
Make: * * [Jcapimin.lo] Error 127
The
[Email protected] jpeg-6b]# cp/usr/share/libtool/config/config.sub.
[Email protected] jpeg-6b]# cp/usr/share/libtool/config/config.guess.
Then enter the jpeg-6b source directory, that is, the libtool inside the two configuration files to cover the jpeg-6b directory of the corresponding files, make clean and re-configure

Installing the GD library 2.1.0
Find the libgd2.1.0 package location
Tar
Cd
[Email protected] libgd-2.1.0]#/configure--prefix=/usr/local/gd--with-png=/usr/local/libpng--with-freetype=/ Usr/local/freetype--with-jpeg=/usr/local/jpeg6
Make
Make install

Compiling and installing PHP
Tar
Cd
[Email protected] php-5.5.10]#/configure--prefix=/usr/local/php--WITH-APXS2=/USR/LOCAL/APACHE/BIN/APXS-- With-config-file-path=/usr/local/php/etc--WITH-LIBXML-DIR=/USR/LOCAL/LIBXML2--with-zlib-dir=/usr/local/zlib-- WITH-GD=/USR/LOCAL/GD--with-jpeg-dir=/usr/local/jpeg6--with-png-dir=/usr/local/libpng--with-freetype-dir=/usr/ Local/freetype--with-mysql=/usr/local/mysql--with-mysqli=/usr/local/mysql/bin/mysql_config--with-openssl-- Enable-gd-native-ttf--enable-mbstring--enable-ftp--enable-bcmath--enable-sockets--enable-zip--enable-soap-- Enable-calendar--with-curl--with-pdo-mysql--enable-xml--with-iconv--enable-maintainer-zts--without-pear

Question one:
Checking for CURL in default path ... not found
Configure:error:Please Reinstall the Libcurl distribution-
Easy.h should is in <curl-dir>/include/curl/
Solve
[Email protected] php-5.5.10]# yum-y install Curl-devel

Question two:
/usr/local/src/php-5.5.10/ext/gd/gd.c:57:22:error:x11/xpm.h:no such file or directory
Make: * * * [Ext/gd/gd.lo] Error 1
Problem Description: This is a hint that the GD library does not support XPM
Workaround:
1. Installing LIBXPM
Yum Install libxpm-devel.x86_64
2. Then reinstall the GD library

Question three:
If you encounter the following information during compilation: PEAR package php_archive not installed:generated Phar would require php¨s Phar extension be enabled.
This means that there are two types of solutions that do not have pear installed:

1,./configure additional--without-pear

2. Install and execute the package from the following http://pear.php.net/go-pear pear, steps as follows:

# wget Http://pear.php.net/go-pear.phar

#/usr/local/webserver/php/bin/php Go-pear.phar
I chose the first option.

Make
Make install
/************************
Copying a configuration file
[Email protected] php-5.5.10]# mkdir/usr/local/php/etc
[email protected] php-5.5.10]# CP Php.ini-production/usr/local/php/etc/php.ini
/**********************
Modifying the Apache configuration file
Vi/usr/local/apache/conf/httpd.conf
You can modify the DocumentRoot directory

In this write
<ifmodule dir_module>
DirectoryIndex index.php index.html
</IfModule>
Add in <ifmodule mime_module>:
AddType application/x-httpd-php. php
AddType Application/x-httpd-php-source. Phps
Adddefaultcharset UTF8 (this sentence enables Apache to support the UTF8 character set by default)

Restart the Apache service for the configuration to take effect
[Email protected] etc]#/usr/local/apache/bin/apachectl restart

Edit php.ini file to find
;d efault_charset= "Iso-8859-1"
Add a line: default_charset= "UTF8", you can choose also can not use Ha

And then you can test it!
/*********************
Multi-site Configuration
In the Apache configuration file
#LoadModule Vhost_alias_module modules/mod_vhost_alias.so
Enable the Apache Virtual Host feature
#Include conf/extra/httpd-vhosts.conf
Import the virtual host configuration from the conf/extra/httpd-vhosts.conf file
Note Remove
then [[email protected] conf]# VI extra/httpd-vhosts.conf
<virtualhost *:80>
ServerAdmin [email protected]
DocumentRoot "/mnt/hgfs/win2linux/test"
ServerName turtle.com
Serveralias www.turtle.com
Errorlog "Logs/turtle-error_log"
Customlog "Logs/turtle-access_log" common
</VirtualHost>
<directory "/mnt/hgfs/win2linux/test" >
Options Indexes FollowSymLinks
AllowOverride All
Order Deny,allow
Allow from all
</Directory>
then [[email protected] conf]# vi/etc/hosts
127.0.0.1 turtle.com
The virtual machine can be accessed here, but not in the host, to set the hosts under the host
Join 192.168.3.130turtle.com
And then it's all right.
/******************
After the configuration is complete, you can check the configuration file format by APACHECTL-T for errors:
#/usr/local/webserver/apache2.2.21/bin/apachectl-t
Syntax OK
If no problem, start Apache service Apache restart

/**************************************
Extended
/********************
PHP installation extension MCrypt and related dependencies "How to install pecl Extensions in PHP"
Download Libmcrypt,mhash,mcrypt installation package

Libmcrypt:
wget http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz/download
Tar
Cd
./configure
Make
Make install
Description: Libmcript default installation Restarts the machine after the/usr/local installation is complete

Re-install Mhash
wget http://sourceforge.net/projects/mhash/files/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz/download
Tar
Cd
./configure
Make
Make install

Final installation MCrypt
wget http://sourceforge.net/projects/mcrypt/files/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz/download
Tar
Cd
[Email protected] mcrypt-2.6.8]# ld_library_path=/usr/local/lib./configure
Make
Make install

An error message appears:
/bin/rm:cannot remove ' Libtoolt ': No such file or directory
Edit the Configure file to search for this line:
$RM "$cfgfile"
And then add a # at the beginning of the line as a comment, save it, compile it.

Installing PHP's PECL extension mcrypt
Note that MCrypt is PHP's own pecl extension, so just go to PHP to extract the directory to find the MCrypt package.

#cd/usr/php-5.5.10/ext/mcrypt
#/usr/local/php/bin/phpize
#./configure--with-php-config=/usr/local/php/bin/php-config
#make && make Install
Add a extension=mcrypt.so to your php.ini
Restart Apache
# Service Apache Restart
View Phpinfo (), MCrypt already installed.
/******************
First look at the installation of Libevent, no ls-la.
No need to install first
[Email protected] libevent-2.0.21-stable]# wget https://github.com/downloads/libevent/libevent/ Libevent-2.0.21-stable.tar.gz
./configure--prefix=/usr/local/libevent
Make
Make install
Then install memcached
wget http://www.memcached.org/files/memcached-1.4.17.tar.gz
Tar
Cd
./configure--prefix=/usr/local/memcached--with-libevent=/usr/local/libevent
Make
Make install
/****************
Start
[Email protected] bin]#/memcached-d-M 100-u root-l 127.0.0.1-p 11211-c 1024-p/usr/local/memcached/memcached.pid
View Details
#ps Aux|grep Mem
Output PID
#cat/usr/local/memcached/memcached.pid
View Memory usage
#top-N 1 |grep Mem

PHP memcache Extensions

Memcache
wget http://pecl.php.net/get/memcache-2.2.7.tgz
Tar
Cd
/usr/local/php/bin/phpize
[Email protected] memcache-2.2.7]#/configure--enable-memcache--with-php-config=/usr/local/php/bin/php-config-- With-zlib-dir=/usr
Make
Make install

There will be a hint like this after the installation is complete:
Installing Shared extensions:/usr/local/php/lib/php/extensions/no-debug-non-zts-2007xxxx/
Change the extension_dir in php.ini = "./" To
Extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-2007xxxx/"
In the configuration file, add
Extension=memcache.so

/*********
Memcached
Install libmemcached First
wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
Tar
Cd
./configure--prefix=/usr/local/libmemcached-with-memcached
Make
Make install

Then install memcached
wget http://pecl.php.net/get/memcached-2.1.0.tgz
Tar
Cd
/usr/local/php/bin/phpize
[Email protected] memcached-2.1.0]#/configure--with-php-config=/usr/local/php/bin/php-config-- with-libmemcached-dir=/usr/local/libmemcached/
Make
Make install
Modify configuration file Join
Extension=memcached.so

memcached boot has not been solved!!!!
/****************************
Turn On Error display
Display_errors=on
Error_reporting=e_all

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.