Home  >  Article  >  Backend Development  >  How to run php on linux

How to run php on linux

王林
王林Original
2019-10-14 17:57:057195browse

How to run php on linux

1. Open the linux command line.

2. Find the directory of the php executable file in the Linux environment. as the picture shows. My directory is /usr/local/server/php/bin, make a note of this directory.

How to run php on linux

3. Find the directory where the php file you want to run is located, and just write some php code, /usr/local/server/apache/htdocs/test.php, Make a note of this directory and start running it officially.

4. Open the linux command line just opened in the first step, enter /usr/local/server/php/bin/php /usr/local/server/apache/htdocs/test.php (that is, enter in sequence The two directories just mentioned) Note that there are spaces between the two directories.

5. Press Enter and you can see that the php file has been executed correctly.

Recommended tutorial: PHP video tutorial

The above is the detailed content of How to run php on linux. 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