How to get .phps working

Problems with the Windows version of XAMPP, questions, comments, and anything related.

How to get .phps working

Postby terminal10 » 03. April 2011 07:16

hi

I have xampp installed in my windows...I want to display the php source code without executing it in browser

I have added the following line under <IfModule mime_module> in apache/httpd.conf

AddType application/x-httpd-php-source .phps

But it doesn't work...I get a 404 error...

how to get this working??
terminal10
 
Posts: 4
Joined: 03. April 2011 07:10

Re: How to get .phps working

Postby Sharley » 03. April 2011 07:48

This is enabled by default in 1.7.4 that I used for testing.

Tested in XAMPP 1.7.4 and *.phps is working fine with no need to do anything at all with any configuration file.

It is covered in \xampp\apache\conf\extra\httpd-xampp.conf file in this section
Code: Select all
<FilesMatch "\.phps$">
    SetHandler application/x-httpd-php-source
</FilesMatch>

My test was to change the extension of \xampp\htdocs\xampp\splash.php to splash.phps and load it in my browser using http://localhost/xampp/splash.phps and this was the result
Code: Select all
<html>
<head><title>XAMPP</title>
<link href="xampp.css" rel="stylesheet" type="text/css">
</head>

<body class=white bgcolor=#ffffff>
<center>
<img src=img/blank.gif height=180 width=1><br>
<!--
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
     codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0"
     ID=anim WIDTH=400 HEIGHT=100><PARAM NAME=movie VALUE="splash-swf.php"> <PARAM NAME=loop VALUE=false> <PARAM NAME=quality VALUE=high> <EMBED src="splash-swf.php" loop=false quality=high WIDTH=400 HEIGHT=100 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED></OBJECT>
-->
<img src="img/xampp-logo.jpg">
<p>
<?php
    include("lang/languages.php");
    $i=0;
    while (list($key, $value) = each($languages))
    {
        if($i++)echo ' / ';
        echo '<a href="/xampp/lang.php?'.$key.'">'.$value.'</a>';
    }
?>
<p>
</center>
</body>
</html>
As opposed to the splash.php which gives the language selection screen for the XAMPP Demo Welcome page.

Test it using the above method and let me know if it is different for your but specify which XAMPP version you are using.

Good luck.
Last edited by Sharley on 03. April 2011 07:52, edited 1 time in total.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: How to get .phps working

Postby Altrea » 03. April 2011 07:52

in XAMPP 1.7.3 it is enabled too by default.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8299
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: How to get .phps working

Postby Sharley » 03. April 2011 07:56

@terminal10
Enabled by default even as far back as version 1.6.3a which is as far back as I can go at the moment. :)

Just checked the 1.7.5b1 and it is also enabled by default in this the latest version.

So it looks like it is available in just about all versions of XAMPP by default but give my test above a go and see if it works then check your own file and it's location path if you are getting a 404 file not found error.
The \xampp\apache\logs\error.log file may give more details about the 404 error message.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: How to get .phps working

Postby terminal10 » 03. April 2011 08:58

thnx sharely for ur reply

i just installed the newer version of xampp i.e 1.7.4 but still not working....

i chekced in \xampp\apache\conf\extra\httpd-xampp.conf and the handler is correctly set as you have mentioned....

this is the error log:
[Sun Apr 03 13:20:34 2011] [error] [client 127.0.0.1] script 'C:/xampp/htdocs/xampp/splash.phps' not found or unable to stat

do i have to change any settings to make it work??
terminal10
 
Posts: 4
Joined: 03. April 2011 07:10

Re: How to get .phps working

Postby Sharley » 03. April 2011 09:05

What are you typing in the browser?

Copy the splash.phps into the htdocs folder and then type
http://localhost/splash.phps
Then see what happens and if possible paste here again the error.log entry.

Clear your browser's cache first (temporary Internet Files).

It works by default without changing anything but make sure you change the httpd.conf file back to where it was before you changed it.

Of course make sure that Apache and MySQL are showing a green running in the XAMPP Control Panel.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: How to get .phps working

Postby terminal10 » 03. April 2011 09:18

If I am not wrong the splash.php that comes up after xampp installtion is inside htdocs/xampp folder.

So I am trying with that.. Also tried with index.php insise htdocs/xampp but not working


Error log
[Sun Apr 03 13:46:10 2011] [error] [client 127.0.0.1] script 'C:/xampp/htdocs/xampp/splash.phps' not found or unable to stat
[Sun Apr 03 13:47:42 2011] [error] [client 127.0.0.1] script 'C:/xampp/htdocs/xampp/index.phps' not found or unable to stat
terminal10
 
Posts: 4
Joined: 03. April 2011 07:10

Re: How to get .phps working

Postby Sharley » 03. April 2011 09:24

Please try and follow my instructions or we will be going no where fast.

Copy the splash.php from the htdocs\xampp folder to the htdocs folder.
Then rename the splash.php in the htdocs folder to splash.phps

Now type in the browser http://localhost/splash.phps

What happens now?
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: How to get .phps working

Postby terminal10 » 03. April 2011 09:30

got it :)

actually i am new 2 php so didnt understand dat i had 2 put both the source file as well as .php file together 2 make it...

thnx a lot Sharley for ur time

now can you tell me how to get some other extension to work like instead of .phps if i wanted .php123??
terminal10
 
Posts: 4
Joined: 03. April 2011 07:10


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 49 guests