/    Sign up×
Community /Pin to ProfileBookmark

php file header

hi guys, i’ve recently switched from a server that allowed me to create a file without declaring any kind of header info.

however the new web host i have uses cPanel X and the admin said i should place my files into the public_html folder instead of the www folder, i’ve done that but only html file will load, he said i should add the header info that editors normally insert automatically to indicate that the document type is a php file because simply naming it .php won’t work.

any one know where i can find the header code he is referring to?

thanks

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogOct 27.2009 — All I can think that your admin means is that it is only set up to run PHP as CGI. If that is the case and it is a UNIX/Linux server, you may need to add a "shebang" line at the start, but you'll need to know the path to the PHP executable, something like:
[code=php]
#! /etc/bin/php
<?php
echo "Hello, World.";
?>
[/code]

This, however, is rather unusual these days on most PHP-enable web servers, where the web server program is configured to run files named with specific suffixes as PHP scripts. Also, if the above is true concerning the need for the "shebang" line, you typically have to put those files in a CGI-specific directory, not just the base public_html directory. So in summary, I'm a bit confused, and a bit leery of using that web host. :eek:
Copy linkTweet thisAlerts:
@bsmbahamasauthorOct 27.2009 — i don't think it's his server, he has a dedicated server and he said some of the files might have been messed up, so he's gonna wipe my area and let me upload my files again. so hopefully that works.

at least i'm on vacation, so i could battle with it tomorrow
×

Success!

Help @bsmbahamas 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.4,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...