LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Running .php file (https://www.linuxquestions.org/questions/linux-software-2/running-php-file-4175606437/)

sagxam 05-22-2017 08:01 AM

Running .php file
 
How do i run .php files in ubuntu 16.04, please give me steps of all the procedure, is there IDE for the same which one is the best?

sundialsvcs 05-22-2017 08:29 AM

If you are running the script from the command line, there are two distinct ways to do it:
  1. Run the php command and specify as the first parameter the name of the file that you want to run.
  2. Make the file 'executable,' and on the first line add a "shebang" line such as: #!/usr/env php. (Use the command, which env to find out exactly where the env command is located on your machine.) Now, you can simply "run" the script: the shell will find the "shebang" line and thus know which programming language to invoke.

If you want to run the command in a web server such as PHP or nginix, then ... "just Google it." :) Which might find you hits like these:

Doug G 05-23-2017 12:36 AM

Also, you may need to install php-cli on your computer separately, I don't believe all distros install the command-line php by default. On fedora php-cli is a separate package from php


All times are GMT -5. The time now is 11:02 AM.