Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section Web Server
  • Search

How we run PHP program in terminal?

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
Post Reply
  • Print view
Advanced search
3 posts • Page 1 of 1
rajan
Posts: 1
Joined: Tue Feb 26, 2019 10:50 am
Contact:
Contact rajan
Website

Os: Ubuntu 17x
Web: apache + nginx
How we run PHP program in terminal?
  • Quote

Post by rajan » Tue Feb 26, 2019 11:03 am

I'm starting learning PHP but don't know how to run in terminal. On localhost successfully I can run.
Top

Emohlyni
Posts: 15
Joined: Wed Feb 27, 2019 1:34 am

Os: Debian 9x
Web: apache + nginx
Re: How we run PHP program in terminal?
  • Quote

Post by Emohlyni » Wed Feb 27, 2019 2:02 am

Starting from version 4.3, PHP supports the new SAPI type (Server Application Programming Interface) called CLI, which means Command Line Interface. As the name implies, the main task of this SAPI-type is to develop shell / shell (or desktop) applications using PHP. There are very small differences between the CLI SAPI and other SAPIs, which will be further discussed in this chapter.

The CLI SAPI was released for the first time with PHP 4.2.0, but then it was an experiment, and you had to explicitly turn it on with the --enable-cli command when starting ./configure. Beginning with PHP 4.3.0, the CLI SAPI is no longer experimental and is always embedded and installed as a binary php executable (called php.exe in Windows).

Significant differences of CLI SAPI from other SAPI:

Unlike CGI SAPI, no headers are written to the output.

Although CGI SAPI has a way to suppress HTTP headers, there is no equivalent switch for including them in CLI SAPI.

There are certain php.ini directives that are redefined in the SAPI CLI because they have no meaning in the shell environment.
Top

mehargags
Support team
Posts: 1096
Joined: Sat Sep 06, 2014 9:58 pm
Contact:
Contact mehargags
Website Skype

Os: Debian 8x
Web: apache + nginx
Re: How we run PHP program in terminal?
  • Quote

Post by mehargags » Wed Feb 27, 2019 1:40 pm

in short

in your SSH Terminal run any PHP script using
/usr/bin/php <path-to-script-name.php>
Top


Post Reply
  • Print view

3 posts • Page 1 of 1

Return to “Web Server”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

cron

Login  •  Register

I forgot my password