Home  >  Article  >  Development Tools  >  Detailed graphic and text explanation of how to publish Phpstorm projects to apache under ubuntu

Detailed graphic and text explanation of how to publish Phpstorm projects to apache under ubuntu

藏色散人
藏色散人forward
2021-07-23 15:19:282233browse

I found it unreliable on the Internet. After struggling for a long time, I finally found the correct posture QAQ, just with this Backup.

By the way, JetBrains is an amazing company. Their entire series of IDEs are the best IDEs, and it is highly recommended to learn and use them. Google's official Android Studio is also based on their IDE. I think it is much better than eclipse. The most important thing is that it is beautiful and easy to interact with.

[Recommended learning: phpstorm tutorial]

1. New project

1. New project

File->new Project. Select PHP EMPTY PROJECT
2. Determine the project directory

Location column, you can click the... button on the right to select the directory or type it by hand
3. Determine the PHP version

PHP languge level column
4. Determine the PHP interpreter

CLI Interpreter column

New project part allocation diagram
Detailed graphic and text explanation of how to publish Phpstorm projects to apache under ubuntu

2. Edit the project

Just output something in index.php, you can also call phpinfo()

3. Deployment configuration

Tools-> in the top menu Deployment->Configuration

Open the picture below

Detailed graphic and text explanation of how to publish Phpstorm projects to apache under ubuntu

Click the green plus sign in the upper left corner, select Local or mounted folder for Type, choose whatever you want for Name, and click OK

In the picture below, the Folder under the Upload/download project files column is the project upload directory. Here you need to select your apache root directory. Under ubuntu, here I set it to /var/www

The Web server root URL below is the root link when starting the browser. Here I set it to http://localhost. Then when I run the index.php in the root directory of my project under phpstorm, phpstorm will automatically create it for me. The browser opens the web page with the URL http://localhost/index.php

Detailed graphic and text explanation of how to publish Phpstorm projects to apache under ubuntu

Select the Mapping tab

Local path is your local project directory

Deployment path on server is the relative directory to the upload directory set in the previous step. For example, if I fill in nothing here, or only fill in a /, then all the projects will be placed in the /var/www directory after I release it. Next, the index.php path of the project is /var/www/index.php. If you fill in /test, the subdirectory test will be created in /var/www before publishing, and then the project files will be published to this test directory. Then at this time The index.php path is /var/www/test/index.php

WebPath on server is a relative access path. Earlier we set the Web server root URL. The path set here is relative to that URL. For example, if If it is set to test here, then after publishing, the browser will automatically open the URL "http://localhost/test/the file name you want to run". If you fill in nothing, the URL will be "http://localhost/you want to run it". The running file name is "

, so here are the following points to note: apache's web service directory, web access root path Web server root URL, project release directory Deployment path on server, relative access path WebPath on server. Be sure to configure these four correctly
Detailed graphic and text explanation of how to publish Phpstorm projects to apache under ubuntu

Click OK

For convenience, you can also select the Tools->Deployment->Automatic Upload option in the top menu, so , when you edit and save, Phpstorm will automatically help you publish the project to the directory just specified.

4. Run

Place the mouse on the editing page of index.php, and a row of small browser icons will pop up in the upper right corner. Click on the browser you want to run, and PHP will open the browser for you and automatically open the URL you set earlier

Detailed graphic and text explanation of how to publish Phpstorm projects to apache under ubuntu

Detailed graphic and text explanation of how to publish Phpstorm projects to apache under ubuntu

you You can also try using the shortcut key ctrl shift f10 to run. In Firefox, you can use ctrl w to close the current window and alt tab to switch windows.

Learn to use shortcut keys to look more professional=3=

For more phpstorm technical articles, please visit phpstorm Tutorial column!

The above is the detailed content of Detailed graphic and text explanation of how to publish Phpstorm projects to apache under ubuntu. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete