If your operation system is windows, then you have to install Xampp or IIS. Xampp default a folder name is auto created which is shown as a htdocs. After that You can easily place your PHP files into htdocs. Xampp contains PHP, Apache, MySQL. Don't forget to make sure that Apache is enabled in Xampp Configuration. Generally, you can start or stop Apache. Apache default port 80 is non-ssl and 443 is SSL.
On the other hand, if your Operation system is Linux make sure that PHP has been already installed, Apache and MySQL (if needed). File location you can define by apache virtualhost. File Location like /var/www/html/ or /home/myproject/public_html as your defined. In Linux Apache default port 80 is non-ssl and 443 is SSL. You can choose different port by changing port.cnf file.
Default address is localhost or 127.0.01 and you can browse these address by browser google chrome, firefox, opera, microsoft edge etc. You can configure domain name or real IP in your apache configuration. If you configure domain name, then you can browse by domain name otherwise browse by localhost or 127.0.0.1. When browse addrees apache rund php file of your folder that was setting in apache virtualhost. Default PHP file are index.php, index.html etc. You can change deafult php file. When you browse only address like 127.0.01 then index.php will run. You can direct call php file like 127.0.0.1/test.php then test.php will run and give output in your browser. It is applicable for windows or linux OS. Note that non-ssl browsing like http://127.0.0.1 or http://www.example.com and SSL browsing like https://www.example.com
In linux command line you can run PHP file by:
php /home/myproject/public_html/test.php