english

learn php

learn php

1. where to start

assignments
2 minutes / 381 words

one / assignments

don't worry. this is an introductory section so your assignments don't involve writing any code. they're just setting things up so you can start learning.

before we even start with tasks, though, there's something you should know about assignments. they're progressive. you will know everything you need to do the assignments by the time you get to them but not necessarily everything to do them the easiest or most efficient way possible. don't worry about that. they're meant to test specific skills and you'll come back to similar tasks later once you've learned more.

first, you need to choose what editor you're going to use. as i've said, i suggest using zed but you can use any text editor. you definitely want to make sure it can open whole folders instead of single files, though, or this is going to get very cumbersome for you.

the next thing you need to do is choose whether you're going to run your php on an outside server or on your local machine acting as a server.

if you're going to use an external server, make sure you know the username, password and address of that server and can connect to it from inside your text editor.

if you're going to use your local machine as a server, make sure you have a web server installed and running. apache or nginx are my recommendations but any web server that can handle php is totally fine. once that's installed, make sure you know where the web root directory is and that you can access it from inside your text editor.

now that you have a working server somewhere...

save an html file in the root directory of that server's web directory and make sure you can access it in your web browser. it can be as simple as "this is a test" but make sure it displays properly.

next, create a php file (perhaps "test.php") and save it to that same directory with this inside...

<?php
print_r("this is a test.");

then access it from your web browser.

if you see this is a test. in your browser, you have successfully tested to make sure php will run when you code in your editor and you're ready to move on.

learn php

© avi sato. creative commons attribution-noncommercial-noderivatives.