Question:
View local .PHP files in IE & Firefox?
andypudmenzky
2007-06-01 03:27:10 UTC
I'm trying to view a local (on my HDD) .php file in IE7 or FireFox - but IE7 is asking to save or download the file, and Firefox just interprets it as text - all I see is the code.

Note that it was working until I formatted my PC, so it's a setting obviously... but I've forgotten how / where.

I don't run a PHP server locally on my machine, but note these files mainly contain HTML code, and I just want to view them for design / preview reasons. I don't care about not-seeing the PHP code until I upload it... but currently, I can't even view the files locally.

Any thoughts? :)
Thank you.
Seven answers:
2007-06-01 03:29:32 UTC
PHP is a server side scripting code... this means that the script needs to be executed on a server before you can view them..



the only way to do what your after is to save the file... open it in notepad... then save it as "filename.html" (include the quote marks) and then play with it from there...



the script in the page will come up as ordinary text and may mess up the page layout... you'll need to play with it to get it right though :D



ALSO... if you say it worked before, then you may have had a server set up earlier (either IIS or Apache) it may be worth setting it up again
sonny4fn
2007-06-01 03:37:25 UTC
if the file is saved with a .PHP extension you will need a local server that parse PHP, i.e. Apache. If they are saved as .html, you should be able to view them. Some html editors will give you a preview option for PHP files. Good luck!
Subhasis G
2007-06-01 03:38:18 UTC
PHP does not open by default if you have a IIS running. You need to integrate PHP with IIS and then only it will work.

You can as well make a web server integrated with PHP, MYSQL and IIS. See mysql and php web site. How I did it was :



Step by step guide

1. Installed the web server IIS4

2. Unzipped php-5.1.4-Win32.zip in C:\PHP

3. In Autoexec.bat (using command sysedit), added the Path : C:\PHP

4. Then run php-5.1.4-installer.exe.

5. Overwritten the C:\PHP\php.ini file.

6. Changed the following in c:\php\php.ini:

doc_root = c:\Inetpub\wwwroot

cgi.force_redirect = 0

extension=php_mysql.dll

extension=php_gd2.dll

include_path = ".:/php/includes"

extension_dir = "c:\php\ext\"



and restarted IIS. It started working
?
2016-10-09 10:04:13 UTC
precise to initiate with own homestead page code is administered on a server no longer in browser. so which you will desire to acquire something like XAMP or easyphp or uniserver this could make your existence much less complicated to advance own homestead page based website to boot as provide you get admission to to mysql. word the transportable variations of those applciations they're going to make engaged on differeint machines a breaze. Oh yeah appropriate element to do whilst discovering own homestead page is to purchase a e book maximum will communicate you nevertheless installation own homestead page to run on your gadget, before discussing a thank you to advance precise. stable good fortune
Sindhu
2007-06-01 04:40:01 UTC
hi

please run Apache and then run file from localhost and run file in any browser. or open php file in dreamweaver without running Apache
2007-06-01 03:33:50 UTC
you can't view it if you don't have a local server running:



download wamp from http://www.wampserver.com/en/ and you will be able to view the .php in your browser (standard: http://localhost/subdomains if chosen)
succubus
2007-06-01 03:35:45 UTC
change the file's extension to .html


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...