Home  >  Article  >  Backend Development  >  How to install and configure php environment for ecs

How to install and configure php environment for ecs

醉折花枝作酒筹
醉折花枝作酒筹Original
2021-04-06 10:09:282039browse

Configuration method: 1. Use Xshell to connect to the ECS server; 2. Execute the "yum install httpd" command; 3. Configure the yum source; 4. Use the "yum install" command to install and configure PHP5.6; 5. Use the "yum install" command to install and configure mysql.

How to install and configure php environment for ecs

#The operating environment of this tutorial: windows7 system, PHP5.6&&apache2.2&&Postgresql version, DELL G3 computer

Configuration method of Alibaba Cloud ECS server PHP running environment

1. First use Xshell to connect to the server.

Open Xshell, create a new connection, and name it whatever you want. Enter your server IP address for the host, select the default value for the rest, click OK, and then enter the password. If the following page is displayed, it means you have successfully connected to the server.

2. Execute yum install httpd

on Xshell to set up the boot Start

chkconfig --levels 235 httpd on. If everything is normal, apache is installed. Enter your server IP address in the browser window. If the following screen appears, congratulations, you are one step closer to success. Got it!

Next we install PHP. If you directly use the command

yum install php , the PHP installed by the system is the relatively low version 5.3. If your program version requirements are not high, you can use this directly.

3, Configure the yum source

Add the epel and remi sources of

CentOS 6.5.

# 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
The following is the source of

CentOS 7.0.

# yum install epel-release# rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
Use the yum list command to view the installable packages (Packege).


# yum list --enablerepo=remi --enablerepo=remi-php56 | grep php

4. Install PHP5.6

After the yum source is configured, 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 PHP command to check the version.


# php --versionPHP 5.6.0 (cli) (built: Sep  3 2014 19:51:31)Copyright (c) 1997-2014 The PHP GroupZend 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
The version installed here is PHP5.6.0. Careful users may have discovered that

ZendGuardLoader has become Zend OPcahe.

Starting from PHP5.5, the PHP code cache has changed from APC to

Zend OPcache.

phpinfo()Look below:

##5. Install MySQL
Open the terminal, root user

yum install mysql mysql-server

After installation, set MySQL to start automatically

chkconfig --levels 235 mysqld          on        
/etc/init.d/mysqld start            //或者service mysqld start

Set the password of the MySQL root account (I did not create a new MySQL user, Just use the root account), enter the following

mysql_secure_installation

When the following prompt appears

Enter current paaword for root

Because our root password is empty, just press enter, and then follow the prompts and enter New password, confirm, there will be four confirmations at the end, just press Enter.

Recommended learning:

php video tutorial

The above is the detailed content of How to install and configure php environment for ecs. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn