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
- Install Apache (yum installation)
- Weird write permission
- PHP
- Install PHP (yum installation)
- Install extension (mbs)TrIng, gd, xmlWriteR)
- MySQL
- Install MySQL (yum installation)
- MySQL table name is case sensitive
- InstallPhpMyAdmin
Apache
- 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:
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
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:
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:
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:
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!