1. Source code installation
1. Compile and install
<code><span>.</span>/configure <span>--</span>prefix<span>=</span>/usr/<span>local</span>/php<span>\</span><span>--</span><span>with</span><span>-config</span><span>-file</span><span>-path</span><span>=</span>/usr/<span>local</span>/php/etc <span>--</span><span>with</span><span>-bz2</span><span>--</span><span>with</span><span>-curl</span><span>\</span><span>--</span>enable<span>-ftp</span><span>--</span>enable<span>-sockets</span><span>--</span>disable<span>-ipv6</span><span>--</span><span>with</span><span>-gd</span><span>\</span><span>--</span><span>with</span><span>-jpeg</span><span>-dir</span><span>=</span>/usr/<span>local</span><span>--</span><span>with</span><span>-png</span><span>-dir</span><span>=</span>/usr/<span>local</span><span>\</span><span>--</span><span>with</span><span>-freetype</span><span>-dir</span><span>=</span>/usr/<span>local</span><span>--</span>enable<span>-gd</span><span>-native</span><span>-ttf</span><span>\</span><span>--</span><span>with</span><span>-iconv</span><span>-dir</span><span>=</span>/usr/<span>local</span><span>--</span>enable<span>-mbstring</span><span>--</span>enable<span>-calendar</span><span>\</span><span>--</span><span>with</span><span>-gettext</span><span>--</span><span>with</span><span>-libxml</span><span>-dir</span><span>=</span>/usr/<span>local</span><span>--</span><span>with</span><span>-zlib</span><span>\</span><span>--</span><span>with</span><span>-pdo</span><span>-mysql</span><span>=</span>mysqlnd <span>--</span><span>with</span><span>-mysqli</span><span>=</span>mysqlnd <span>--</span><span>with</span><span>-mysql</span><span>=</span>mysqlnd <span>\</span><span>--</span>enable<span>-dom</span><span>--</span>enable<span>-xml</span><span>--</span>enable<span>-fpm</span><span>--</span><span>with</span><span>-libdir</span><span>=</span>lib64 <span>--</span>enable<span>-bcmath</span></code>
<code><span>make</span> && <span>make</span> install</code>
2. Error handling
[ERROR]-1
<code>checking <span>for</span> ZLIB support... <span>no</span>checking <span>if</span> the location <span>of</span> ZLIB install directory <span>is</span> defined... <span>yes</span><span>configure</span>: <span>error</span>: Cannot find libz</code>
[ERROR]-2
<code>checking whether <span>to</span> enable JIS<span>-mapped</span> Japanese font support <span>in</span> GD<span>...</span> no <span>If</span> configure fails try <span>--</span><span>with</span><span>-vpx</span><span>-dir</span><span>=DIR<span>></span>configure: error: jpeglib<span>.</span>h <span>not</span> found<span>.</span></span></code>
[Solution]
<code>wget http://www<span>.boutell</span><span>.com</span>/gd/http/gd-<span>2.0</span><span>.33</span><span>.tar</span><span>.gz</span> tar zxvf gd-<span>2.0</span><span>.33</span><span>.tar</span><span>.gz</span> cd gd-<span>2.0</span><span>.33</span> ./configure --prefix=/usr/local/gd2 make make instal</code>
I found libjpeg on the Internet, You can use this library to implement various operations on JPG images; download: http://freeware.sgi.com/source/libjpeg/libjpeg-6b.tar.gz,
Refer to the README installation library, the general steps are as follows:
<code>./configure Make Make <span>install</span></code>
[ERROR]-3
<code><span>If</span> configure fails try <span>--</span><span>with</span><span>-xpm</span><span>-dir</span><span>=DIR<span>></span>configure: error: freetype<span>-config</span><span>not</span> found<span>.</span></span></code>
[ERROR]-4
<code>checking whether <span>to</span> enable JIS<span>-mapped</span> Japanese font support <span>in</span> GD<span>...</span> no configure: error: vpx_codec<span>.</span>h <span>not</span> found<span>.</span></code>
[Bzip2 Install]
<code>tar -xzvf bzip2-<span>1.0</span><span>.6</span><span>.tar</span><span>.gz</span></code>
Enter the decompressed directory: cd bzip2-1.0.6
Prepare for compilation and create the libbz2.so dynamic link library (this step is very important. Without this step when installing python, python cannot install the bz2 module):
<code>make <span>-f</span> Makefile<span>-libbz2_so</span></code>
Compile and install: make && make install
two , RPM installation
<code>[root@kallen ~]<span># rpm -ivh php-common-5.4.40-1.el6.remi.x86_64.rpm </span> warning: php-common-<span>5.4</span><span>.40</span>-<span>1.</span>el6.remi.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID <span>00</span>f97f56: NOKEY Preparing... <span>########################################### [100%]</span><span>file</span> /etc/php.ini <span>from</span> install <span>of</span> php-common-<span>5.4</span><span>.40</span>-<span>1.</span>el6.remi.x86_64 conflicts <span>with</span><span>file</span><span>from</span> package php-common-<span>5.3</span><span>.3</span>-<span>26.</span>el6.x86_64 <span>file</span> /usr/lib64/php/modules/curl.so <span>from</span> install <span>of</span> php-common-<span>5.4</span><span>.40</span>-<span>1.</span>el6.remi.x86_64 conflicts <span>with</span><span>file</span><span>from</span> package php-common-<span>5.3</span><span>.3</span>-<span>26.</span>el6.x86_64 <span>file</span> /usr/lib64/php/modules/fileinfo.so <span>from</span> install <span>of</span> php-common-<span>5.4</span><span>.40</span>-<span>1.</span>el6.remi.x86_64 conflicts <span>with</span><span>file</span><span>from</span> package php-common-<span>5.3</span><span>.3</span>-<span>26.</span>el6.x86_64 <span>file</span> /usr/lib64/php/modules/json.so <span>from</span> install <span>of</span> php-common-<span>5.4</span><span>.40</span>-<span>1.</span>el6.remi.x86_64 conflicts <span>with</span><span>file</span><span>from</span> package php-common-<span>5.3</span><span>.3</span>-<span>26.</span>el6.x86_64 <span>file</span> /usr/lib64/php/modules/phar.so <span>from</span> install <span>of</span> php-common-<span>5.4</span><span>.40</span>-<span>1.</span>el6.remi.x86_64 conflicts <span>with</span><span>file</span><span>from</span> package php-common-<span>5.3</span><span>.3</span>-<span>26.</span>el6.x86_64 <span>file</span> /usr/lib64/php/modules/zip.so <span>from</span> install <span>of</span> php-common-<span>5.4</span><span>.40</span>-<span>1.</span>el6.remi.x86_64 conflicts <span>with</span><span>file</span><span>from</span> package php-common-<span>5.3</span><span>.3</span>-<span>26.</span>el6.x86_64 <span>error</span>: Failed dependencies: libmysqlclient.so<span>.18</span>()(<span>64</span>bit) <span>is</span> needed <span>by</span> php-mysql-<span>5.4</span><span>.40</span>-<span>1.</span>el6.remi.x86_64 libmysqlclient.so<span>.18</span>(libmysqlclient_16)(<span>64</span>bit) <span>is</span> needed <span>by</span> php-mysql-<span>5.4</span><span>.40</span>-<span>1.</span>el6.remi.x86_64 libmysqlclient.so<span>.18</span>(libmysqlclient_18)(<span>64</span>bit) <span>is</span> needed <span>by</span> php-mysql-<span>5.4</span><span>.40</span>-<span>1.</span>el6.remi.x86_64</code>
3. YUM installation
1.PHP-5.4
php5.4 was released on May 8, 2012. Starting from php5.4.0, php has added some new features such as:
- Traits support
- Built-in a simple web server
- Provides a short syntax for arrays
- Directly access the array value of the function return value
- Finally remove the magic method and safe mode
It is recommended to use the YUM source of Webtatic EL6 to install php5 .4. We first install the Webtatic EL6 YUM source. For the installation configuration of the YUM source, please refer to the article "Configuring the YUM Source in RHEL6";
<code>rpm -Uvh http://repo<span>.webtatic</span><span>.com</span>/yum/el6/latest<span>.rpm</span></code>
<code>yum <span>-y</span> install php54w php54w<span>-bcmath</span> php54w<span>-cli</span><span>\</span> php54w<span>-common</span> php54w<span>-devel</span> php54w<span>-fpm</span> php54w<span>-gd</span><span>\</span> php54w<span>-imap</span> php54w<span>-ldap</span> php54w<span>-mbstring</span> php54w<span>-mcrypt</span><span>\</span> php54w<span>-mysql</span> php54w<span>-odbc</span> php54w<span>-pdo</span> php54w<span>-pear</span><span>\</span> php54w<span>-pecl</span><span>-igbinary</span> php54w<span>-xml</span> php54w<span>-xmlrpc</span><span>\</span> php54w<span>-opcache</span> php54w<span>-intl</span> php54w<span>-pecl</span><span>-memcache</span></code>
If the installation fails, it is recommended that you uninstall the previous php before installing it, use
<code> yum <span>remove</span> php php-*</code>
List of included php extensions:
Package | Provides |
---|---|
php54w mod_php | |
php54w-bcmath | |
php54w-cli | php-cgi, php- pcntl, php-readline |
php54w-common | php-api, php-bz2, php-calendar, php-ctype, php-curl, php-date, php-exif, php-fileinfo, php-ftp, php-gettext, php-gmp, php-hash, php-iconv, php-json, php-libxml, php-openssl, php-pcre, php-pecl-Fileinfo, php-pecl-phar, php-pecl-zip, php-reflection, php-session, php-shmop, php-simplexml, php-sockets, php-spl, php-tokenizer, php-zend-abi, php-zip, php-zlib |
php54w-dba | |
php54w-devel | |
php54w-embedded | php-embedded-devel |
php54w-enchant | |
php54w -fpm | |
php54w-gd | |
php54w-imap | |
php54w-interbase | php_database, php-firebird |
php54w-intl | |
php54 w-ldap | |
php54w-mbstring | |
php54w-mcrypt | |
php54w-mssql | |
php54w-mysql | php-mysqli, php_database |
php54w-odbc | php-pdo_odbc, php_database |
php54w-pdo | |
php54w-pgsql | php-pdo_pgsql, php_database |
php54w-process | php-posix, php-sysvmsg, php-sysvsem, php-sysv shm |
php54w-pspell | |
php54w-recode | |
php54w-snmp | |
php54w-soap | |
php54w -tidy | |
php54w-xml | php-dom , php-domxml, php-wddx, php-xsl |
php54w-xmlrpc | |
php54w-zts |
<code>[root@kallen ~]# yum install php54w-gd.x86_64 Loaded plugins: product-id, security, subscription-manager This system <span>is</span><span>not</span> registered <span>to</span> Red Hat Subscription Management. You can <span>use</span> subscription-manager <span>to</span><span>register</span>. Setting up Install <span>Process</span> Resolving Dependencies <span>--> Running transaction check</span><span>---> Package php54w-gd.x86_64 0:5.4.41-1.w6 will be installed</span><span>--> Processing Dependency: libt1.so.5()(64bit)for package: php54w-gd-5.4.41-1.w6.x86_64</span><span>--> Finished Dependency Resolution</span> Error: <span>Package</span>: php54w-gd-<span>5.4</span><span>.41</span>-<span>1.</span>w6.x86_64 (webtatic) Requires:libt1.so<span>.5</span>()(<span>64</span><span>bit</span>) You could try using <span>--skip-broken to work around the problem</span> You could try running: rpm -Va <span>--nofiles --nodigest</span></code>
Solution:
<code>[root<span>@kallen</span> ~]<span># rpm -ivh t1lib-5.1.2-6.el6_2.1.x86_64.rpm </span><span>warning</span>: t1lib-<span>5.1</span><span>.2</span>-<span>6.</span>el6_2<span>.1</span>.x86_64.<span>rpm</span>: Header V3 RSA/SHA1 Signature, key ID <span>c105b9de</span>: NOKEY Preparing... <span>######</span><span>######</span><span>######</span><span>######</span><span>######</span><span>######</span><span>######</span><span># [100%]</span><span>1</span>:t1lib <span>######</span><span>######</span><span>######</span><span>######</span><span>######</span><span>######</span><span>######</span><span># [100%]</span></code>
2.PHP-5.5
<code>[root<span>@kallen</span> ~]<span># yum remove php php-bcmath php-cli php-common php-devel php-fpm php-gd php-imap php-ldap php-mbstring php-mcrypt php-mysql php-odbc php-pdo php-pear php-pecl-igbinary php-xml php-xmlrpc</span></code>
<code>[root<span>@kallen</span> ~]<span># yum install php55w php55w-bcmath php55w-cli php55w-common php55w-devel php55w-fpm php55w-gd php55w-imap php55w-ldap php55w-mbstring php55w-mcrypt php55w-mysql php55w-odbc php55w-pdo php55w-pear php55w-pecl-igbinary php55w-xml php55w-xmlrpc php55w-opcache php55w-intl php55w-pecl-memcache</span></code>
4. Version test
1. View PHP version information
<code>kallen@kallen:~$ php <span>-v</span> PHP <span>5.5</span><span>.9</span><span>-</span><span>1</span>ubuntu4<span>.11</span> (cli) (built: Jul <span>2</span><span>2015</span><span>15</span>:<span>23</span>:<span>08</span>) Copyright (c) <span>1997</span><span>-</span><span>2014</span> The PHP <span>Group</span> Zend Engine v2<span>.5</span><span>.0</span>, Copyright (c) <span>1998</span><span>-</span><span>2014</span> Zend Technologies <span>with</span> Zend OPcache v7<span>.0</span><span>.3</span>, Copyright (c) <span>1999</span><span>-</span><span>2014</span>, <span>by</span> Zend Technologies </code>
<code><span><span><?php </span> phpinfo(); <span>?></span></span></span></code>
2. View PHP installed modules
<code>kallen<span>@kallen</span><span>:~</span><span>$ </span>php -m [<span>PHP</span><span>Modules</span>] bcmath bz2 calendar <span>Core</span> ctype date dba dom ereg exif fileinfo filter ftp gd gettext hash iconv json ldap libxml mbstring mhash mysql mysqli openssl pcntl pcre <span>PDO</span> pdo_mysql pdo_pgsql pgsql <span>Phar</span> posix readline <span>Reflection</span> session shmop <span>SimpleXML</span> soap sockets <span>SPL</span> standard sysvmsg sysvsem sysvshm tokenizer wddx xml xmlreader xmlwriter <span>Zend</span><span>OPcache</span> zip zlib [<span>Zend</span><span>Modules</span>] <span>Zend</span><span>OPcache</span></code>
3. MySQL connection test
<code><span><span><?php </span><span>$link</span>=mysql_connect(<span>'localhost'</span>,<span>'root'</span>,<span>'*'</span>); <span>if</span>(!<span>$link</span>) <span>echo</span><span>"Connection Error!"</span>; <span>else</span><span>echo</span><span>"Connected Successfully!"</span> mysql_close(); <span>?></span></span></span></code>
Still to be completed!
Copyright Statement: This article is an original article by the blogger and may not be reproduced without the blogger’s permission|Copyright ©2011-2015, Kallen Ding, All Rights Reserved.
The above introduces the LNMP environment construction-PHP chapter, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

