/    Sign up×
Community /Pin to ProfileBookmark

Script support

I have inherited the upkeep of a website and require to do some server scripting, either PHP or ASP. I am just at the learning stage here and want a simple test to see if the server is Apache or Linux based. I was thinking of uploading a page called test.html something along the lines of the following (but with the correct code):
<HTML>
<HEAD>
<TITLE>Test</TITLE>
</HEAD>
<BODY>
<P>This server supports

<%
/* Correct syntax required to display text */
“ASP”
%>

<?PHP
“PHP”
?>

</BODY>
</HTML>
Is this the right approach ? (I don’t know who the ISP is at this stage)

to post a comment
Full-stack Developer

5 Comments(s)

Copy linkTweet thisAlerts:
@pyroAug 21.2003 — A couple of things. First of all, it won't be "Apache or Linux based." Apache is a web server, and can run on just about any platform. Linux is the OS that runs the server. It could also be Unix, or if you are unfortunate, a M$ server...

Anyway, the correct syntax of what you posted below would be:

&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Server Test&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;p&gt;This server supports:&lt;/p&gt;
&lt;p&gt;
&lt;%
response.write("ASP")
%&gt;
&lt;?PHP
echo "PHP";
?&gt;
&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;
And hope to see the PHP pop up... ? Note that PHP requires a .php extention, while ASP requires a .asp extention, so you'll have to try running the file both ways.

Anyway, none of that code is going to tell you what kind of server you are running, just whether it supports PHP or ASP or both. If you are curious if you are on a Windows or *nix server, and have PHP, you can do this:

[code=php]<?PHP
echo $_SERVER['DOCUMENT_ROOT'];
?>[/code]
and if it returns a path like path/to/your/directory, you are on a *nix server, but if it returns C:pathtoyourdirectory you are on a Windows server.

Again, if you have PHP, you can find out all kinds of cool stuff by dropping this onto your server:

[code=php]<?PHP
phpinfo();
?>[/code]
Copy linkTweet thisAlerts:
@gizmoauthorAug 21.2003 — Thanks for your comprehensive reply. I will try that and see wha happens ?
Copy linkTweet thisAlerts:
@pyroAug 21.2003 — You are welcome... ?
Copy linkTweet thisAlerts:
@JupacAug 21.2003 — um wat the differt betwwn srtic 7 loose .dtd
Copy linkTweet thisAlerts:
@pyroAug 22.2003 — Strict is the preferred DTD, but Transitional (loose) is a bit more forgiving. For a beginner, I would recommend validating their page in Transitional and once they get that, port it over to Strict.
×

Success!

Help @gizmo 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.29,
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,
)...