Re: Viewing source by using .phps command
| From: | Lars Torben Wilson | Date: | Fri, 10 Nov 2000 04:50:21 +0000 |
| Subject: | Re: Viewing source by using .phps command | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-24614@lists.php.net to get a copy of this message | ||
Langly writes:
> Hi,
>
> A friend once told me you could view the source of a script on the internet
> by typing in "file.phps". Is this correct? I cannot seem to get it to work.
>
> --
> Thanks,
>
> Robert Baird
> http://www.MacDeusEx.com
> http://macdeusex.insidemacgames.net
Only if the server's been configured to do so, and the .phps file in
question exists. You configure this the same way that you tell the
server that .php (or whatever) should be run through the PHP
parser. The difference is that you set it up so that instead of
getting parsed and interpreted, the code is parsed and colour-coded,
then printed.
For instance, my development server's httpd.conf has this line:
AddType application/x-httpd-php .php .html
...which, assuming the server has PHP, tells it to interpret files
ending in .php or .html.
Since this server is behind a firewall and usually not on the Internet
at all anyway, I also have this line:
AddType application/x-httpd-php-source .phps
...which tells the server to parse .phps files and display the source
output.
However, I still can't enter any old PHP-parsed file's filename with a
.phps extension and view its source. There must actually exist a file
with that name in order for this to work. For instance, say I have my
server set up to parse .html files as PHP code. Further suppose that I
have an index.html with all sorts of PHP code in it which makes it
work. Looking for index.phps will avail me nothing (yet), since no
such file exists. However, if I symlink or copy index.html to
index.phps, voila! I can now enter 'index.phps' into my browser and
view the source.
Hope this clears it up,
Torben
--
+----------------------------------------------------------------+
|Torben Wilson <torben@php.net> Netmill iTech|
|http://www.coastnet.com/~torben http://www.netmill.fi|
|Ph: 1 250 383-9735 torben@netmill.fi|
+----------------------------------------------------------------+