Skip to content
Related Articles

Related Articles

How to Run PHP File in Chromebook?

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 21 Mar, 2022

Chromebook is a new type of desktop. It is basically run in a chrome operating system. It is a kind of laptop. But it is very cheap compared to a laptop. Because of these, as it is run in web-based chrome operating system it is slow & less usable than laptops. But as it is cheap in price so, many people buy this product as they want to do a limited number of task or operations. Compared to laptops Chromebooks may not support some software. As PHP is mainly a web-based programming language, it can be run in Chromebook. We can’t install it as we do in normal Windows or Linux machines. But, we can install it in another way. For, running PHP files we need to install PHP in Chromebook. But, before installing PHP, we need two prerequisites. First and most important, we need to install Linux Terminal in Chromebook. It is the command prompt of the Chromebook. Similar to the Linux terminal. And we need to install Apache in it. Apache will help PHP codes run on the server. Then we can proceed with it.

Features:

  • PHP helps us to run HTML & PHP files easily.
  • PHP is widely used for its simplicity, platform-independent & faster features.
  • Chromebook is an accurate device to run PHP files. As it is mainly operates by Chrome operating system.

Installing PHP in Chromebook

Step 1: At first, the Linux terminal should be opened. Then write the following command. It will install the proper version of PHP according to your Chromebook model. There is no need to worry about the version. As it has the ability to install the proper version as per the Chromebook model.

sudo apt install php

After writing the command you need to wait a while. As it will start the installation.

Installing-PHP

Step 2: After some time the screen will pause automatically. As it needs confirmation. Then it will execute the next steps. For giving confirmation only enter Y. It will start its process again.

Press-y-button

Step 3: You need to wait for some time. As it will install all packages of PHP in Chromebook. Also, it needs to configure itself with the machine. It is also going to make some changes to your server so that PHP files will run easily.

Wait-for-the-installation-process

Step 4: At last, PHP installation is completed. Now, you have to browse to localhost. This will provide you with all the information about your installed PHP. this is going to be your handbook in PHP. While using PHP, you need to go through this link many times. If the details come to you, then you have successfully installed PHP.

Php-is-successfully-installed

Create and Run PHP file in Chromebook

Step 1: For creating a PHP file in Chromebook the following command should be run first. This command will help to create a PHP file in a certain folder where the PHP file can run.

sudo vi /var/www/html/<file_name>.php

Create-a-php-file

Step 2: Then an editor-type interface will be opened in that terminal. Easily a  PHP code can be written in that & save it using Ctrl+S. Here, the below simple code has been used.

PHP




<?php
    echo "Hello World!";
?>


Step 3: Then after saving that file the following command should be run. This command will automatically run that PHP file. It will open that file in Chrome. This is the way to run any PHP file in Chromebook.

cat /var/www/html/<file_name>.php

Opening-that-file-in-Chrome

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!