Explore Php+nginx (ii) Install PHP

Source: Internet
Author: User
Tags gettext mcrypt sapi openldap automake

First, let's take a quick look at what is php,php (hypertext preprocessor hypertext Preprocessor) and the Java language, PHP is also a high-level language, and does not run directly on the operating system. The Java runtime requires a virtual machine, and PHP runs the Zend engine. Unlike Java, Java is a compilation and parsing language, and PHP is just a parsing language. So, we can easily see from the nature of the language, Java before running through the compilation of A. class file, so the efficiency will be faster, PHP after writing a program to check the syntax through, you can run directly, so that development efficiency will be faster.

Last year, when I started to transfer php from Java, PHP's weak type effect attracted me, in Java we often encounter various types of conversion, or consider what type to store data, this strict programming is very limited to the efficiency of development, of course, this disadvantage is its advantages, More stringent type definitions, allowing Java to run faster. Then, I remember when I learned php+mysql, I was very surprised! Why is PHP's operation on the database so simple, am I wrong to write it? Because when I first learned Java, MySQL's various jar bags get spit blood. Real PHP development is very good, so many PHP programmers will make a joke: PHP is the best language in the world. In fact, not the other language is not good, but as programmers like the kind of automated, less artificial methods to develop and maintain programs.

The above are personal understanding, not necessarily correct, if not, I hope you help correct me.

Back to the point: install PHP, we talk about the installation is not in Windows repeatedly click on the next process, so it is too boring. What I want to say today is how to install PHP in Linux and understand PHP extensions.

in my last note, I prepared the Linux system and configured the network.  install PHP, and turn on FPM# Update Systemyum-y Update

Upgrade all packages, change software settings and system settings, and upgrade the system version kernel

reboot  # Install the base softwareyum-y install vim wget w3m gcc gcc-c++ make automake gdb cmake kernel-devel kernel-headers lsof zip unzip xz git tree Nmap mailx tcpdump sysstat screen dtach ntp telnet man  # Install dependent librariesyum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng  libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel  Glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel  curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel  openssl openssl-devel openldap openldap-devel openldap-clients openldap-servers  gd-devel libjpeg-devel libpng-devel freetype-devel libxml2-devel curl-devel  freetype-devel bison gcc gcc-c++ autoconf automake zlib* libxml*  ncurses-devel libtool-ltdl-devel* pcre-devel zlib-devel autoconf automake  zlib* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel* perl gettext  Pcre-devel zlib-devel libxpm-devel libxpm icu icu4j libicu* wget lrzsz mysql-devel  Unzip libaio rsync openssh-clients ntp # Install PHP# Install the PHP base environment# PHP config file:/usr/local/php/etc/php.ini# php-fpm configuration file:/usr/local/php/etc/php-fpm.conf# Services Control: Service PHP-FPM (start|stop|restart|reload)  # Install PHP dependent librariescd/usr/local/srcwget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gzTar zxvf libmcrypt-2.5.7.tar.gzCD libmcrypt-2.5.7/./configure MakeMake Install CD libltdl/./configure--enable-ltdl-install MakeMake Install Yum Install Mysql-develln-s/usr/lib64/libxpm.so*/usr/lib/Mkdir/usr/lib/mysqlln-s/usr/lib64/mysql/libmysqlclient*/usr/lib/mysql  # Install PHP#wget Http://tw1.php.net/get/php-5.4.26.tar.gz/from/this/mirror#tar zxf php-5.4.26.tar.gz#cd php-5.4.26 # download SRCwget http://tw1.php.net/get/php-5.6.21.tar.gz/from/this/mirrorMV Mirror php-5.6.21.tar.gz# Unziptar zxf php-5.6.21.tar.gzCD php-5.6.21# Configuration Parameters./configure \--prefix=/usr/local/php \--with-config-file-path=/usr/local/php/etc \--with-mysql=mysqlnd \--with-mysqli=mysqlnd \--with-pdo-mysql=mysqlnd \--with-libxml-dir \--with-pcre-dir \--with-mcrypt \--with-openssl \--with-gd \--with-jpeg-dir \--with-png-dir \--with-xpm-dir \--with-gettext \--with-freetype-dir \--with-bz2 \--with-iconv-dir \--with-zlib \--with-zlib-dir \--with-curl \--with-xmlrpc \--enable-fpm \--with-fpm-user=www \--with-fpm-group=www \--with-icu-dir=/usr \--enable-pcntl \--enable-intl \--enable-sockets \--enable-gd-native-ttf \--enable-gd-jis-conv \--enable-ftp \--enable-zip \--enable-calendar \--enable-mbstring \--enable-exif \--enable-soap \--ENABLE-WDDX \--enable-bcmath \--enable-fd-setsize=4096 \--disable-short-tags \--disable-ipv6# compilation Make # InstallationMake Install # Create configuration file#cp/usr/local/src/php-5.4.26/php.ini-production/usr/local/php/etc/php.iniCp/usr/local/src/php-5.6.21/php.ini-production/usr/local/php/etc/php.inicp/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf # Add a new user/user groupGroupadd wwwuseradd-r-G www www-s/sbin/nologin # Create a directory to run PHP and set permissionsmkdir/var/run/phpmkdir/var/log/phpchown-r www:www/var/run/php/chown-r www:www/var/log/php/ # Set the PHP-FPM configuration and modify the following parameter entries. # vim/usr/local/php/etc/php-fpm.confpid =/var/run/php/php-fpm.piderror_log =/var/log/php/error.loguser = wwwGroup = wwwListen = 127.0.0.1:9000pm = static # PHP-FPM Join system service and boot up#cp/usr/local/src/php-5.4.26/sapi/fpm/init.d.php-fpm/etc/init.d/php-fpmCP/USR/LOCAL/SRC/PHP-5.6.21/SAPI/FPM/INIT.D.PHP-FPM/ETC/INIT.D/PHP-FPM# VIM/ETC/INIT.D/PHP-FPM#php_fpm_PID =${prefix}/var/run/php-fpm.pidPhp_fpm_pid=/var/run/php/php-fpm.pid # Edit PHP related path (/ETC/INIT.D/PHP-FPM)chmod u+x/etc/init.d/php-fpmchkconfig--add php-fpmService PHP-FPM Startchkconfig php-fpm on ps-dindicates that our normal installation has been successful and the PHP-FPM has been started.PHP Installation Complete!  

Explore Php+nginx (ii) Install PHP

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.