Install Apache+PHP+MySQL under yum under Linux

1. Install Apache:

#yum update
#yum install httpd

  

    Modify the configuration file: /etc/httpd/conf/httpd.conf

#ServerName www.example.com:80
ServerName localhost:80

#AddDefaultCharset UTF-8
AddDefaultCharset off

 

    Install the current version of the Apache configuration environment, and then configure the httpd.conf (located in /etc/httpd/conf/httpd.conf) file, generally similar to the Linode 1GB scheme, you can set it like this, or you can default it.
 

KeepAlive Off
......
<IfModule prefork.c>
StartServers 2
MinSpareServers 6
MaxSpareServers 12
MaxClients 80
MaxRequestsPerChild 3000
</IfModule>


  To set auto-start on boot: 

chkconfig --levels 235 httpd on

   If after the installation is complete, visit localhost or 127.0.0.1 in the browser, you will see the default welcome interface of apache and related introduction information
 
2. Install PHP
 

#yum install php php-pear

  

  Enable GD library support

#yum install php-gd

  Install the PHP environment, then configure the /etc/php.ini file.

 

error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR
display_errors = Off
log_errors = On
error_log = /var/log/php/error.log
max_execution_time = 30
memory_limit = 128M
register_globals = Off
max_input_time = 30

#request_order = "GP"

request_order = "CGP"

Use vi to find the above parameters, then modify the parameters accordingly, save and exit.

#mkdir /var/log/php
#chown apache /var/log/php

Create a log file, if we need to support MYSQL in PHP, we need to enter the following command to install the php5-mysql package.

# yum install php-mysql
# /etc/init.d/httpd restart

Install and set up to launch.


3. Install MySQL

 

#yum install mysql-server
#service mysqld restart

   Install and set ROOT permissions, and set the ROOT password according to the prompts

#mysql_secure_installation

   Default other users and other default data can be removed.

   User and permission settings:

mysql -uroot -p
use mysql;  
update user set Password=PASSWORD('123456') where User='root';

GRANT ALL PRIVILEGES ON *.* TO root@"%.%.%.%" IDENTIFIED BY "123456";
GRANT select,insert,update,delete on tlbbdb.* to tlbb_123456@"%" identified by "yang123456";
GRANT ALL PRIVILEGES ON *.* TO yangweixu@"%.%.%.%" IDENTIFIED BY "yangweixu1986";

flush privileges;
exit

   Install the driver package:

#yum install -y mysql-connector-odbc

  The database starts automatically:

chkconfig --level 3 mysqld on

 

   Finally, restart Apache,

service httpd restart

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326851286&siteId=291194637