run php script in web browser

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
lordrt
Forum Commoner
Posts: 34
Joined: Sun Jul 19, 2009 11:44 pm

run php script in web browser

Post by lordrt »

Hi all
Am trying to run a php script from a server on my browser but am only getting the download option for the script.

e.g. http://www.example.com/path/script/is/stored/scr.php

can a php script be really run in any browser?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: run php script in web browser

Post by requinix »

It doesn't run on a browser. It runs on the server. Meaning the server has to know how to run PHP files.

What server? Yours? One you've set up on your own computer?
lordrt
Forum Commoner
Posts: 34
Joined: Sun Jul 19, 2009 11:44 pm

Re: run php script in web browser

Post by lordrt »

tasairis wrote:It doesn't run on a browser. It runs on the server. Meaning the server has to know how to run PHP files.

What server? Yours? One you've set up on your own computer?
Actually found out that there is url rewriting being done by apache, and therefore was treating the php script as a normal file, that is processing index.php first and then locating the php script
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: run php script in web browser

Post by requinix »

Unless the rewriting does something unusual, as long as the final post-rewriting filename is a PHP file then that PHP file will execute.

If you have a file called phpinfo.php containing only

Code: Select all

<?php phpinfo();
can you get to that page? Do you see a lot of configuration information?
lordrt
Forum Commoner
Posts: 34
Joined: Sun Jul 19, 2009 11:44 pm

Re: run php script in web browser

Post by lordrt »

tasairis wrote:Unless the rewriting does something unusual, as long as the final post-rewriting filename is a PHP file then that PHP file will execute.

If you have a file called phpinfo.php containing only

Code: Select all

<?php phpinfo();
can you get to that page? Do you see a lot of configuration information?

Yes it works since it is not in the folder holding my website details
parabo
Forum Newbie
Posts: 1
Joined: Fri Jul 31, 2009 7:32 am

Re: run php script in web browser

Post by parabo »

i am also facing the same problem. my php script doesn't run on my browser(internet explorer) yet i installed iis and wamp server with php5.1. iis works but php scripts dont show anything. i also have to create a database connection between my php application and mysql server. how can i do this when my browser cant even show me the script? help me please!
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: run php script in web browser

Post by jackpf »

Browsers don't run php scripts, that's already been expressed.

Are you opening a connection to your local pc or are you trying to run scripts directly from the browser? If the latter, do the former instead.
Post Reply