Build lamp environment and install Swoole extensions under Linux

Source: Internet
Author: User
Tags install php mysql client php source code phpinfo zend

First, CentOS 6.5/CentOS 6.9 use Yum to quickly build the lamp environment

Preparation: Update First Yum source I installed the environment is: apache2.2.15+mysql5.5.60+php5.6.36

Enter the following command: Yum-y update

1. Installing Apache

[Email protected] ~]# yum-y install httpd

# Boot from Boot

[Email protected] ~]# chkconfig httpd on

# Start httpd Service

[[Email protected] ~]# service httpd start

# # # installs Apache some extensions

[Email protected] ~]# yum-y install httpd-manual mod_ssl mod_perl mod_auth_mysql

Now just type http://localhost or HTTP///native IP directly in the browser and you should see the Apache test page

Here, you need to pay attention to the iptables settings.

2. Installation configuration Mysql--centos 6.5/CentOS 6.9 Yum installation mysql5.5.60

"1" Delete the system comes with MySQL

Rpm-qa|grep MySQL

Yum Remove Mysql-libs

"2" install MySQL yum source

1) Default CentOS yum installed MySQL is not version 5.5, we need to add two new repo

# RPM-UVH http://mirror.steadfast.NET/epel/6/i386/epel-release-6-8.noarch.rpm

# RPM-UVH http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

2) Check to see if there's MySQL 5.5.

# yum--enablerepo=remi,remi-test list MySQL Mysql-server

"3" installation mysql5.5

# yum--enablerepo=remi,remi-test install MySQL Mysql-server

"4" start mysql5.5

Service mysqld start or/etc/init.d/mysqld start

3. Root Password setting

Attention:

CentOS command when logging in to MySQL: Mysql-u root-p (the initial password is empty by default)
Error Error 1045 (28000): Access denied for user [email protected] (using Password:no) errors

Here's how to fix it:

# Service Mysqld Stop

# Mysqld_safe--skip-grant-tables &

# Mysql-u Root-p go straight in, or enter a password, log in results will show MySQL version information

# use MySQL;

# Update user Set Password=password ("NewPassword") where user= "root"; Change Password to NewPassword

# flush Privileges; Update permissions

#quit

# Boot up

[Email protected] ~]# chkconfig mysqld on

# Start MYSQLD Service

[[Email protected] ~]# service mysqld start

5. Check if the mysql5.5 is installed correctly

[Email protected] ~]# NETSTAT-TULPN | Grep-i MySQL

TCP 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1723/mysqld

OK, we see that the mysqld is up and listening on port 3306.

Description

# MySQL client program

# Mysql-server Service-side program

# Mysql-devel Development and Design Library

4. Install PHP

1) Install the relevant module: In order for PHP to support MySQL, we can install the Php-mysql software package, or you can use the following command to search for available PHP modules

[Email protected] ~]# yum-y install PHP php-mysql

# Install PHP Common extensions

[email protected] ~]# Yum search php

[Email protected] ~]# yum-y install GD php-gd gd-devel php-xml php-common php-mbstring php-ldap php-pear php-xmlrpc php- Imap

# # # Restart the httpd service, this step is important

[Email protected] ~]# service httpd restart

We then provide a PHP page to test

[Email protected] ~]# cd/var/www/html/

[Email protected] html]# VI index.php

<?php

Phpinfo ();

?>

Then, again, in the browser type http://localhost or http://Native IP, you should see the following page

5. Note: PHP upgrade

The version of PHP that is automatically installed with Yum is older, generally PHP5.3.3 this version, and many PHP extensions are not supported. So we sometimes need to upgrade the PHP version.

4.1 If you have installed the PHP5.3.3 version, you need to uninstall the clean

1) yum-y remove php* #这个命令可以卸载部分, but cleaning is not clean

2) Rpm-qa|grep #php查看相关的php安装组件

3) rpm-e PHP related components #这个命令可以清除所有php安装组件

4.2 No PHP installed, install PHP5.6 directly and configure Yum source

1) Add CentOS 6.5 Epel and Remi Source.

# RPM-UVH http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm

# RPM-UVH http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

2) Use the Yum List command to view the installable packages (Packege).

# Yum List--enablerepo=remi--enablerepo=remi-php56 | grep php

Installing PHP5.6

3) The Yum source is configured, and the next step is to install PHP5.6.

# yum Install--enablerepo=remi--enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php -phpunit-phpunit Php-pecl-xdebug Php-pecl-xhprof

Use the PHP command to view the version.

Copy Code

# php--version

PHP 5.6.0 (CLI) (BUILT:SEP 3 2014 19:51:31)

Copyright (c) 1997-2014 the PHP Group

Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies

With Zend Opcache V7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies

With Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans

Copy Code

The version installed here is PHP5.6.0, and attentive users may have found Zendguardloader into Zend Opcahe.

two , CentOS 6.5/centos 6.9 under PHP installation swoole extensions

Before installation, be sure to confirm the installation environment, otherwise it may not be installed later

1) only supported Linux operating system, core code compatible with FreeBSD, need to adjust some of the parameters and details of the compilation to pass
2) Linux kernel version 2.3.32 and above
PHP5.3.10 or later
3) gcc4.4 or later. Core code compatible with clang, need to turn off CPU affinity setting feature
4) cmake2.4+, when compiling to libswoole.so as a C + + library, you need to use CMake

5) autoconf

There are 2 ways to install: Compile and install, install PECL, compile and install a little more trouble, but faster. PECL installation is simple, waiting time may be longer.

1.centos PHP installation Swoole extension

1) Download the source code

# wget Http://pecl.php.net/get/swoole-1.9.6.tgz

2) then unzip with the tar command, and the same tar command does not exist for self-download

# tar ZXVF swoole-1.9.6.tgz

3) switch to swoole-1.9.6 directory

# CD swoole-1.9.6

4) Under Unzip, enter the directory

Note: Find the path of phpize, note that you want to give specific PHP version of the phpize installed, such as my PHP source code in the/usr/bin/directory, phpize path is/usr/bin/phpize,

It is recommended to specify an absolute path when you are not sure which version of PHP Phpize is under the terminal

#/usr/bin/phpize

5) Check && compile && install

#./configure

# make

# sudo make install

Enter the above command in sequence to operate

6) Add to PHP extension

"1" to find the php.ini at the specified location

# php-i |grep php.ini

Modify PHP.ini to join extension=swoole.so.

"2" Through Php-m or phpinfo () to see if the swoole extension was successfully loaded.

# Php-m|grep Swoole

Build lamp environment and install Swoole extensions under Linux

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.