How to run a PHP file on Ubuntu Linux from console

In the technological world, in order to be able to carry out various programs, applications and even operating systems, each one of them is created with programming code.

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

These can be open source and closed source ; The open source code can be seen by any user, that is, anyone can access it, while the 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 a Linux distribution that works as an operating system that you can use easily and quickly install. Its name that 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 objective that you as a user can make easy downloads as well as installations for free in more than 130 languages, so it is possible to install packages or programs in Ubuntu from the terminal .

It is important that you know that Ubuntu has a web browser, multimedia player, music player, instant messaging, photo editor, text editor, disk recorder, and mail. You can even currently find Ubuntu Phone, Ubuntu Tablet and even Ubuntu TV .

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

What is PHP?

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

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

Many prefer this PHP language as it is compatible with the most 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 that uses PHP has the PHP programming language, in addition the browser provides you with exposes the stored web pages.

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

Also with PHP you can make numerous applications to use on the desktop feasible on any existing platform. The advantage of including PHP on a Linux server 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 console?

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

Step 1

If you do not 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 site, 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 terminal name there “open it”.

Step 3

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

Step 4

“Write” the following command “php5 filename.php” in script, that way you can change your script with the name that corresponds to it. To exit the terminal tab “type” the command Exit or Exit and now you can run your PHP files in Ubuntu.

 

Leave a Comment