Problems that may occur when building a LAMP environment using Fedora15

Source: Internet
Author: User
LAMP is short for Linux + Apache + MySQL + PHP. It is very popular in website development. It is very easy to build a LAMP environment under the Red Hat Linux release of Fedora. You only need to use yum to easily install Apache, MySQL, and PHP. But in fact, it is often not enough to install these things only using yum, for example, you

LAMP is Linux + Apache + MySQL +PHPThe abbreviation of this golden group is very popular in website development. In FEdIt is very easy to build a LAMP environment under the Red Hat Linux release. You only need to use yum to easily install Apache, MySQL, and PHP. But in fact, it is often not enough to install these things only using yum. For example, you may find that the PHP you install lacks many extensions, or the table name in the MySQL database is case sensitive and does not meet your habits, or Apache may encounter some non-sequential results on file read/write permissions. This article records the problems and solutions I encountered when building the LAMP environment on my own Fedora 15 system, because I am a lazy person, therefore, these methods are the simplest solutions in my opinion. Other Linux distributions can also use this as a reference (for reference only !).

Index:

  • Apache
    1. Install Apache (yum installation)
    2. Weird write permission
  • PHP
    1. Install PHP (yum installation)
    2. Install extension (mbs)TrIng, gd, xmlWriteR)
  • MySQL
    1. Install MySQL (yum installation)
    2. MySQL table name is case sensitive
    3. InstallPhpMyAdmin

Apache

  1. Install Apache

    Install the Apache server (HttpdYou can download the source code and compile it on your own system, or directly use yum to install the compiled version. We recommend that you directly use yum to install the compiled version, which is easy to install and easy to update. Use yum to installCommandAs follows:

    1
    SuDoYumInstallHttpd

    The command to start httpd is as follows:

    1
    SudoService httpd start

    Or:

    1
    Sudo/Etc/Init. d/Httpd start

    By default, the website path is/var/www/html. If you create a new xxx.html file in the directory, you can view the webpage through http: // localhost/xxx.html.

    If you can access your website on your computer, but you cannot access your website through others, it is likely that your firewall has disabled port 80 and enabled it.

    AvailableChkconfigRun the following command to set httpd To Enable Automatic startup:

    1
    SudoChkconfig-- Level 235Httpd

    For more information about chkconfig, see:

    Http://www.linuxIdC.com/Linux/2011-08/40085p4.htm

    Weird write permission

  2. This was a problem that I had been tossing for a long time. Specifically, a ready-made PHP program is built in its own LAMP environment, but some directories are prompted to be writable when running its installation script. For example, if the/var/www/html/something directory is not writable, runChmodCommand:

    1
    Sudo chmodA +W/Var/Www/Html/Something

    Then useLsCommand to view the permissions of this directory:

    1
    Ls -Al /Var/Www/Html

    The permissions of the something directory you see may be drwxrwxrwx or others. However, if there are 3 w, the chmod command is successfully executed, in theory, this directory is writable. However, when the installation script is run, the prompt does not disappear, so we try the recursive chmod command:

    1
    Sudo chmod -RA +W/Var/Www/Html/Something

    This cannot improve our situation. Some people say that it may be the permission of the Apache server user. For example, to create a php file in the httpd directory, add the following php code:

    1
    Echo ExEc('WhoAm'); ?>

    The result is apache. Open the httpd. conf file under/etc/httpd/conf/and you can see that there is a record of user information in it:

    1
    2
    User apache
    Group apache

    So I tried again.ChownCommand to change the file owner to apache:

    1
    Chown -RfApache. apache/Var/Www/Html/Something

    The results are still disappointing. Just when the mountains were exhausted, people clicked to find out the root cause of the problem-it was not a problem with the file read/write permission setting. All the initiators were SELinux!

    So I tried to disable SELinux:

    1
    Sudo SetEnforce0

    The result is finally successful! This result is really painful! "The eyelashes are not visible in front of you", "suddenly looking back, the man is in the dark of the lights!

Related Article

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.