How to run a PHP file on Ubuntu Linux from the console

Who I am
Marie-Ange Demory
Author and references

In technological world, to build various programs, applications and even operating systems, each of them is created with a programming code.

In the market there is a variety of operating systems that you can use depending on the activities you are going to use, for example there are business systems that are ideal for companies, industrial and those for personal use.

These can be open source e closed source ; Open source code can be viewed by any user, that is, anyone can access it, while closed source code cannot be viewed, even if you have previously purchased its license or permission.

The most common operating systems used by users are Microsoft Windows, GNU / Linux, OSX, Chrome OS, Unix, Free BSD, Solus Os, Mac, Linux Lite, Linux Mint, Ubuntu and Ubuntu.

What is Ubuntu?

Ubuntu is one Linux distribution which works as an operating system that you can use easily and install quickly. His name which means: humanity towards us comes from the African tribe called Zulu, whose name was chosen by the British company Canonical Ltd.

Ubuntu was created with the goal that you as a user can carry out easily download and installations for free in more than 130 languages, so you can install packages or programs in Ubuntu from the terminal.

It is important that you know that Ubuntu has a web browser, media player, music player, instant messaging, photo editor, text editor, disk recorder, and mail. At the moment you can even find Ubuntu Phone, Ubuntu Tablet, and even Ubuntu tv.

Ubuntu gives you the possibility that you as a user can submit your ideas, suggestions or complaints so that in the future, before making new versions, they take them into account for their best performance, accessibility and security.

What is PHP?

PHP is a language of programming of scripting open source created in 1994 by Rasmus Lerdorf. PHP comes from the English acronym for Hypertext Pre-Processor, which in Spanish means hypertext pre-processor. It should be noted that it is possible to install Apache2-php-Mysql and Phpmyadmin on Ubuntu.

It has a HTML programming compatible with most databases, as well as being flexible because you can learn it easily.

Many prefer this PHP language as it is compatible with popular databases such as ODBC; Oracle, MySQL, Informix and mSQL:

PHP contains three main components such as a web browser, a server and a parser. The server using PHP has the PHP programming language, in addition the browser provides you and exposes the stored web pages.

You can create its command lines without the need for a server or browser as you would only need to use its parser in PHP.

Also with PHP you can make many applications feasible for use on the desktop on any existing platform. The advantage of including PHP on a server Linux is that it is much faster because it takes up little memory space.

PHP is the language most used by programmers and therefore its files are executed on the different web servers available on the Internet. These files are customized as web pages that have codes so that later online you can execute them

How can you run a PHP file on Ubuntu Linux from the console?

If you want to run your PHP language file from Ubuntu Linux, on below I will show you how to do it step by step, but you can also learn in more detail what a PHP file is and how to run them? 

Step 1

If you don't have PHP installed on your computer, specifically in the software distribution depot, "download it" in Synaptic Package Manager or from the Internet on its official website, download its source code.

Step 2

Go to the main menu "Applications" click and you will see the tab with the name of Utilities or Accessories; below you will see the tab with the name of the terminal there "open it".

3 pass

Once opened, write “cd” in so that in this way you can change the directory of the PHP file, you can change it to the exact name.

4 pass

"Type" the following command “Php5 filename.php” in script, in this way you can change your script with the name that corresponds to it. To exit the terminal tab, "type" the Exit or Exit command and you will now be able to run your PHP files in Ubuntu.

add a comment of How to run a PHP file on Ubuntu Linux from the console
Comment sent successfully! We will review it in the next few hours.