ComputersSoftware

Configuring Apache and adapting to PHP

Modern WEB-construction is carried out in programming languages, the work of which is possible only with the use of a special interpreter. Most often, PHP-based development on the basis of Apache is a server simulation program. So the user is not tied to hosting and can develop a site without an Internet connection. Installation and configuration of Apache is carried out in several stages, after which you should install PHP to the program. Initially, you need to download the installer files.

At the root of any computer disk, a folder with the original name is created, let's call it Development. It is embedded in another folder called Servers, which will be installed Apache.

Next, the server installer starts. In the information window, you need to enter a single word in all fields - localhost, while in the "email" field you can specify a real address. The PHP-Apache configuration does not affect any of them, so the fields do not have a particular information value. In the selection window of the installation directory, the created Development folder is selected, then Servers and the server portfolio in it.

When the installation is complete, a feather with a green arrow appears in the tray. This means that the program is running and ready to use. To make sure that everything works, you need to go into any browser and type localhost in the address bar . "It works!" Appears in the display area. Here we see that the basic configuration of Apache is done, and now it remains to fasten PHP.

To do this, the development language installer is launched, and when the window for the installation method appears, select the radio button with the name of the version of Apache installed. The next window selects the place where the interpreter will be located. In our case, you need to register the path to the created folder under the server name.

In order for the Apache configuration to succeed, you need to change some configuration files. In the portfolio where the server is installed, it is necessary to find the subdirectory conf. Opening htdocs in Notepad, you need to change several lines. The first is the way to projects. It specifies the address of the folder in which the files played by the interpreter will be located.

In addition, in the field of the value of the DocumentRoot command, you should also specify the path to the projects. Setting up Apache is complete, now the server is being tested. For this purpose, a file called index.php is created in notepad. It prescribes the command:

?>

The document is saved in the project folder, after which you must go to the path C: \ Windows \ System32 \ drivers \ etc. Here you should find the hosts file and at the very end write the local address - 127.0.0.1 test. Since this document is more important than DNS servers, when you enter the words "test" in the address bar, the search for the source file of the site being reproduced will be performed on the computer's own ip-address, that is, locally.

In addition, it is recommended to make other changes to the configuration of the Apache program:

  • The VirtualHost command is assigned as follows - .
  • The server name is ServerName test.
  • The error file is ErrorLog logs / test-error.log.
  • The error log is CustomLog logs / test-access.log common.

Thus, the Apache configuration and its adaptation under PHP are completed. After rebooting the application, you need to play the index.php file. The browser will display information about the interpreter language.

Using Apache with PHP, complex scripts are reproduced, they allow you to access forms, navigate, make the resource faster. Thus, it is not necessary to use third-party servers when developing a site.

Similar articles

 

 

 

 

Trending Now

 

 

 

 

Newest

Copyright © 2018 en.birmiss.com. Theme powered by WordPress.