How to run PHP scripts on a Chromebook
How to run PHP scripts on a Chromebook
- Start Apache.
sudo service apache2 start
If you haven’t installed Apache and PHP, read that first.
Create PHP script
- Change the current working directory to the location where you want the script(s).
cd /var/www/html/
Put your PHP script somewhere in that folder or
a. On GitHub, navigate to the main page of the repository.
b. Under the repository name, click Clone or download.
c. Copy the URL under “Clone with HTTPS” or “Use SSH”
d. In Terminal, type git clone
, and then paste the URL you copied in Step c.
git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
f. Press Enter. Your local clone will be created.
g. To refresh your repository:
git fetch
Run from Chrome browser
- Get your IP address
- Open the Terminal app and type:
hostname -I
- Paste the IP address into Chrome, you should see an Apache2 Debian Default Page.
If the IP address doesn’t work, paste http://penguin.termina.linux.test/
into Chrome.
Run from command line
php /var/www/html/phpinfo.php
PHPinfo
If you are only interested in the output of phpinfo() you can see the same information from the command line with:
php -i
This prints it in a console-friendly format, rather than in styled HTML as phpinfo() displays.
Stop Apache:
sudo service apache2 stop