Configuring the PHP development environment under Linux

Source: Internet
Author: User
Tags gz file php development environment phpinfo

Reproduced in: http://www.uxtribe.com/php/405.html

The station has a series of PHP articles.

Building a PHP environment under Linux is much more complex than Windows. In addition to installing software such as apache,php, you need to install some related tools and set the necessary parameters. Also, if you want to use the PHP extension library, compile it. Prepare the following installation package before installing:

    • Http-2.2.8.tar.gz. : http://www.apache.org.
    • Php-5.2.5.tar.gz. : http://www.php.net/downloads.php.
    • Mysql-5.0.5la-linux-i686.tar.gz. : http://www.Mysql.com.
    • Libxml2-2.6.26.tar.gz.


To configure the PHP development environment under Linux, you need to be aware of the following issues.

    1. The first thing you need to do is open the Linux terminal (almost all the software under Linux needs to be installed under the terminal). Open RedHat9 "main Menu/System Tools" and select "Terminal" command from the popup menu.
    2. Before installing PHP5, you need to check the Libxml version number first. If the Libxml version number is less than 2.5.10, you will need to install the Libxml high version first.
    3. Configuring Apache and PHP under Linux also requires the configuration of php.ini and httpd.conf.


Installing Apache under Linux
first, go to the official website http://www.apache.org Download the Linux "http2.2.8.tar.gz" compression package.
To install and configure the Apache server under Linux, proceed as follows:

    • Enter the directory of the Apache installation files, such as/usr/local/work.
    • Unzip the installation package and go to the httpd2.2.8 directory after completion, tar XFZ httpd2.2.8.tar.gz cd httd2.2.8
    • Set up the makefile, install the Apache server under User/local/apache2,./configure-prefix=/usr/local/apache2-enable-module=so
    • Compile the file. Make
    • Start the installation. Make install
    • After the installation is complete, type the following command in the Terminal window to start or restart the Apache service. /usr/local/apache2/bin/apachect1 Start/usr/local/apache2/bin/apachect1 Restart
    • Open Mozilla Browser and enter "http://localhost/" in the address bar to see if the Apache server installation was successful.


Install PHP under Linux
Before installing PHP5, you need to check the Libxml version number first. If the Libxml version number is small 2.5.10, you need to install the Libxml high version first. The steps to install Libxml and PHP5 are as follows:

  • Copy the Libxml and php5 to the/usr/local/work directory and go to the directory. Cd/usr/local/work
  • Unzip the LIBXML2 and PHP separately. Tar xfz libxml2-2.6.62.tar.gz tar xfz php-5.2.5.tar.gz
  • Go to the Libxml directory, set up Makfile, and libxml install to/USR/LOCAL/LIBXML2. CD libxml2-2.6.62./CONFIGURE-PREFIX=/USR/LOCAL/LIBXML2
  • Compile the file. Make
  • Start the installation. Make install
  • LIBXML2 installation is complete, start installing PHP5. Go to the php-5.2.5 directory. CD php-5.2.5
  • Establish makefile. configure-with-apxs2=/usr/local/apache2/bin/apxs\
  • Start compiling. Make
  • Start the installation. Make install
  • Copy the Php.ini-dist or php.ini-recommended to the/usr/local/lib directory and name it php.ini. CP Php.ini-dist/usr/local/lib/php.ini
  • Change the httpd.conf file-related settings, which are located in/usr/local/apache2/conf. Locate the following command line in the file: AddType application/x-gzip.gz.tgz Add the following command after the directive: AddType application/x-httpd-php.php Restart Apache, and create the file phpinfo.php in the Apache home directory. <?php phpinfo ();? >


Install MySQL under Linux
installing MySQL server on Linux system needs to go to the official website http://www.Mysql.com download Linux under MySQL installation package "mysql-5.0.5la-linux-i686.tar.gz".
The following are the steps to install and configure a MySQL server under Linux.

    1. Copy the downloaded mysql-5.0.51a-linux-i686.tar.gz file to the/usr/local/work directory, create the MySQL account, and join the group. Groupadd MySQL useradd-g mysql MySQL
    2. Go to the MySQL installation directory and unzip it (for example: Directory/usr/local/mysql).
    3. In view of the need for MySQL database upgrade, the/usr/local/mysql directory is usually built in a linked manner.
    4. Go to the MySQL directory and build the MySQL database in/usr/local/mysql/data.
    5. Modify file permissions.
    6. To this MySQL installation succeeds. The user can start the MySQL service by typing a command in the terminal. /usr/local/mysql/bin/mysqld_safe-user=mysql& after startup, type the command to enter MySQL. /user/local/mysql/bin/mysql-uroot


Publishing sites under Linux
Linux under the release of PHP-based Web site, the first need to configure PHP operating environment, the next need to set the network card parameters. Like what:

    1. Assume that you have applied for the following network parameters: ip:192.168.1.* netmask:255.255.255.* network:192.168.1.0 broadcast:192.168.1.* gateway:192.168. 1.* Host Name: ABC dns:168.95.1.*
    2. Copy all the files of the Web site to the Apache home directory.
    3. Set the host name. In the terminal window, type the following command to edit the/etc/sysconfig/network file: Vi/ect/sysconfig/network set the parameter netqworking in the file to Yes to start the network, Set the parameter hostname to ABC, which indicates that the host name is "ABC".
    4. Set the network card parameters.  In the terminal window, type the following command to edit the file/ect/sysconfig/network-scripts/ifcfg-eth0:vi/etc/sysconfig/network-scripts/ifefg-eth0 Set the relevant parameters for the file as follows. DEVICE =eth0: Set the NIC name to correspond to the ifcfg-eth0. Onboot=yes: Specifies that the network adapter is started at boot time.  Bootproto=static: Sets how IP is acquired at startup. ipaddr=192.168.1.*: Set the server IP address. netmask=255.255.255.*: Sets the subnet mask. BROADCAST=192.168.1.*: Sets the broadcast address of the same network segment. getway=192.168.1.*: Sets the gateway for the NIC.
    5. Sets the IP for the DNS host. In the terminal edit/etc/resolv.conf file: vi/etc/resoplv.conf Set the value of the parameter nameserver to 168.95.1.*.
    6. Restart the network settings. In the terminal window, type the following command:/etc/rc.d/inin.d/network restart Ifdow eth0 ifup eth0
    7. Open the browser, in the Address column type the server IP address or domain name, can display the website, indicating the successful release.

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.