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+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!