Karaethon Posted June 25, 2019 Share Posted June 25, 2019 (edited) How/where is the setting that tells PHP which pages to parse? Does Apache have it and sends the file to the PHP engine? I have a custom extension that I am using and the server isnt parsing it because its not php extension. Edited June 25, 2019 by Karaethon Typo Correction Quote Link to comment https://forums.phpfreaks.com/topic/308890-parsing-pages-that-dont-end-in-php/ Share on other sites More sharing options...
requinix Posted June 25, 2019 Share Posted June 25, 2019 Apache doesn't magically know that .php files go through PHP. That has to be configured. And the very same configuration that says the .php extension goes through PHP can be modified to say that other extensions do too. Quote Link to comment https://forums.phpfreaks.com/topic/308890-parsing-pages-that-dont-end-in-php/#findComment-1567888 Share on other sites More sharing options...
Karaethon Posted June 25, 2019 Author Share Posted June 25, 2019 Yup, I kinda remembered something about that when I was learning how to install Apachee/php/mysql but I don't remember how/where it is or how to set it. Quote Link to comment https://forums.phpfreaks.com/topic/308890-parsing-pages-that-dont-end-in-php/#findComment-1567890 Share on other sites More sharing options...
requinix Posted June 25, 2019 Share Posted June 25, 2019 mod_php and php-fpm work differently. For the former it's in the server configuration, for the latter it's in the site configuration. Quote Link to comment https://forums.phpfreaks.com/topic/308890-parsing-pages-that-dont-end-in-php/#findComment-1567891 Share on other sites More sharing options...
Karaethon Posted June 25, 2019 Author Share Posted June 25, 2019 Ok, i remember Mod_php by name but I still dont remember how to set it to parse my files. is it something I can do in .htaccess? or should I rename all my fules and adjust all my pages? Quote Link to comment https://forums.phpfreaks.com/topic/308890-parsing-pages-that-dont-end-in-php/#findComment-1567895 Share on other sites More sharing options...
requinix Posted June 25, 2019 Share Posted June 25, 2019 Find the configuration and change it to allow your extensions. If you don't want to bother because you don't happen to remember exactly what it is you need to change or where then give up and do something else with your time. Quote Link to comment https://forums.phpfreaks.com/topic/308890-parsing-pages-that-dont-end-in-php/#findComment-1567897 Share on other sites More sharing options...
Karaethon Posted June 28, 2019 Author Share Posted June 28, 2019 I looked at everthing settings related and I cant find the setting for it. But I decided it's not hard to change the file to standard php extension so thats better, especially since I may not be able to edit settings on final server. Quote Link to comment https://forums.phpfreaks.com/topic/308890-parsing-pages-that-dont-end-in-php/#findComment-1567951 Share on other sites More sharing options...
gizmola Posted June 28, 2019 Share Posted June 28, 2019 The association with a handler and files of an extension or specific name is part of the apache configuration. There are actually a couple of different ways of doing it, and some potential security ramifications which are discussed in this blog post. It is possible to make these settings in an .htaccess file if the server has been configured to allow it. <FilesMatch \.foo$> SetHandler application/x-httpd-php </Files> This block would need to be inside a directory block if it's in an apache config for a vhost, but would be fine in an .htaccess. Note the basic regex which insures that myfile.foo will get parsed as php, but myfile.foo.jpg will not. This was a common exploit used to attack apache servers with php applications which allow uploads of images for example. Quote Link to comment https://forums.phpfreaks.com/topic/308890-parsing-pages-that-dont-end-in-php/#findComment-1567996 Share on other sites More sharing options...
benanamen Posted June 28, 2019 Share Posted June 28, 2019 The one thing that hasn't been mentioned is WHY would YOU want to do this in the first place? Quote Link to comment https://forums.phpfreaks.com/topic/308890-parsing-pages-that-dont-end-in-php/#findComment-1568006 Share on other sites More sharing options...
Karaethon Posted June 29, 2019 Author Share Posted June 29, 2019 4 hours ago, benanamen said: The one thing that hasn't been mentioned is WHY would YOU want to do this in the first place? Its kinda silly. I have code snippets, pieces of code that i use often in several places, so i save them as .snip, when I include them they run php code but i needed to call one via ajax and it wasnt running php code because it wasnt .php i finally realized that giving it a ohp extension was the logical, least effort, option. Quote Link to comment https://forums.phpfreaks.com/topic/308890-parsing-pages-that-dont-end-in-php/#findComment-1568012 Share on other sites More sharing options...
requinix Posted July 2, 2019 Share Posted July 2, 2019 On 6/28/2019 at 8:25 PM, Karaethon said: Its kinda silly. I have code snippets, pieces of code that i use often in several places, so i save them as .snip, when I include them they run php code but i needed to call one via ajax and it wasnt running php code because it wasnt .php Don't do that. Make a page specifically for the AJAX request that "calls" the snippet. And just stick with .php. It's more portable, both for running and for editing. If you want your snippets (I term I hate, by the way) to be separate then put them in a dedicated directory or something. Quote Link to comment https://forums.phpfreaks.com/topic/308890-parsing-pages-that-dont-end-in-php/#findComment-1568086 Share on other sites More sharing options...
Karaethon Posted July 6, 2019 Author Share Posted July 6, 2019 On 7/2/2019 at 8:58 AM, requinix said: Don't do that. Make a page specifically for the AJAX request that "calls" the snippet. And just stick with .php. It's more portable, both for running and for editing. If you want your snippets (I term I hate, by the way) to be separate then put them in a dedicated directory or something. Yeah, thats what I ended up doing. and why hate 'snippets'? thats what they are, pieces of html that by themselves are just a piece of the whole page. like footer, header, menu, etc. what would you call them? pieces? chunks? (truffle shufle) Quote Link to comment https://forums.phpfreaks.com/topic/308890-parsing-pages-that-dont-end-in-php/#findComment-1568175 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.