Home  >  Article  >  Backend Development  >  Configure php and mysql environments to implement dynamic website code examples

Configure php and mysql environments to implement dynamic website code examples

小云云
小云云Original
2018-03-01 14:58:052721browse

This article mainly shares with you examples of configuring PHP and MySQL environments to implement dynamic website code. I hope it can help you.

Step one: Configure the php environment, open putty to connect to your own server and execute the following command

Install php

yum install php php-devel

Restart apache to make php take effect

y

Install php extension

yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php- xml php-xmlrpc

After installing the extension, you need to restart apache again

service httpd restart

Finally create a PHP file in the directory: /var/www/html/

The code content is as follows:

<?php phpinfo(); ?>

When you access this file, you can see the php version and installed plug-in information.

Step 2: Configure and install mysql

Exit the folder and return to the root directory to install mysql

1. MySQL installation and Configuration

1. Install rpm package

rpm -Uvhhttp://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

2. Install mysql

yum -y install mysql-community-server

3. Add startup (that is, when the computer starts, the MySQL service automatically starts)

systemctl enable mysqld

4. Start the MySQL service process

systemctl start mysqld

5. Configure the root user password

mysql_secure_installation

The configuration is as follows As shown in the picture:


6. Open a new putty window and connect to the database

mysql -u root - p

7. After entering the database, you can execute SQL statements.

Related recommendations:

Several useful PHP environment packages

php environment configuration tutorial: PHP development environment integration Installation and independent installation video tutorial

PHP+Apache+Mysql environment setup tutorial_php example

The above is the detailed content of Configure php and mysql environments to implement dynamic website code examples. 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