Jump to content

Recommended Posts

Hi,

 

I have a service that runs as a cgi-bin listener. Now I want to replace it with a php script.

 

The cgi-bin executable it's named 'putdata' and has no extension and is accessed as

http://IP_ADDR/path_to_cgi/putdata?user=sdf&pass=dfgf&data=sdfwewrrdsa....

 

I want to replace this putdata cgi-bin with some new php script possibly called putdata without the .php extension. I don't want to ask the users to change the access url. The server runs Apache 2 on Suse Linux

 

So my question is: Is it possible to run a php script without an extension? Which configuration changes should be made to the apache web server to support php scripts placed in files without the .php extension.

 

BR, Jovan

 

 

Link to comment
https://forums.phpfreaks.com/topic/63728-solved-php-script-without-an-extension/
Share on other sites

Thanks for the fast reply,

 

I was trying to do something with AddType  :-\

 

Now I get the "save file as" dialog when I try to access the file with a web broswer. Seems to me

the web server detects the file type, but doesn't know how to handle it.

Problems with MIME-Types, or something else? Any ideas?

what is the extension of file?

 

The file has no extension.

 

The problem I encountered after the reply from Guardian-Mage was because I added  ForceType in

the httpd.conf, and not in .htaccess file as was written in the reply.

 

I found one interesting article at: http://www.devarticles.com/c/a/Apache/Using-ForceType-For-Nicer-Page-URLs/1/

 

Basically it suggests the same solution as Guardian-Mage, but in combination wiith the "Files"

directive, you can easily define which files with no extension will be treated as php scripts.

 

Here is an example:

 

<Files my_file_name>

    ForceType application/x-httpd-php

</Files>

 

This tells Apache if a file named my_file_name is found in the url to treat it as a php script

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.