Reputation: 45
I have just started using HTML/Sublime/PHP.
I am creating an HTML website using Sublime Text.
In order to condense parts of the web pages that appear in multiple pages (like the menu, header, and footer), I want to run a PHP script. Does that require the website to be hosted on a server? Or can I run a PHP script directly on Sublime Text.
Thank you!
Upvotes: 0
Views: 1614
Reputation: 448
Any web page containing the php script should be saved with extension '.php'. This type of file is fetched by the web server to the browser view. Locally, you need to install a web server (eg. apache) in your device so that you can fetch the contents of the script locally. So, the basic things to be noted are ::
After you have successfully installed and configured the above mentioned package, you have to run the php files on the browser over the localhost (which will serve as local web server).
Try installing the web server solution package that suits your device. You will get to learn a lot on the process.
P.S. Regarding sublime, it is just a editor. It is just used to write the codes in simple and easy way.
Upvotes: 3
Reputation: 3593
Well, you need to install a web server software locally to your machine.
For example :
and you need to save files in working directory of the server.
Then those files can be executable in web browser.
Regarding Sublime, Its just an IDE (integrated Development Environment) software which recognize PHP and other languages code and make developer easy.
Upvotes: 0