0

I have configured my local server to parse php code inside html files, but I wonder, what if I host my site online by finding a web hosting server to put it there, will it parse my php code inside the html file???

I feel like there's a better way to ask and so I apologize in advance because English is my second language.

Miko Chu
  • 1,087
  • 14
  • 22
  • Just be sure that the web host you are considering offers servers with PHP. If it is not easy to tell whether or not they do before you sign up with them, find a different one. – Don't Panic Aug 13 '15 at 17:46
  • Solution is to use .htaccess, see http://stackoverflow.com/questions/4687208/using-htaccess-to-make-all-html-pages-to-run-as-php-files for solutions – Chaoley Aug 15 '15 at 03:40

1 Answers1

1

If you want PHP interpreted in your HTML pages, you first need to make sure that you suscribe to a PHP-enabled hosting service (it is the case of most hosting offers). Hosting companies usually provide comparative tables of their different offers, with the various services available. Just find the one that suits your needs.

Then, as @Chaoley suggested, you need to make sure that the extension of your files match the settings of their web server (Apache, most probably). .html files may not be parsed by the PHP engine: usually only PHP-specific extensions (.php, .php5, .php4...) are passed to the PHP module. Your provider may or may not give you the opportunity to tweak some server settings with a .htaccess file in the root directory of your application (or any other target directory).

Community
  • 1
  • 1
Eusebius
  • 531
  • 6
  • 24