Welcome to PHP Learning!
How to set up a local environment for development: We will be using apache XAMPP webserver and mySQL data base for this learning PHP.
Step 1: Installation install the server from https://www.apachefriends.org/download.html
depending on your OS install your variant of the apache XAMPP web server and MySQL Database
Make sure you select while installing Apache webServer and MySQL DB.
Step 2: Click on config next to Apache webserver (3), it opens Apache (httpd.conf) in a note pad and search for “DocumentRoot” edit the path of your working folder
Ex: C:Usersuser1Documentsphp where php is my working directory for this learning php project
Step 3: Start both the servers on the control panel by clicking start
Note: if you are facing any issue with port below error pop up in the console
1:51:46 PM [Apache] Problem detected!
1:51:46 PM [Apache] Port 80 in use by “Unable to open process” with PID 4!
1:51:46 PM [Apache] Apache WILL NOT start without the configured ports free!
1:51:46 PM [Apache] You need to uninstall/disable/reconfigure the blocking application
1:51:46 PM [Apache] or reconfigure Apache and the Control Panel to listen on a different port
Fix: Change the default port 80 to another (8080)
Open Apache (httpd.conf) in a notepad and search for “Listen” edit the port value from 80 to your own port in this case 8080
And start the server again.
Step 4: Create a new file under the work folder php & open in any notepad editor (I’m using Atom editor)
with the filename as hello.php and content as follows
Hit the browser with path: http://localhost:8080/hello.php
Setup completed.