Home > Article > Backend Development > 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.
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!