Home  >  Article  >  Backend Development  >  How to put php project on the server

How to put php project on the server

尚
Original
2019-10-28 09:56:196322browse

How to put php project on the server

Setting up the server PHP environment and precautions:

Recommendation: php server

1 , Installation of Apache2:

sudo apt-get install apache2

After the operation is completed, open the browser and enter the IP address. If the welcome interface appears, the installation is successful

Note: The root directory of the website is /var/www/ html

2. PHP installation

sudo apt-get install php7.0

After the operation is completed, enter php -v to check whether PHP is installed successfully.

Note: If you need to bypass Apache to be able to recognize and parse PHP files, you must install a mod. The installation code is as follows:

sudo apt-get install libapache2-mod-php7.0

3. MySQL installation

sudo apt-get install mysql-server mysql-client

You will be prompted during the installation process. Set the login password for the root account, enter it and select OK to continue the installation

Note: Similarly, we also need to enable MySQL to interact with PHP and install the MySQL plug-in for PHP:

sudo apt-get install php7.0-mysql

4. The rest Software package

We can also install some commonly used PHP extensions, they are all software packages starting with php7.0-.

Use the server with PHPStorm to upload the PHP project to the server:

If you only use the server for development, this will not be a good idea, and it is A very dangerous and time-wasting note. Next, we use the IDE to work with the server and copy the project back and forth with U disk and network disk. As long as there is a network, my project can be seen anywhere.

1. Tools->Deployment->Configuration

2. Press Add a Server, the Name is arbitrary, select SFTP for Type,

3. You need to fill in SFTP host in Connection, which is your public IP address, Root pathSelect /var/www/html It is your project address. If you set other addresses, please modify this item, User name, Password are the username and password of your server respectively.

4. MappingsNeed to fill in Deployment path on server 'Local project name' is /, just click on the following folder.

5. If you want to use the server for debugging, please select Use this server as default. If not selected, the server you configured before will be used for debugging. If there is no configuration, the built-in server of PHPStorm will be used. Debugging (this is why there is a long string of characters behind the address bar during debugging)

6. If you want to upload to the server every time you save, please check Tools->Deployment ->Atuomatic upload(alway)

7. You can use Upload and ## under Tools->Deployment #DownloadUpload and download projects.

The above is the detailed content of How to put php project on the server. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to use php languageNext article:How to use php language