PHP installation (including link MySQL test)

Source: Internet
Author: User
Tags fpm

#1 Install related Packages
Yum-y Install libmcrypt-devel mhash-devel libxslt-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-deve L LIBXML2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses Ncurses-devel Curl C Url-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel OpenSSL openssl-devel

#2 Download PHP
wget http://cn2.php.net/distributions/php-5.4.38.tar.gz
Tar zxf php-5.4.38.tar.gz
CD php-5.4.38

#3 Compile and install
./configure--prefix=/application/php-5.4.38--enable-fpm--with-mcrypt--enable-mbstring--disable-pdo--with-curl- -disable-debug--disable-rpath--enable-inline-optimization--with-bz2--with-zlib--enable-sockets--enable-sysvsem --enable-sysvshm--enable-pcntl--enable-mbregex--with-mhash--enable-zip--with-pcre-regex--with-mysql-- With-mysqli--WITH-GD--with-jpeg-dir

Make && make install
#4
Ln-s/application/php-5.4.38//application/php
CP Php.ini-production/application/php/lib/php.ini
cd/application/php/etc/
CP Php-fpm.conf.default php-fpm.conf

Mkdir/app/logs–p
/application/php/sbin/php-fpm–t
/application/php/sbin/php-fpm
Lsof-i: 9000

#5 View Extensions
/application/php/bin/php-m

#6 Create a Web directory
Mkdir/data/www-p

#7 Test
/application/php/bin/php test.php


# # # in the local installation Nginx

# # # In another install MySQL and authorize
Grant all on * * to ' root ' @ ' 192.168.189.% ' identified by ' 123456 ';
Grant all on * * to ' yeqing ' @ ' 192.168.189.% ' identified by ' 123456 ';
Grant all on test.* to ' yeqing ' @ ' 192.168.189.% ' identified by ' 123456 ';
Flush privileges;

# # # in the Local install MySQL to link MySQL server
Yum install MySQL


# # # link MySQL
Mysql-u root-p-H 192.168.189.131


# # # Test link MySQL
<?php
mysql_connect (' 192.168.189.131 ', ' yeqing ', ' 123456 ') or Die (' 11111111111 ');
mysql_select_db (' test ') or Die (' 2222222222 ');
mysql_query ("Set names UTF8");
$sql = "Select User,host from Mysql.user";
$res = mysql_query ($sql);
$data = Mysql_fetch_array ($res);
echo ' <pre/> ';
Print_r ($data);
?>

# # # Test Link mysqli
<?php
$link = Mysqli_connect (' 192.168.189.131 ', ' yeqing ', ' 123456 ', ' MySQL ') or Die (' 11111111111 ');
$res = Mysqli_query ($link, ' select User,host from Mysql.user ');
$data = Mysqli_fetch_array ($res);
while ($row = Mysqli_fetch_array ($res)) {
echo $row [' user '], '--', $row [' Host '], ' \ r \ n ';
}
?>

# # # Test
/application/php/bin/php test.php

This article from the "Technical cock Silk" blog, reproduced please contact the author!

PHP installation (including link MySQL test)

Related Article

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.