Whats up with $phpEx?

Discussion forum for MOD Writers regarding MOD Development.
Registered User
Posts: 21
Joined: Sat Feb 27, 2010 7:36 pm

Whats up with $phpEx?

Post by Jhonne » Tue Jul 26, 2011 7:17 pm

I tried changing

Code: Select all

include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

Code: Select all

include($phpbb_root_path . 'includes/functions_display.php');
just for fun and as far as I could see the page was still working. So what's the reason behind adding $phpEx instead of just php? Has it to do with security?

The same question goes for $phpbb_root_path.

Thanks for any replys.

User avatar
Former Team Member
Posts: 2667
Joined: Sun Jul 26, 2009 7:59 pm
Location: EST
Name: David King

Re: Whats up with $phpEx?

Post by imkingdavid » Tue Jul 26, 2011 9:17 pm

$phpEx is simple the string php. This allows you to potentially (if you don't mind going through quite a bit of work) change the file extensions to something else. Of course, I personally don't see the need because of the hassle of actually doing it as well as the fact that anyone that tries to directly visit "index.php" will get an error 404 message. But AFAIK that's what that's for. (And yes, it is possible to allow PHP to be parsed in non ".php" file extensions by using .htaccess, just in case you were wondering.)

$phpbb_root_path is the path to the root phpBB directory relative to the directory in which the current file is. This is used so that if you move files into a different directory, you can simply change it in one place and it shouldn't cause too many problems (although I haven't tried it, so don't take my word for it :lol:)
Don't forget to smile today. :)
Please do NOT contact for support via PM or email.
Remember, the enemy's gate is down.

User avatar
Registered User
Posts: 5588
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン

Re: Whats up with $phpEx?

Post by AmigoJack » Tue Jul 26, 2011 10:26 pm

Jhonne wrote:what's the reason behind adding $phpEx instead of just php
Flexibility. In other words: a variable is used to leave it variable. Back in the days when hosters also used extensions like php3 and php4 it might have been more obvious...
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
The problem is probably not my English but you do not want to understand correctly.
We will not come anybody anyway, nevertheless, it's best to shit this.


Return to “[3.0.x] MOD Writers Discussion”