cool hit counter Summary of configuring PHP standalone development environment under win10_Intefrankly

Summary of configuring PHP standalone development environment under win10

Last night, I was obsessive-compulsive and felt that my computer was very messy, so I reinstalled my system and took this opportunity to install a standalone development environment for PHP, which had previously been the integrated environment Wampserver.

Software used in this article. Cloud Download Password: jwga

1.Installing the Apache server

You can't download the Apache server installation package on the official Apache website, only the Apache source code, which needs to be recompiled in VC++ and configured with a lot of stuff (a million horses are going through... ). So instead of using this method, you can find the Apache installer directly on the internet, here I used the 64-bit Apache HTTP server version 2.4 msi installer.

Once the installation is complete, let's test to see if Apache is installed successfully. Open your browser and type localhost, or in the address bar, and also the ipv4 address on your own computer, all three inputs are possible. see that It works! Then the installation is successful.

Change the default site location

above, We visit localhost time, What is used is Apache Installation directory hit the target htdocs Inside the folder index.html documents, this onehtdocs The folder is also known as Apache The default site location of the。 In the usual development, It's definitely not convenient to put it in this folder, Here's how we'll modify it。 It's also easy to modify, turn Apache Installation directory hit the target conf folder under the httpd.conf documents, modify DocumentRoot The back path because of Where you want to host your website, Immediately after the same modification below Directory The path in is the same as above. Remember to restart the Apache server each time you modify the Apache configuration file httpd.conf for the changes to take effect. In the new site location, we can create a new html file to test if the changes are successful.

Modify default web directory

Two notes.

    1. Do not install Apache in a path with Chinese characters, otherwise it will fail to start, it is recommended to install it in a separate folder, my installation directory is as follows.

    Installation directory

  • 2.The bit number of the software, because after Apache and PHP interpreter union, if the software bit number is not the same, Apache in loading PHP module will not be found error, Apache is 64-bit, the installation of php also must be 64-bit, the software in the cloud disk are 64-bit.

2.Installing PHP

PHP is available for download on the official website, PHP7 has already been released, but the most widely used version, PHP5.6, is chosen here Download Portal . After we download PHP, we just need to extract PHP to the folder where we want to install it. Then modify the directory in the php.ini-development file name because of php.ini , I made a copy here for modification.

PHP Directory

3.The union of PHP and Apache

Once Apache and PHP are installed, they still don't know each other, so how do we get them to know each other? In the Apache configuration file httpd.conf, we add the following lines (the content after # is a comment), noting the left slash in the file path. Restart the Apache server after making the changes.

 #1. Load PHP module
LoadModule php5_module E:/php5.6/php5apache2_4.dll
 #2. Configure the correct path to the php.ini file
PHPIniDir E:/php5.6
 #3. Add PHP type file to Apache server
AddType application/x-httpd-php .php .html .htm

Apache and PHP Joint

Here's how we change the default homepage of our website, search for DirectoryIndex Add index.php to the end of it.

Change the default homepage of the website

We can test whether Apache and PHP are successfully joined by creating a new index.php in the directory of the website we just modified, writing the following code in it and saving it, then typing localhost in the browser and seeing the information about PHP, which means that Apache and PHP are successfully joined.


PHP Information

4.Installing Mysql

There is nothing special to note about installing Mysql, just go all the way to Next, but you can also choose the components you want to install according to your needs.

5.PHP opens Mysql related extensions

PHP harmony Mysql build relationships, It is through Turn on the appropriate PHP Extensions to achieve。 This is where we're going to open PHP Installation directory under php.ini 。 Find inside the mysql Related statements, Delete the semicolon before each statement, Here the semicolon is also a comment, Journalist reboot Apache server。

Enabling Mysql-related extensions

The test methods can be either

  • 1.Using the index.php file we wrote earlier, type localhost into your browser address and search for mysql-related information. If you see the message shown below, you can tell that the Mysql-related extensions are successfully enabled.

Mysql opened successfully

  • 2.To connect to the database for testing, you can replace the code inside the index.php file that you wrote earlier with the following code.
$mysql = new mysqli('localhost',' Write here yourmysql Database administrator account name',' Write the password corresponding to the account here');
    die(' Database connection failure'.$mysql->conncet_error);
echo " Database connection successful!";

Typing localhost into the browser again shows Database connection successful! If the Mysql extension is on, then it is also on! The undefined message reported can be ignored or removed by modifying, in php.ini, the error_reporting = E_ALL because of error_reporting = E_ALL & ~E_NOTICE

Removing undefined information

Well, here we are, and our PHP standalone development environment is now installed. Of course, for beginners it is advisable to use an integrated environment, phpstudy, Wampserver and other integrated development environments are good, so that you don't let the environment affect your learning of a language, and after you get started with PHP, you can try to install a standalone environment for PHP.

1、A Git client implemented in 500 lines of Python code You should be able to find a job at that level
2、An article detailing big data technologies and application scenarios
3、Multimeasures to build a worldclass smart city
4、Excellike crossworkbook finder macro tool version 01
5、Artificial intelligence may replace manpower and some people will lose their jobs so why are some people not paying attention

    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送