Monday, July 5, 2021

How to run a PHP file on Browser using Terminal?

 After You create a PHP file, 

  • Open Terminal
  • Go to the folder contains your PHP file
    • eg: think you created  a folder named PHP on desktop and saved your php file in it. then you as like this.
      • cd Desktop
      • cd PHP --> Your php file contains here. You can check it with "ls' command.
  • Now use this command there.
    • php -S localhost:8888 -t.
      • remember to put a dot after "t"
      • you can use any 4 digits. Not only 8888
  •  Now go to your browser and type this command on the address bar and press Enter.
    • localhost:8888/your_php_file_name_here.php
        •  Your_php_file_name_here --> the name you used to save your php file.

No comments:

Post a Comment

How to run a PHP file on Browser using Terminal?

 After You create a PHP file,  Open Terminal Go to the folder contains your PHP file eg: think you created  a folder named PHP on desktop an...