Click to See Complete Forum and Search --> : PHP, ASP, CGI, and Coldfusion test script.
GavinPearce
08-30-2003, 09:54 AM
Am looking to create a page will be uploaded to my webserver, when run it will test if PHP, ASP, CGI and Coldfusion are all running.
In the end it will be a page that you navigate to and it says:
Welcome.
ASP is currently not running.
CGI is running fine.
PHP is running fine.
Coldfusion is running fine.
The only way I can think of doing this is for PHP to send out a ASP message to the server, if it gets a message back it can then write that its running, if it doesnt get a return it can say it isn't running.
The same idea for sending message to CGI, Coldfusion.
The script could be wrote in ideally CGI or PHP whatever it would be easier. The only way there might be a problem is if the script is PHP and PHP goes down it isn't obviously going to be able to work at all to check any of them. This could be got round, but I think it's starting to get to complicated then.
I'm no expert, so you'll have to write the most of the script for me to look at :p
Thanks for any help!
Nevermore
08-30-2003, 04:18 PM
How about a page with four frames, loaded from the four pages phptest.php, asptest.asp, cgitest.cgi and coldfusiontest.cfm.
Here is the text to put in the four pages for the frames: (You might want to get it checked, the only one I really know well is PhP).
phptest.php
<?php echo("PhP is running fine!"); ?>
asptest.asp
<% @ Language=VBScript %>
<% Response.Write "ASP is running fine!" %>
cgitest.cgi - what CGI language are you using? Perl? Perl is more difficult to write for someone because you need to know where on the server Perl is. You need to change the first line of this one to where your Perl is.
#!/usr/bin/perl
print "Perl CGI is running fine!";
coldfusiontest.cfm
<cfoutput>Coldfusion is running fine!</cfoutput>
When you visit the page you will either get 4 frames telling you that your server is amazing, or if one is missing then it's broken.
GavinPearce
08-31-2003, 04:09 AM
Would it be possible somehow to get it to say php is down, if nothing is displayed? I can't figure out a way of doing it. Was thinking of using divs and having the default text to be php is down, and then getting the php to wrtie over that saying php is live. Couldn't think if that would work though.
You could use javascript to check if php displays anything.
I dont know if the javascript is correct, but it worked for me.
<script language="JavaScript">
if('yes' == '<?php print("yes"); ?>') {
document.write('PHP is running fine');
} else {
document.write("PHP is currently not running");
}
</script>
Nevermore
08-31-2003, 06:20 AM
I would do it like this:
Load the frame autmoatically from this page:
down.php
<php header("Location: up.htm") ?>
<html>
<head></head>
<body>
PHP is down.</body></html>
And up.htm is this:
<html>
<head></head>
<body>
PHP is running fine!</body></html>
Basically if PHP is up then you will be sent to up.htm, otherwise you will be left at down.php, but I don't know how to do this in the other languages.
GavinPearce
08-31-2003, 06:55 AM
using the JavaScript option, with the frame option as a backup for noscripts, how would you get the perl to write the yes to the JavaScript?
Because perl has that habit of having to know the loation as well.
:rolleyes:
Nevermore
08-31-2003, 07:27 AM
You couldn't put all four of the tests onto one page - you still have to use frames. This is because the page will be processed as only one of the 4 technologies and the others will just be left as text.
GavinPearce
08-31-2003, 10:04 AM
is there no way at all to process an extension in apache by setting a handler to scan it for php and perl?
Nevermore
08-31-2003, 10:06 AM
I don't think so. Using frames with nor borcer you could make it look like you are using one page. What's the problem with using frames?
GavinPearce
08-31-2003, 10:17 AM
I'm trying to keep it tidy. I'm making a default page for a users account on my hosting site. I want it to be called index.php. I would just rather the user finds only one file already in their account instead of a few of them.
I could remotely link to the files, but again would rather everything in the users account for bandwidth reasons.
Nevermore
08-31-2003, 10:33 AM
I would link to the files and put them in a folder calle something like system in their directory. That way it won't look cluttered.
GavinPearce
08-31-2003, 10:44 AM
it's an idea. I could also place a copy of the logo in there, so if they ever need the logo it will be theirdomain.com/sys/host.gif or something.
Thanks you've been a great help!
Just one final questions.
Do you know of a way to display a domain on the page. Say the user is on http://www.theirdomain.com/folder/info/help.html or someting like that and I want the file to scan and print the http://www.theirdomain.com bit only of the address.
Nevermore
08-31-2003, 10:53 AM
I think you can do that in a .php page using this php code:
<?php echo $_SERVER["HTTP_HOST"]; ?>
GavinPearce
08-31-2003, 10:59 AM
How about just grabbing the theirdomain.com bit? Is that possible?
Would like the server to automatically create a page, tell the user is php/perl etc is working and then give them some details about their hosting.
Would like to say something like.
This is your site at http://www.theirdomain.com. You can ftp to: ftp://ftp.theirdomain.com. The mail server is located at mail.theirdomain.com