Local PHP file won't open in Firefox - php

When I right click my local PHP file and select "open with Firefox" Firefox gets the focus for a second, but then the file opens in Dreamweaver instead. The same happens when I drag the file onto Firefox, or enter the URL ("file:///...") manually, or expressly select Firefox as the default application for PHP files. How can I get Firefox to show the file?

Firefox is not capable of handling PHP files, therefore it delegates their handling to a program that can do so (in your case, this is Dreamweaver).
PHP files should be served by a web server to the client (Firefox), which will display you the rendered content (probably HTML). PHP files are rendered by the PHP interpreter and then they are served using the HTTP protocol to a client as a web resource. So actually, you never open a PHP file with a browser, you just consume the HTTP resource that corresponds to the rendered output of that file.

Firefox can show .html-files. You have to install a webserver (xampp) to interprete .php-files. When xampp is installed, start xampp-control-panel, open your browser and (in case ur file is "test.php" in "c:\xampp\htdocs\test.php") and type http://localhost/test.php.
But first, right-click any php-file->Open with...->choose program, then select Firefox in the list.

You must install a local web server like xamp, wamp or easyphp.
Then you locate your files in that's www directory and see your file in browser with path:
localhost/myphp.php
Have a good time.

I have this solution to open a php on linux :
php -S localhost:8000
and open a firefox and go to the page :
http://localhost:8000/index.php
It works well for me.

The quickest way is to rename localhost/yourfile.php onto localhost/yourfile.html. (Tested on loop's Ubuntu 16.04 LTS)

You should deactivate adblock for localhost (or your domain), it should runs.
ABP icon -> click on deactivate on localhost -> F5

Related

How could I preview a php file on the browser from a remote server?

I have a remote server on 'somedomain.cloudapp.azure.com' and I have a php file named on that server.
I would like to preview the 'index.php' file on browser to see the output. I used to open the files and edited it through terminal, but now I want to see the output of the php file.
I know from localhost I just put on the browser URL localhost and it preview the index.php, how to do that for a file that is on remote server?
You need multiple thing to see your result on the web page running on the own server ; like that web server such as engine nginx or apache , php-cli , if you using database you need phpMySql and there dependencies.

How to configure local PHP to show directory content

I have a local version of Windows php to test my webpage. I run it using php.exe. It has a built-in webserver so pages can be accessed from a browser through localhost:/path.
If I enter an URL pointing to a file it opens that file in browser. I would like to configure it so that it shows the content of a directory if URL points to a directory. E.g. after inserting URL http://localhost:1234/foo/bar/ into the browser I would want to see the files in the bar directory listed in the browser. Similarly how other webservers do it when configured so.
My local PHP returns 404 instead.
Is there any way how to achieve that for this built-in webserver in php.exe? How?
The built-in server is specifically for quick development and debugging as stated in the command line server doc and directory listing is one of the features is lacks. This answer provides an example for building yours though.

How to preview my php file with firefox in bluefish?

I have installed bluefish-2.2.7 in win7,my firefox is installed "C:\Program Files (x86)\Mozilla Firefox\firefox.exe".
I think that my firefox command was set properly.
When to click the button "preview in browser" ,it ran across the message.
I'd think you'll need a web server to view PhP files in your browser, you can easily install a local webserver like WAMP if you're unsing Windows
go to edit > preferences > output parser
create a new one call it whatever you want make sure to write in the command section the following.
php '%f' && firefox 'localhost/%n'
you can watch my video on youtube
https://www.youtube.com/watch?v=gwtzqtPB9Yw

How to configure FlashDevelop to debug in web browser?

I'm following directions to set up a debugging in FlashDevelop in web browser. I'm getting confused on 'Configure your project' step. It says:
Open the Project properties and change the "Test Movie" option to
"Open Document...". Click on the button which should appear,
and enter bin/index.html (path to html page, relative to project root)
in the prompt.
What is the bin/index.html file? Is it where my SWF is loaded? I currently have a SWF that loads from a PHP page. So I pointed it to my PHP project's index.php page build project. After build I get a generic Windows message that Windows cannot open the file with that extension.
Is it possible for me to debug my SWF from my PHP page which loads it?
I don't have experience directly with what you're talking about, but I guess you have to point to a PHP file which is running in a webserver. Otherwise it can't be interpreted and run.
If you are running locally, you can use xampp, put your things in htdocs, and use localhost url to reference the file: http://localhost/projectname/index.php

Can we acces a file in C or D drive or any out side drive from a html/php program file in in wamp webserver(localhost server)?

I have a simple html program. It has a link, targeted to a pdf file.
Please see the program here
filename : invoice.html
My invoice
Here when I click on the link, pdf file will be open. Working well.
Then I called the same file from my localhost wamp server.
http://localhost/invoice.html.
But When I call the same program from my localhost, my link is not working!!!
Can you explain me why it is not working or how I can activate the link. Is there any option in Apache server or php settings ?
What's an "out side drive"?
I have a simple html program
HTML is not a programming language - its a data construct / declaration.
Here when I click on the link...Working well....http://localhost/invoice.html...not working
Does that mean that it works when you load the HTML file directly from your filesystem?
why it is not working or how I can activate the link
Certainly it has got nothing to do with Perl, PHP, Apache nor WAMP (the tags on your post). The problem is on your browser.
Is there any option in Apache server or php settings ?
No - because the problem is strictly client side.
I assume that the target file exists on the machine where you are running the browser.
It would have helped if you'd said which browsers you had tested this with. I would have expected it to have worked. Did you get an error message?
did you check if apache server is running on localhost? try to stop and restart the server and check if it works.
The link points to the C:\invoice.pdf on the client side. I wonder if this is what you want. It's more likely that you setup another Directory and alias in httpd.conf which points to C:\, then change the link accordingly.

Categories