MAC OS configures PHP development environment through XAMPP and PHPStorm (first contact with PHP)

Ready to work

XAMPP

Install

XAMPP is a development environment toolkit that integrates Apatch and Mysql.

After downloading, go to the next step to complete the installation. After installation, 应用程序you can see XAMPP in . Click manager-osxto start

configure

Modify the root directory

XAMPP integrates basic components such as Apache and Mysql required by the PHP development environment. But the root directory that comes with the system is /Applications/XAMPP/htdocs. Sometimes we want to change the website root directory to our custom directory folder. This can be achieved in the following ways

  • 1 Open the application->XAMPP->xamppfiles->etc->httpd.conf document (open with a text editor)
  • commond+fSearch DocumentRootand find the following results
 
 
# DocumentRoot: The directory out of which you will serve your # documents. By default, all requests are taken from this directory, but # symbolic links and aliases may be used to point to other locations. # DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs" <Directory "/Applications/XAMPP/xamppfiles/htdocs">
  • 3 Modify the path in DocumentRoot and Directory to the path you want, the two paths should be the same


PHPStorm

Install

After downloading PHPStorm, the next step can be installed successfully

configure

  • Set the development directory

Click after opening PHPStorm Create New Project, and then select the directory to XAMPPthe root directory set above.

  • Configure the PHP development environment
    When the project is created and then click Run, the upper right corner will appear as shown below

Solution:
Click PHPStorm—>Preferences to jump to the following page.


After interpreterselecting the PHP environment path. It will jump to the page shown in Figure 1-3 below. Add PHP, and PHP executablethen select the folder under the XAMPP installation directory bin. The system will automatically identify the PHP installed version. After clicking ok, you can develop








Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325797583&siteId=291194637