In order to begin writing PHP scripts, you need access to an online server running PHP.
Your main options are:
Run PHP on your own computer: The easiest thank to try this is to put in an entire package like XAMPP. This contains the Apache Web server, along with PHP and also the MySQL information engine, in one easy-to-install package. XAMPP is available for windows,MAC OS X & Linux. (A popular various on Windows is WampServer.)
Run your PHP scripts on your Web host: If you already have an online hosting account that supports PHP then you’ll transfer your PHP scripts via FTP and run them on the online server. The advantage of this approach is that you haven’t got to put in anything; the disadvantage is that it’s slower to jot down and test your scripts.
Creating the script:
To create your script, you’ll want to use a text application. Most computers come with one or a lot of text editors inbuilt — for example:
Note on Windows
Emacs on Linux
TextEdit on Mac OS X
Copy and paste the script code listed above into an original document in your text setup, then save the file as hello.php in the document root folder — that’s, the top level of your web site — on your disk drive. If you’re not certain wherever your document root folder is then consult your internet server system. Common locations include:
X-A-M-P-P on Windows: C:/Program Files/xampp/htdocs/
X-A-M-P-P on Linux: /opt/lampp/htdocs/
X-A-M-P-P on Mac OS X: /Applications/XAMPP/htdocs/
If you want to run the script on your internet hosting account instead of your own pc then you’ll have to transfer the script victimization FTP instead.
Find out a lot of regarding the document root, as well as updating files, in Getting started with your internet hosting service.
Testing the script:
Now you are prepared to run your script. To do this, open a Web browser, type the script’s URL into the browser’s address bar, and press Enter. If you’re running the internet server on your own pc then the URL can most likely be:
If, on the other hand, you’re running the script on an internet hosting account then you wish to use one thing like:
If all goes well then you should see a page almost like this:
“Running your first PHP script:”
If you get an incorrect message or nothing happens, check that your Web server is ready up properly (see the online server’s documentation for help) which you entered the script code properly.
If you see the script code displayed in the browser, rather than the expected website, or your browser offers to download the script file, then your Web server has not been designed to run PHP scripts.
If you’re still stuck then consider the various PHP support choices offered.
If you saw the correct website then congratulations — you’ve with success written, saved, and run your first PHP script! you may build on these skills in future tutorials as you find out how to jot down a lot of complicated PHP scripts and applications. You might additionally prefer to browse the PHP language relevance get some ideas for different PHP scripts to jot down.
Set up PHP on your computer:
- Use strings, arrays, functions and objects
- Create interactive internet forms
- Handle cookies and sessions
- Work with files on the server
- Build database-driven sites with MySQL
- Send emails from your scripts
PHP can be used in website design standalone or as part.
You can also read – Preventive Domain Name Registration-Should Brands Be Sip In