Today we will learn about PHP Environment Setup
Before proceeding to the PHP Environment Setup, we need to know some Common uses of PHP.
– PHP can perform system functions, i.e. In the file system of machine it can create, open, read, write, and close the files.
– PHP can handle any kind of forms, i.e. it can gather data from the forms via different kind of inputs like textbox, textarea and also can get data from files, can write/save data to a file, through email you can send data.
– PHP can also manage Database and perform various operation like add, delete, modify and many more.
– PHP can create, access, edit and delete cookies variables.
– Using PHP, User can restrict visitors to access particular or some pages of your website.
– PHP can also encrypt the data.
PHP Environment Setup
What Do I Need?
To start working in PHP, you need to setup/install three major components. These are the main components and if any of them is missing, You won’t be able to work in PHP.
Web Server – To setup PHP environment, the most important component to install is WEBSERVER. Usually PHP works with all Web Server software, including Microsoft’s Internet Information Server (IIS) but the most commonly used WEBSERVER is Apache. Apache is freely available and can be downloaded easily.
You can download Apache for free from here – https://httpd.apache.org/download.cgi
Database – To save your data and perform any operation on that data you need a storage section where you can save all the data called Database. Although PHP works with all database softwares, including Oracle and Sybase but most commonly used and free database available is MySQL database.
Download MySQL for free from here – https://www.mysql.com/downloads/
PHP Parser – PHP Parser is also most important component in order to process PHP instructions. To perform this operation, a parser must be installed to generate HTML output which can be sent to the Web Browser.
PHP Parser Installation
Before you proceed to create pages in PHP or start any development, it would be great if you make sure that you have proper PHP environment setup on your PC to develop your website or web pages using PHP.
To check whether you have proper installation or not, type the below address into your browser’s address bar.
If it displays a page showing all the information regarding your PHP installation then it means you have PHP and Webserver installed properly. Otherwise recheck the installation process and follow given procedure to install PHP on your computer.
All above three components are the necessary part to setup the PHP environment. There are 2 ways to setup PHP environment-
1 – Find a web host with PHP and MySQL support
2 – Install a web server on your own PC, and then install PHP and MySQL
Use a Web Host With PHP Support
“A web host, or web hosting service provider, is a business that provides the needed technologies and services for the website or webpage to help to be viewed in the Internet.”
If your web host has support to run php then you don’t have to do anything.
Just create some .php files via any text editor like notepad+, Dreamviewer etc and place them in your root directory. Now access your page/website via the URL and the server will automatically parse them for you.
Note: You don’t have need to compile anything or install any extra tools as most the web hosts which supports PHP provide all the tools need to run PHP.
Set Up PHP on Your Own PC
Usually you can perform any operation on web host but sometimes you need to do some development where you need to setup PHP environment on your own Computer. Or if your web host does not support PHP.
So to setup PHP environment on your own PC, you need to-
– install a web server – like Apache
– install PHP
– install a database, such as MySQL
– The official PHP website (PHP.net) has all the installation instructions for PHP: http://php.net/manual/en/install.php
Below is the Sample PHP page
<title>First PHP Script Execution</title>
echo “<h1>Hello, ShoutMe360</h1>”;
Above is the basic structure of a page and in the next session we will learn more about PHP.
Hope this article clears all the topics about PHP Environment.