Construction and configuration of LAMP environment under LINUX

lamp

 

(Web Application Software Portfolio)

When building a dynamic website, you need to install the relevant software packages. LAMP ( linux+Apache+MySQL+PHP ) is a better choice. For special requirements, it can be set through the corresponding fields in the main configuration file. The serveradmin field can set the administrator's email address, the directoryindex field can set the homepage file, and the maxclients field can set the number of client connections.

1. Apache installation and configuration

2. MySQL installation

First, check if MySQL is installed


The corresponding rpm package

Note the installation order:

first rpm package


second rpm package


The third rpm package


Fourth rpm package


After MySQL is installed, restart the MySQL service and check the service status


(At this point, pay attention to the difference between the service name and the package name)

Then we set the username and password for MySQL


Then we log in to test


OK, the setting is successful

3. PHP installation

Let's take a look at the rpm packages required by the php environment


By default, the first three have been installed, the following two are not installed, here is the installation of the following two apm packages (pay attention to the installation order)

Install first


post installation


OK, so our lamp environment needs to be prepared, and then we start these services (remember, PHP is just an environment, not a service, so we only need to start the Apache service and MySQL)


OK, the service has been started, the DocumentRoot path we set in the last configuration is /var/www/html, then we will create the index.php file in this folder, by the way, the default access file in httpd.conf plus an index.php


save and restart the service



It should be noted that when the editor started doing it, the browser found that it was blank, and then the editor searched on the Internet. Summarize some experiences to share with you

1. Enable the function of reporting errors


Enable the error display function in the PHP configuration file php.ini

Then the editor opens here to access 127.0.0.1

The following error message appeared

Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0 Fatal error: Unknown: Failed opening required '/var/www/html/index.php' (include_path='.:/usr/share/pear:/usr/share/php') in Unknown on line 0

At this time, the editor was stunned. There was a problem with the include import path mentioned above. Then I found the php configuration file and found that the include was commented out. Finally, the editor had to ask Du Niang for help.

The intermediate process is no longer verbose, and I will tell you the solution directly.

2. Set the path of the directory to be readable

Be sure to pay attention (this is not a directory, you must go to your index.php file) otherwise it will not open and report an error


Then we can successfully open the content of our index.php, here the editor shows the PHP information and html code


OK, at this point, it means that the lamp environment has been fully configured and running normally. I hope my explanation can help you!


Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326721964&siteId=291194637