"PHP" Linux build PHP running environment

Source: Internet
Author: User

Before the Windows Write Hello World, after all, is not enough Ah, because the development environment is Linux, how to do it ~ ~ ~ Learn to learn and learn again

Written in front of the words: I from the Baidu Library of an article picked out, the original article name "Linux installation Apache+php+mysql build PHP running Environment"

Http://wenku.baidu.com/link?url=7A49L1QOIznRoJVz7fC6qaHGiCHTYacwYTLZJEIT_E7URXqgoftdsZdl0tLfKn2n_Tb8PPZ4LqYsA_ f1xn5jbovpir-ag7quvmppx34ft9a

Installation environment: Red Hat 4.8.2-16

Required installation software:

    • Apache
    • Php
    • Mysql-server

An Apache installation

1 checking, deleting, installing

Rpm-qa|grep httpd    // Check if ApacheRPM-E package name is installed--nodeps    // If any  , remove PS: I did not delete, Directly with the original server.
Yum install httpd //installation, follow the prompts, enter Y to install the success

2 Start, test

/ETC/INIT.D/HTTPD start

Note: You can use/ETC/INIT.D/HTTPD Status/stop/start/restart to View status/stop/start/restart respectively
You can also use the service httpd status/stop/start/restart command, with the same effect

Enter the server IP in the Windows browser and view the page as follows to indicate that the Apache installation was successful

Two install MySQL

1 checking, deleting, installing

rpm-qa|grep-i MySQL           // Check if the MySQLrpm-e package name is installed--nodeps            // Delete If any, there are some libraries and header files, None of my side, after installation, had not been found in the path he had said.  // installation, as prompted, enter Y to install successfully. If you are prompted for a lack of dependency, use the Yum install directly, I have not met

2 Configuring, booting

  • Copy file: Cp-f/usr/share/mysql/my-medium.cnf/etc/my.cnf (overwrite can be)
  • Set Password: MySQL secure installation (enter Y as prompted, enter the password 2 times, return. The thanks for using mysql! appears Indicates success)
  • Remote access:
    Mysql-uroot-proot   //-U is followed by username, and after-p is password use mysql; Select  from  Set host='%'where user='root ' // Ignore errors in the event of an error flush Privileges; Select  from user;
  • Start Mysql:/etc/init.d/mysqld start//service mysqld start same effect

Three-install PHP

1 installation

// Install PHP // installing components, supporting MySQL

2 Configuring, booting

    • The original article wrote a lot of configuration, I do not know what to do, temporarily did not follow his change
    • Start: Restart httpd mysqld
    • After you finish writing the PHP program or modify the program, execute the command service php-fpm Reload Reload

Four-Test

1 Test procedure

  • index.php
     <? PHP  phpinfo   (); ? 
  • index1.php
    <? PHP     $link mysql_connect  die (mysql_error());     if ($link! =false)        {echo "successfully connected to MySQL";    } Else         {echo "connection to local MySQL server failed";}     Mysql_close ();? >

2 Put it in the root directory of PHP ,

    • and perform service php-fpm reload
    • Can also be configured yourself: cat/etc/httpd/conf/httpd.conf (documentroot "/var/www/html/")
    • You can also modify the file path such as:/var/www/html/test/index.php.
    • The corresponding access URL is ip/test/index.php

3 in the browser page access ip/index.php ip/index1.php, the following page

"PHP" Linux build PHP running environment

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.