Build a mysql + PHP environment in Centos

Source: Internet
Author: User
Tags install wordpress mysql login wordpress database
The first six items in the required software httpdmysqlmysql-serverphpphp-develphp-mysqlphpMyAdmin are available in yum, which are installed by default. PhpMyAdmin provides a link for manual installation. The basic configuration of Apache, etchttpdconfhttpd. conf, is the main configuration file of apache. You can modify the basic parameters.

The first six items in the required software httpd mysql-server php-devel php-mysql phpMyAdmin are available in yum, which are installed by default. PhpMyAdmin provides a link for manual installation. The basic configuration of Apache is/etc/httpd/conf/httpd. conf, which is the main configuration file of apache. Modify the basic parameters.

Required Software
  1. Httpd
  2. Mysql
  3. Mysql-server
  4. Php
  5. Php-devel
  6. Php-mysql
  7. PhpMyAdmin

In the first 6 items above, yum will be installed by default. PhpMyAdmin provides a link for manual installation.

Basic configuration of Apache
  1. /Etc/httpd/conf/httpd. conf is the main configuration file of apache. You can modify the basic parameters and the IP address is localhost.
  2. // Www/html is the default "home page" Directory of CentOS. The data displayed when "http: // localhost" is entered.
  3. The remaining Apache configurations are not required here, so we will not detail them here.
  4. Start/etc/init. d/httpd start of Apache, and disable/etc/init. d/httpd stop. Test netstat-tunl | grep ': 80'
Php Testing

You can write a PHP file under/var/www/html/. Here, you can write a test file.

$ Vim/etc/www/html/phpinfo. php

 

Then input http: // localhost/phpinfo. php In the browser. If the basic information is displayed, it indicates OK.

Start and test Mysql
  1. Mysql startup:/etc/init. dmysqld start
  2. Test: netstat-tunl | grep ': 3306'
  3. Manually connect to mysql: mysql-u root
  4. Set the root password for Logon: mysqladmin-u root password 'Password'
  5. Login: mysql-u root-p
  6. After logging on to mysql, you can use create database wordpress; (Note the plus points) to create a database.
  7. Show databases; view database
  8. Exit
Install wordpress
  1. Decompress woordpress.tar.bz2 to the/var/www/html/directory
  2. Cp wp-config-sample.php wp-config.php backup Profile
  3. # Vi wp-config.php # edit the configuration file and enter the database name, user name, and password
    // ** MySQL settings-specific information comes from the host you are using **//
    /** Replace "putyourdbnamehere" with the WordPress database name "*/

    Define ('db _ name', 'wordpress ');
    /** Replace "usernamehere" with the MySQL database username "*/
    Define ('db _ user', 'root ');
    /** Replace "yourpasswordhere" with the MySQL database password "*/
    Define ('db _ password', 'Password ');
Install phpmyadmin
    1. Decompress the phpmyadmin compressed file to/var/www/html/
    2. Cd/var/www/html/phpmyadmin/ phpMyAdmin-3.4.10.1-all-languages/
      # Go To The configuration directory
    3. Cp config. sample. inc. php config. inc. php # back up the configuration file
    4. Vi config. inc. php
      Modify
      // $ Cfg ['servers'] [$ I] ['controluser'] = 'pma ';
      // $ Cfg ['servers'] [$ I] ['controlpass'] = 'pmapass ';
      Is
      $ Cfg ['servers'] [$ I] ['controluser'] = 'root'; # mysql login Username
      $ Cfg ['servers'] [$ I] ['controlpass'] = 'Password'; # mysql logon password
    5. Test: http: // 127.0.0.1/phpMyAdmin/phpMyAdmin-3.4.10.1-all-languages/
    6. Log on with your account and password, where you can operate your database. For wordpress, we have already created it in the command line.

Then you can configure wordpress.

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.