开发者

Are there PHP browsers?

Do browsers exist that would allow a person on a Mac to view a PHP file without uploading it and without having it开发者_如何学Python enabled(And having no possibility of enabling it)?

I wasn't asking about how to run it without a server. I was asking about whether a file browser exists that allows me to see the output of the file instead of the source code, if installing anything is not an option.


You may be looking for the PHP CLI. With that you can run PHP scripts in a serverless environment.

$ php my_script.php

Another option, if you want a server (HTTP) environment, would be to install a local server accessible via http://localhost. I personally like XAMPP, but options are plenty.


The webserver doesn't provide the source for php. You will need to use a file-download program to get it directly from the server.


This is not possible without installing PHP usually like others have mentioned, but you can use a product like LitePXP to run your code without installation from a USB Key, CD ROM or hard drive.

The blurb from their site:

LitePXP is a completely portable application which includes Apache, MySQL and PHP 5.3. LitePXP will enable you to run your PHP applications directly from a CD/DVD, USB stick or hard disk without any installation. You can use LitePXP to put your PHP website on a CD/DVD to distribute to clients. Your clients need only to insert the CD/DVD. Then LitePXP starts automatically and shows the website's pages from the CD/DVD. Of course, you can also use LitePXP to put your PHP website on a USB flash drive or other p> ortable media for distribution to your clients.

There is also iNewPHP which looks remarkably similar to LitePXP. MicroWeb by IndigoStar is another one I have heard of.

I should point out that I have never used these products myself... Just heard about them.


Not to my knowledge, though it is easy to setup a development server for testing on.

Have a look at MAMP, a combined package that provides an Apache server, PHP, MySQL all for the Mac.

Then you can use http://localhost/ to view websites locally.

Are there PHP browsers?


No.

Worst case scenario, it should almost always be possible to build PHP and a web server in your home directory, and then run the web server with it listening on a non-privileged port (higher than 1024).


Server side scripts need to be run on a web server for the output to be generated. You can install local servers on Macs for testing.

If you just want to view the PHP code contained in the .php file then any text editor would do it.


If you mean to run a PHP file, get a web server such as MAMP, (I heard it is very easy to install and get running - I use the windows version, WAMP) and copy the php files to the www folder. Then go on any browser (such as Opera or Safari) and navigate to http://localhost/nameoffile.php . If you want to view a formatted version of the source code, download a code editor. If you want to view the source code of a php file hosted on a server you don't have access to... you can't because the script is executed on the server side.


$ php yourscript.php

or

$ php -r "echo time();"

If you need a AMP solution, i recommend MAMP or Macports packages

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