1 php Introduction PHP (php:hypertext preprocessor abbreviation, Chinese name: "Hypertext Preprocessor") is a common open source scripting language. Grammar absorbs the C language, Java and Perl features, the entry threshold is low, easy to learn, widely used, mainly for the field of web development. PHP has a file suffix called PHP.
2 1) Libmcrpyt
Ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz
2) PHP
http://www.php.net/
3) Install all software resource packs (Installation environment: CentOS-6.5)
http://download.csdn.net/detail/clevercode/8676163
3 Installation Instructions 1) The installation of PHP is relatively complex. can refer to Baidu experience Lnmp installation method.
Website: http://jingyan.baidu.com/article/915fc414cc28ec51394b2032.html
2) When installing the LNMP. System Conventions:
Software source code Package storage location:/usr/local/src/software Name
Source Package Compilation Installation location:/usr/local/software Name
4 Installation Step 4.1 installation Libiconv
Make sure to install the Linux Standing Support library before installation, otherwise there will be a variety of errors! Installation of the necessary common support libraries in Linux: http://blog.csdn.net/clevercode/article/details/45438401
# cd/usr/local/src/php
# tar ZXVF libiconv-1.13.tar.gz
# CD libiconv-1.13
#./configure--prefix=/usr/local
# make
# make Install
4.2 Installing libmcrypt# cd/usr/local/src/php
# tar zxvf libmcrypt-2.5.8.tar.gz #解压
# CD libmcrypt-2.5.8 #进入目录
#./configure #配置
# Make #编译
# Make Install #安装
4.3 Installing mhash# cd/usr/local/src/php
# tar ZXVF mhash-0.9.9.9.tar.gz
# CD mhash-0.9.9.9/
#./configure
# make
# make Install
4.4 Establishing the soft-chain ln-s/usr/local/lib/libmcrypt.la/usr/lib/libmcrypt.la
Ln-s/usr/local/lib/libmcrypt.so/usr/lib/libmcrypt.so
Ln-s/usr/local/lib/libmcrypt.so.4/usr/lib/libmcrypt.so.4
Ln-s/usr/local/lib/libmcrypt.so.4.4.8/usr/lib/libmcrypt.so.4.4.8
Ln-s/USR/LOCAL/LIB/LIBMHASH.A/USR/LIB/LIBMHASH.A
Ln-s/usr/local/lib/libmhash.la/usr/lib/libmhash.la
Ln-s/usr/local/lib/libmhash.so/usr/lib/libmhash.so
Ln-s/usr/local/lib/libmhash.so.2/usr/lib/libmhash.so.2
Ln-s/usr/local/lib/libmhash.so.2.0.1/usr/lib/libmhash.so.2.0.1
Ln-s/usr/local/bin/libmcrypt-config/usr/bin/libmcrypt-config
cp-frp/usr/lib64/libjpeg.*/usr/lib/
cp-frp/usr/lib64/libpng*/usr/lib/
cp-frp/usr/lib64/libldap*/usr/lib/
4.5 Install PHP1) Create the WWW user that the user php-fpm uses.
# Groupadd www #添加www组
# useradd-g www www-s/bin/false #创建nginx运行账户www并加入到www组, www users are not allowed to log in directly to the system
2) Create the installation directory, cache directory, log directory
A) installation directory
# mkdir-p/USR/LOCAL/PHP5
b) Cache Directory
# mkdir-p/tmp/phis
# chown Www:www/tmp/phis-r
c) Session Directory, if it is load balanced multiple servers, need to share session,session need to put in Memcach
# mkdir-p/tmp/session
# chown Www:www/tmp/session-r
d) Create a log directory
# mkdir-p/data0/logs/php
# chown Www:www/data0/logs/php-r
3) Unzip
Make sure the Mysql-devel is installed and the/usr/lib64/mysql is generated
Libmysqlclient is installed in the/usr/lib64/mysql/directory by default in a 64-bit system
While PHP is compiled to go to the/usr/lib directory to look for so to create a soft connection
# ln-s/usr/lib64/mysql/libmysqlclient*/usr/lib
#/sbin/ldconfig
# cd/usr/local/src/php
# TAR-XVPF PHP-5.2.13.TAR.BZ2
4) Patches
# GZIP-CD Php-5.2.13-fpm-0.5.13.diff.gz | Patch-d PHP-5.2.13-P1
5) configuration
# CD php-5.2.13/
#./configure--prefix=/usr/local/php5 \
--WITH-CONFIG-FILE-PATH=/USR/LOCAL/PHP5/ETC \
--with-mysql=/usr/include/mysql \
--with-mysqli=/usr/lib64/mysql/mysql_config \
--with-iconv-dir=/usr/local--with-freetype-dir--with-jpeg-dir \
--with-png-dir--with-zlib--with-libxml-dir=/usr--enable-xml \
--disable-rpath--enable-discard-path--enable-safe-mode \
--enable-bcmath--enable-shmop--enable-sysvsem--enable-inline-optimization \
--with-curl--with-curlwrappers--enable-mbregex--enable-fastcgi \
--ENABLE-FPM \
--enable-force-cgi-redirect--enable-mbstring \
--with-mcrypt--WITH-GD--enable-gd-native-ttf \
--with-openssl--with-mhash--enable-pcntl--enable-sockets \
--with-ldap--WITH-LDAP-SASL--with-xmlrpc--enable-zip--enable-soap \
--without-pear--with-pdo-mysql
6) Compiling
Make zend_extra_libs= '-liconv '
7) Installation
Make install
4.6 Installing PHP extensions 1) Installing Memcache
cd/usr/local/src/php
Tar zxvf memcache-2.2.5.tgz
CD memcache-2.2.5/
/usr/local/php5/bin/phpize
./configure--with-php-config=/usr/local/php5/bin/php-config
Make
Make install
Cd.. /
4.7 Configuring PHP Mode one: manual configuration
1) Copy the PHP configuration file to the installation directory
# Cp/usr/local/src/php/php-5.2.13/php.ini-dist/usr/local/php5/etc/php.ini
2) Delete The system comes with the configuration file
# Rm-rf/etc/php.ini
3) Add soft links
# ln-s/usr/local/php5/etc/php.ini/etc/php.ini
4) Edit
Vi/usr/local/php5/etc/php-fpm.conf
user = www #设置php-fpm run account is www
Group = www #设置php-fpm run Group is www
PID = Run/php-fpm.pid #取消前面的分号
#设置 php-fpm boot, copy php-fpm to boot directory
# CP/USR/LOCAL/PHP5/SBIN/PHP-FPM/ETC/RC.D/INIT.D/PHP-FPM
#添加执行权限
chmod +x/etc/rc.d/init.d/php-fpm
#设置开机启动
Chkconfig PHP-FPM on
#编辑配置文件
Vi/usr/local/php5/etc/php.ini
Found: Disable_functions =
Modified to:
Disable_functions = Passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_ Alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server, Escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space, POSIX_CTERMID,POSIX_GET_LAST_ERROR,POSIX_GETCWD, Posix_getegid,posix_geteuid,posix_getgid, Posix_getgrgid,posix_ Getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, Posix_getppid,posix_getpwnam, Posix_getpwuid, Posix_getrlimit, Posix_getsid,posix_getuid,posix_isatty, Posix_kill,posix_mkfifo,posix_setegid, Posix_seteuid,posix_setgid, Posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname, Posix_uname
#列出PHP可以禁用的函数, if some programs need to use this function, you can delete, cancel disable.
Found:;d Ate.timezone =
Modified to: Date.timezone = PRC #设置时区
Found: expose_php = On
Modified to: expose_php = OFF #禁止显示php版本的信息
PS: In the process of compiling PHP may be reported undefined REFERENCE to ' libiconv_open cannot compile PHP LIBICONV error.
#配置php命令
Ln-s/usr/local/php5/bin/php/usr/bin/
Mode two: Upload file configuration (: http://download.csdn.net/detail/clevercode/8676163)
1) Upload php.ini
# cd/usr/local/php5/etc/
# RZ PHP.ini
# ln-s/usr/local/php5/etc/php.ini/etc/php.ini
2) Upload php-fpm.conf
# CD/USR/LOCAL/PHP5/ETC
# RZ Php-fpm.conf
4.8 Start stop restart PHP-FPM1) start
# Cd/usr/local/php5/sbin
#./PHP-FPM Start
2) Stop
#./PHP-FPM Stop
2) Restart
#./PHP-FPM Restart
4.9 Configuring Nginx Support PHP
For more information, see my other Blog: Installation and configuration of Nginx in Linux (centos-6.5:nginx-1.5.0)
Website: http://blog.csdn.net/clevercode/article/details/45442155
original works, from "Clevercode's blog" , please be sure to mention the following original address when reproduced , otherwise hold the copyright legal responsibility.
Original Address : http://blog.csdn.net/clevercode/article/details/45579837 ( reprint must indicate this address ).
Blog column address (Linux common software Installation and configuration): Http://blog.csdn.net/column/details/linuxsoftwareinstall.html.
Welcome to pay attention to my blog more wonderful content: Http://blog.csdn.net/CleverCode.
PHP installation and configuration in Linux (centos-6.5:php-5.2.13)