/    Sign up×
Community /Pin to ProfileBookmark

PHP file-type confusion, help me to clear this up

I am creating this thread basically because of my “argument” with user [B]Mike H.[/B] in the recent[URL=http://forums.digitalpoint.com/showthread.php?t=506803]A contact form that doesn’t use an e-mail client[/URL] thread (which I don’t want to “float” anymore further) that I opened on Digital Point forums a few days ago; particularly see my and his posts below the [URL=http://forums.digitalpoint.com/showpost.php?p=4807100&postcount=15]15th post[/URL].

So could you please help me to clear this confusion up, i.e. I just want you to confirm or disavow what I said/wrote in there, quoting (it’s a bit modified text though):

[QUOTE]

I just said that the PHP code is just a plain text (i.e. not binary or whatever), same as is HTML code. Because as we all know: one thing is a file-type (and its extension), and the other thing is the format in which it’s written, i.e. basically .txt, .html, .css are all files with different extensions (and of course with different programs associated to open them on double-click), but they all consist of just plain text, compare to .exe, .bin etc. files.

I was simply thinking that if, as mentioned, the PHP code is just a plain text, then same as in case of HTML files/code (i.e. you just create a plain .txt file, and change its extension to become a .html file), I would only need to change the file’s extension with no need to create a special file-style under Folder Options — View. You see, I simply thought that this same “princip” applies also to PHP files, i.e. that simply changing the extension to .php (from .txt for instance) makes the respective file a PHP file.

[/QUOTE]

Anyways, as I see things, user [URL=http://forums.digitalpoint.com/member.php?u=77852]Mike H.[/URL] simply assumed that I am not computing-knowledgeable and that I am not creating “[I]*.php[/I]” files, but “[I]*.txt.php[/I]” ones instead. While of course I haven’t, I mean I don’t even use Explorer as my file-manager (nor as OS’s default shell), so there is no “hidding of known file-types” on my PC.

So again, my question is basically:

[B] I am right that you create a PHP file simply by writing the PHP code (which is AFAIK in plain text) into a common .txt file (or for that matter already into a file with.php extension), and then change the respective file’s extension from .txt to .php??![/B]

Oh and once again regarding file-types: AFAIK they basically only associate an extension with certain file-type, so that the OS knows with/in which program to open a certain file when one double-clicks on it. While file-type in terms of file-format (i.e. for instance .exes being in binary, .txt, .html etc. being in plain text, .docs being in MS-Word format etc.) is something completely different!!

tayiper

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@scragarOct 14.2007 — personaly I'm not a big fan of file extentions, they are kinda outdated, even if they are easy to use.

renaming the extention of a php file to .txt does indead make the computer treat it as a perfectly valid txt file, although having said that windows offers the same behavoiur for renaming an exe to .txt
Copy linkTweet thisAlerts:
@tayiperauthorOct 14.2007 — OK, thank you very much [B]scragar[/B] for your quick reply ...


tayiper
Copy linkTweet thisAlerts:
@NogDogOct 14.2007 — The PHP source code needs to be in a plain text file (i.e. not a binary file). The extension has no effect [b]by itself[/b] as to how the file is processed by the web server. It is the [b]combination[/b] of web server settings and file suffix(es) that determine if the web server sends it to the PHP processor. You can use a '.asp' suffix for it if you want, as long as you configure your server to send HTTP requests for such files to the PHP processor. You can even have all .html files sent to the PHP processor if you so desire.
×

Success!

Help @tayiper spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...