timohei.net / My Courses
/ ???/ T862203 FLOSS Projects 3 cu
/
How to create a php file
First, open an ssh session to students.oamk.fi
Then:
- Create a directory called public_html to your home directory:
mkdir public_html
- Change the permissions for the newly created directory to allow for web server to access it:
chmod 755 public_html
- Check that new directory shows up and has correct permissions:
rhea (t8heti09)4% ls -l
drwxr-xr-x 19 timohei 1024 Nov 26 15:14 public_html/
rhea (t8heti09)5%
- Go into the directory:
cd public_html
- Create a new php file using pico editor:
pico first.php
- Edit the file:
Click the image to enlarge it
- Save the file by pressing <CTRL>-X:
Click the image to enlarge it
- Press y to save
- Accept the file name by pressing Enter
- Now you are back to the shell:
Click the image to enlarge it
- Change the permissions for the newly created file to allow for web server to access it:
chmod 644 first.php
- Open a web browser and type in address http://www.students.oamk.fi/~your_username/first.php?x=First&second=The%20Other
- Your php script will print out the following:
Click the image to enlarge it
Updated 15.11.2020
© Timo Heikkinen | timo piste heikkinen at oamk piste fi