Printer Friendly Version Print this thread
Email this thread to a friend eMail this thread to a friend
Featured Web Site Template

Hundreds More at Free Site Templates.com!

Web Site Partners
Sponsored Links
Jet City Software
 
Whos Here ?
Reflects user activity within the last 5 minutes
Moderator(s): Prowler, jcokos
Member Message

david68
Joined: May 16, 2005
# Posts: 144

View the profile for david68 Send david68 a private message

Posted: 2006-May-24 13:26
Edit Message Delete Message Reply to this message

Currently I use SSI to use a standard menu, header, and counter in my 3 dozen or so web pages. If I used PHP includes instead, does my web host need SSI ability? Most hosts allow the use of PHP with the cheaper plans, but not SSI. I would also need to be able to run a CGI script in this fashion.

If yes to the above, can pages be named .html but run as .php and is that an okay way to do it? All of my pages use these includes (menu, header, and counter - 3 files on each page).

Thanks



g1smd
Staff
Joined: Jul 28, 2002
# Posts: 10440

View the profile for g1smd Send g1smd a private message

Posted: 2006-May-24 19:48
Edit Message Delete Message Reply to this message

Yes, you can name files as .html and have PHP scripts in them.

It is very easy set that up using Apache. One line in the configuration file.

If you use PHP includes then you would not need to have SSI access.

Your counter can be rewritten in PHP and can write useful data out to a log file to generate visitor stats too.



david68
Joined: May 16, 2005
# Posts: 144

View the profile for david68 Send david68 a private message

Posted: 2006-May-24 20:52
Edit Message Delete Message Reply to this message

I can't "include" a perl/cgi file using php like I do with SSI? I don't know php, I had enough trouble writing it in perl smile Currently it does log visitor stats. Another cgi/perl script works like Yahoo does and logs stuff via javascript, launched via the IMG tag.

In other words, would this work?

index.html...

<html>
<body>
<? include('/cgi-bin/counter.cgi'); ?>
</body>
</html>

Thanks



Dinkar
Staff
Joined: Aug 12, 2001
# Posts: 4391

View the profile for Dinkar Send Dinkar a private message

Posted: 2006-May-25 05:47
Edit Message Delete Message Reply to this message

Try using IMG tag.



david68
Joined: May 16, 2005
# Posts: 144

View the profile for david68 Send david68 a private message

Posted: 2006-May-25 14:05
Edit Message Delete Message Reply to this message

The problem with that is bots would keep hitting the script thinking it was an image for their cache and robots.txt doesn't get obeyed much. And checking for referer doesn't work as most people disable that these days (me included). I do use that technique for my javascript info collector, but it's launched using JS so bots ignore it. But I could do it if needed, or pay the extra $ to do it properly.

It also wouldn't work if people don't display images smile




Prowler
Staff
Joined: Aug 14, 2000
# Posts: 1795

View the profile for Prowler Send Prowler a private message

Posted: 2006-May-26 07:03
Edit Message Delete Message Reply to this message

>> In other words, would this work?

Yes. PHP can include a file from even another server provided it is accessible. So you can link to your CGI file without any issue.



david68
Joined: May 16, 2005
# Posts: 144

View the profile for david68 Send david68 a private message

Posted: 2006-May-26 18:17
Edit Message Delete Message Reply to this message

FYI, I tried using a PHP include to run a perl/cgi script - no go, doesn't work as SSI is disabled. If running from a .HTML it gives an error, if running from a .PHP it just displays the script as a text file, doesn't run it.

Using IMG doesn't work either, can't execute the script. You can run the script by itself, directly, but doesn't seem to be a way to run it from the HTML or PHP page since SSI is off sad

Thanks for the advice anyway.


[ Message was edited by: david68 05/26/2006 02:33 pm ]





Prowler
Staff
Joined: Aug 14, 2000
# Posts: 1795

View the profile for Prowler Send Prowler a private message

Posted: 2006-May-27 07:40
Edit Message Delete Message Reply to this message

PHP has nothing to do with SSI. If you see PHP files being displayed as text or HTML pages, your server is not configured. Check it out by sticking the following into a page called as test.php:



Code: [copy]





And after you are done with your testing, remove this page. It tells you a lot about your server environment variables and server configuration.




david68
Joined: May 16, 2005
# Posts: 144

View the profile for david68 Send david68 a private message

Posted: 2006-May-28 12:15
Edit Message Delete Message Reply to this message

I tried that, it just displayed the file as a text file LOL - I even set it with perms of 777. It's a free host - they SAY they offer SSI but they don't allow SSI to execute things, they only allow the echoing functions. My question is would a paid host who offers PHP but not SSI allow CGI/perl scripts to run using php includes? I tried asking the host where I bought my domain, but the guy didn't have a clue as to what I was talking about. It's only a difference of $4 vs $9 or $12 depending on where I go - so it isn't a big deal. Thanks for the info.

And yes, I ran the test.php file as mydomain.com/test.php




g1smd
Staff
Joined: Jul 28, 2002
# Posts: 10440

View the profile for g1smd Send g1smd a private message

Posted: 2006-May-28 17:36
Edit Message Delete Message Reply to this message

If a host has no idea what they are selling, then I wouldn't buy from them.



Prowler
Staff
Joined: Aug 14, 2000
# Posts: 1795

View the profile for Prowler Send Prowler a private message

Posted: 2006-May-29 05:33
Edit Message Delete Message Reply to this message

>>they SAY they offer SSI but they don't allow SSI to execute things, they only allow the echoing functions.
Sure. Few hosts will allow unfettered access to the full functions of SSI for security reasons. May be they will allow to include files as well. But it is a bit tricky though. You will need to rename the file as something.shtml to make use of the SSI unless you are allowed to change the extension in a .htaccess directive.


>>My question is would a paid host who offers PHP but not SSI allow CGI/perl scripts to run using php includes?

Including a file in PHP is allowed in a standard default configuration. But most - if not all - free hosts will not allow you CGI scripts in the first place - again for security reasons and for extra increased effort in maintaining the server. Most sysadmins have a dim view of hastily strung-together scripts consuming server resources.




david68
Joined: May 16, 2005
# Posts: 144

View the profile for david68 Send david68 a private message

Posted: 2006-May-29 12:15
Edit Message Delete Message Reply to this message

I do use .shtml and the scripts work alone, just not when called through an include statement. I can run sample.cgi or sample.php and it works, but can't do a SSI or PHP include to run them - I can do SSI includes to display time and such. This was only one host, most hosts either allow complete SSI or none at all. My original question was can I run my perl scripts through a PHP include and not need SSI at all and would a host who offers PHP allow it even if SSI isn't.

I've learned free hosts are pretty much useless, so will be finding a reliable but affordable paid host (any suggestions out there?). I need SSI/Perl/PHP.

Again, as always, thanks for the help people.


You are not permitted to post messages in this forum or topic, because of one or more of the following reasons:
  1. You have not yet logged in, or registered properly as a member
  2. You are a member, but no longer have posting rights.
  3. This is a private forum, for which you do not have permissions.

If you are a recent member, it's possible that you simply have not yet confirmed your account. Please check your email for a message entitled 'JimWorld Forums: Confirm Your Account' and follow the instructions contained within.

If you cannot find this message, click here to Re-Send it.

If you are still experiencing problem, please read the Login Assistance Article for some advice on what may be causing your login not to work properly.

Switch to Advanced Editor and ... Create a New Topic or Reply to this Thread

New posts Forum is locked
© 1995  ·  iWeb, Inc  ·  DBA JimWorld Productions