php把负数转为正整数的方法:1、使用abs()函数将负数转为正数,使用intval()函数对正数取整,转为正整数,语法“intval(abs($number))”;2、利用“~”位运算符将负数取反加一,语法“~$number + 1”。

实现方法:1、使用“sleep(延迟秒数)”语句,可延迟执行函数若干秒;2、使用“time_nanosleep(延迟秒数,延迟纳秒数)”语句,可延迟执行函数若干秒和纳秒;3、使用“time_sleep_until(time()+7)”语句。

php除以100保留两位小数的方法:1、利用“/”运算符进行除法运算,语法“数值 / 100”;2、使用“number_format(除法结果, 2)”或“sprintf("%.2f",除法结果)”语句进行四舍五入的处理值,并保留两位小数。

php字符串有下标。在PHP中,下标不仅可以应用于数组和对象,还可应用于字符串,利用字符串的下标和中括号“[]”可以访问指定索引位置的字符,并对该字符进行读写,语法“字符串名[下标值]”;字符串的下标值(索引值)只能是整数类型,起始值为0。

判断方法:1、使用“strtotime("年-月-日")”语句将给定的年月日转换为时间戳格式;2、用“date("z",时间戳)+1”语句计算指定时间戳是一年的第几天。date()返回的天数是从0开始计算的,因此真实天数需要在此基础上加1。

在php中,可以使用substr()函数来读取字符串后几个字符,只需要将该函数的第二个参数设置为负值,第三个参数省略即可;语法为“substr(字符串,-n)”,表示读取从字符串结尾处向前数第n个字符开始,直到字符串结尾的全部字符。

方法:1、用“str_replace(" ","其他字符",$str)”语句,可将nbsp符替换为其他字符;2、用“preg_replace("/(\s|\ \;||\xc2\xa0)/","其他字符",$str)”语句。

php判断有没有小数点的方法:1、使用“strpos(数字字符串,'.')”语法,如果返回小数点在字符串中第一次出现的位置,则有小数点;2、使用“strrpos(数字字符串,'.')”语句,如果返回小数点在字符串中最后一次出现的位置,则有。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Zend Studio 13.0.1
Powerful PHP integrated development environment
