Re: Hard link shows php source code

From: Date: Wed, 30 Jan 2019 03:56:15 +0000
Subject: Re: Hard link shows php source code
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-326692@lists.php.net to get a copy of this message
On Wed, Jan 30, 2019 at 6:52 AM Jeffry Killen <jekillen@prodigy.net> wrote: > Hello; > > I have been getting more familiar with hard links lately. > But I remember having created a hard link to a php source file. > The link name did not have the .php extension. So when I > used a browser to navigate to the link, the php source code > was displayed*. I figured out it was because the link name did > not have the .php extension. I thought that is a problem where > a php source code file could be read via an http request for a > hard link to it where the link name did not have the .php extension. > > BUT; since, I have not been able to reproduce the same result. > I have been experimenting with hard and soft links to php code > files where the link names do not have .php suffix. Navigation > to these links produces blank pages; a good sign. I have also > used require(link name) with same results. No code is displayed. > > The question is: > Does php anticipate this situation under the hood and recognize > the <?php tag even though it is reading a link to it with out the .php > suffix? > > * I am not sure that this won't happen again, sometime > > Thank you > JK > Hi, It depends on the web server that you are using. Default configuration of Apache usually handles this. If you are using Apache, look for something like below in your apache configuration or .htaccess and learn more about this directives. SetHandler application/x-httpd-php OR AddType application/x-httpd-php .php SetHandler: https://httpd.apache.org/docs/2.4/mod/core.html#sethandler AddType: https://httpd.apache.org/docs/2.4/mod/mod_mime.html#addtype Not sure if there is another way to tell web server to handle php files. -- <https://about.me/jigar?promo=email_sig&utm_source=product&utm_medium=email_sig&utm_campaign=edit_panel&utm_content=thumb> Jigar Dhulla about.me/jigar <https://about.me/jigar?promo=email_sig&utm_source=product&utm_medium=email_sig&utm_campaign=edit_panel&utm_content=thumb>

« previous php.general (#326692) next »