Register | Login | |||||
Main
| Memberlist
| Active users
| Calendar
| Chat
| Online users Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album |
| |
0 users currently in Programming. |
Acmlm's Board - I3 Archive - Programming - To make a Board - Perl? PHP? | New poll | | |
Pages: 1 2 | Add to favorites | Next newer thread | Next older thread |
User | Post | ||
Ikuzou Micro-Goomba Since: 02-03-06 From: Japan Last post: 6779 days Last view: 6779 days |
| ||
I'm trying to make a pretty big board, on my from 0.
Here's what it's going to have - ;# 6 thread-float boards, with Avatars and EXPs and all ;# 1 one-thread board for every people inside ;# 1 chat board ;# Because it's a board, 2 or 3 logs will be read at each page. I know many boards back then used to use Perl, but more new boards started to use PHP(like here). So, here is my question - should I make a board with PHP, or with Perl, or with any other language, And why? And, which will take more traffic? P.S. I'm using a free server, 'cause I don't have enough money to get a charge server. My best regards. |
|||
neotransotaku Sledge Brother Liberated from school...until MLK day Since: 11-17-05 From: In Hearst Field Annex... Last post: 6434 days Last view: 6431 days |
| ||
php is a lot easier to work with with perl--perl is such a hackneyed language that it is very difficult to get anything going. If you have C experience, picking up php will not be difficult as the syntax and how php files are constructed and processed are similar to C. Also, php integrates well within HTML, so if you have a need to hardcode HTML, it is easily done with php--I believe with perl, you will need a bunch of printline statements... | |||
Ikuzou Micro-Goomba Since: 02-03-06 From: Japan Last post: 6779 days Last view: 6779 days |
| ||
If it's hardcodable in HTML, then the traffic must be way better when using PHP.
And plus, I have some C experience. I guess I'll use PHP. Thanks for the info! |
|||
Guy Perfect Since: 11-18-05 Last post: 6433 days Last view: 6432 days |
| ||
Hang on, slick. There are other alternatives out there.
If your web server will allow it, you may want to look into CGI. While Perl is a typical language for CGI, the nature of CGI will let you use compiled executables written in any language, such as variants of C, Java, variants of BASIC, etc. Have an old copy of VB laying around? There's an actual use for it. Trying to remember the good old days of C console programming? CGI can make that live again. CGI uses standard input and output for interaction with the web server, so just treat it like the console in your applications. C++ users will appreciate the ease of using cout to write output to the web browser. QBASIC users will find that it's easy to get data from the server with the LINE INPUT statement. Ordinary stuff, and it's easy to do. So take a look into your options. If you can use a compiling programming language instead of a server-side script, it would be much better in the long run because it will be faster and you won't be limited or have to learn a new form of programming. |
|||
Ikuzou Micro-Goomba Since: 02-03-06 From: Japan Last post: 6779 days Last view: 6779 days |
| ||
I didn't know you can use C for CGI Since I have some Perl download boards at my site, I only thought CGI=Perl...
And plus if it makes everyhting faster, I guess CGI is pretty much like PHP. Right, but PHP is hardcodable in HTML, and is like C, CGI you can use actual C. ... Well, I guess a bunch of 'printf('');'s will be okay. (^-^) Thanks! |
|||
Guy Perfect Since: 11-18-05 Last post: 6433 days Last view: 6432 days |
| ||
Again, since CGI runs compiled programs, it could be a security risk. You have to look long and hard to find a server that allows executing CGI applications, but if yours lets you, then don't be afraid to go for it. | |||
HyperHacker Star Mario Finally being paid to code in VB! If only I still enjoyed that. <_< Wii #7182 6487 4198 1828 Since: 11-18-05 From: Canada, w00t! My computer's specs, if anyone gives a damn. STOP TRUNCATING THIS >8^( Last post: 6432 days Last view: 6432 days |
| ||
About using HTML. You can do it in any language, but compare the methods:
In PHP: <?php
In C: do_something();
CGI has its advantages, but PHP is generally going to be cleaner and somewhat safer. Remember that not only do you have to worry about exploits, but also faulty software. A bad PHP script will simply spit out errors, while a bad compiled program can crash the system. (edited by Hyper LOL on 02-06-06 08:08 PM) |
|||
Ikuzou Micro-Goomba Since: 02-03-06 From: Japan Last post: 6779 days Last view: 6779 days |
| ||
Whoa, Thanks for the long code! I mean like, it must have been dieing.
There is so much difference.. I forgot about all the escaping codes and stuff. Not only about security problems, if I crash the server.. it'll be dieng for me. Well, I understood the advantages and the disadvantages of the two, and why the new language is being used. If I get used to C more, and get my own server and all, maybe I'll try writing again it with C or something - but for now, I'll go for PHP. Special Thanks for all my help! |
|||
Guy Perfect Since: 11-18-05 Last post: 6433 days Last view: 6432 days |
| ||
HyperHacker beat me to this post. Yes, PHP is a lot cleaner and safer, but it is, as I mentioned, just another language to learn. If you do decide to go CGI in the future, however, here are some examples...
I've prepared CGI scripts for demonstration purposes on my web server that both do the same thing, but one is written in C and the other in FreeBASIC. You can download the source files for both of them, and I'll post them both here. My web server is a slow 433MHz laptop running Linux and Apache in the closet upstairs. It uses my internet, so what you see on this page is a limited time offer. http://63.78.181.101/CGI_Demo/FreeBASIC/GetIP.cgi GetIP.cgi.bas Const CrLf = Chr(13) & Chr(10) http://63.78.181.101/CGI_Demo/C/GetIP.cgi GetIP.c #include <stdio.h> |
|||
Ikuzou Micro-Goomba Since: 02-03-06 From: Japan Last post: 6779 days Last view: 6779 days |
| ||
Didn't know about FreeBASIC, but it looks very similar to C.. I've also noticed it can't use escape codes. Right? lol
Yeah but having your own server is just too nice.. you get to like, just do whatever you want. I'll start CGI when I get my own server. Until that, I'll stick with PHP. Oh, lastly, I've checked out the two CGIs, and saved the sources, so it's okay to shut down your server. Thank you very much!!\(^-^)/ |
|||
Guy Perfect Since: 11-18-05 Last post: 6433 days Last view: 6432 days |
| ||
You act like you've never seen BASIC before. It's an old language, and there's several variants of it; many of them directly compatible with each other. If you copied and pasted that code into VB6, it'd work verbatim with the exception of the "As String =" thing, which wasn't supported until VB.NET.
BASIC cannot do escape characters, so you have to define constants. Visual Basic is known for its billions (not really that many) of intrinsic constants such as vbCrLf for newline, vbTab, vbNull, etc. In other versions, you'll have to define your own constants like I did in that source. I don't shut down my server. It's always on. I say the offer is for a limited time because I won't keep those files up on it forever. They'll be taken down in a few days. I helped my ISP get started, so they gave me my own public IP address for free. With that, I can just have them forward incoming requests to my router and deal with things from there as if I was a network administrator for some corporation. I've got several services available, such as web hosting, Remote Desktop (for using my computer while out of the house) and even the game Soldat. The web server, as I mentioned before, is a laptop running Linux. It's VERY well for wear even being 8 years old. It runs unusually well with Linux on it and works great as a web server. That's one thing people don't realize: Laptops are ideal machines for servers. They're lightweight, fit anywhere, have compact interfaces and all sorts of connections, have the input devices and monitor built right in, the battery acts as an on-the-spot UPS... The list goes on. Just stick one of those in the same place as the router and you've got yourself a server. And yeah, I get complete control over what I get to do with my server. Being an admin has its pros and cons. Linux can be tricky to set up, but if you're computer-savvy enough, there's not much to get in your way. Just install some PCMCIA kernel modules and reconfigure the startup scripts let me use an external ethernet card just fine with no problems. Also, I get the perks of running CGI with FreeBASIC. That's always nice. (-: |
|||
Ikuzou Micro-Goomba Since: 02-03-06 From: Japan Last post: 6779 days Last view: 6779 days |
| ||
Yeah, I've never seen BASIC before... I'm
Originally posted by BGNG I've heard once that laptops can't resist the heat, and ruins the hard disc.. watch out. |
|||
Xkeeper Took the board down in a blaze of glory, only to reveal how truly moronical ||bass is. Since: 11-17-05 From: Henderson, Nevada Last post: 6432 days Last view: 6432 days |
| ||
Compared to PHP:
<?php Yeaaaaaaah. (note: this example only works with REGISTER GLOBALS ON! If it is NOT on, it wll be something such as $_SERVER['REMOTE_ADDR'] instead!) |
|||
Coby Keese Since: 11-20-05 From: Belgium Last post: 6437 days Last view: 6433 days |
| ||
Stick to PHP, it's nice, fast and easy. Just compare XK's example with BGNG's. | |||
Guy Perfect Since: 11-18-05 Last post: 6433 days Last view: 6432 days |
| ||
Originally posted by IkuzouIn that case, you should not leave any laptop on for more than a few hours, and certainly don't let it connect to the internet. That's not really much of a problem nowadays. Laptops can play Half Life 2 at a reasonable quality with their enormous screen resolutions as it is, so they can certainly deal with heat and hard disk activity. Originally posted by CobyNice, perhaps. Easy, once you get the hang of it. Fast, not so much. With PHP, the server has to load, parse, interperate and execute as opposed to CGI, where the server has to load and execute. PHP takes up a significant amount of resources over time more than CGI, which on performance-critical servers means a major cost issue. PHP is a good option, don't get me wrong, but I wouldn't say it's better than CGI. PHP has its limitations where some freakishly obscure applications are possible with CGI. For the sake of a bizarre example, what if you wanted the server to scan in a picture from a scanner and use it as a texture to render in an OpenGL scene, then display a snapshot of that scene to the web user? You could do that with CGI, but I'm pretty sure it can't be done in PHP. Besides, how many web developers in this forum don't already know some other languge? It's not like there's any learning curve involved with CGI in that regard. |
|||
FreeDOS + Giant Red Koopa Legion: freedos = fritos Since: 11-17-05 From: Seattle Last post: 6431 days Last view: 6431 days |
| ||
Originally posted by BGNG I'm sorry, but it doesn't even sound like you understand how the Internet typically works... everyone has their own IP and anyone can know it. In fact, knowing the end user's IP address is essential to the flow of data for the server. Plus most ISPs don't randomly block ports... I know that I don't have any blocked ports. You're not that special. Originally posted by BGNG Actually it can be done with PHP, even though the language wasn't designed for it. PHP's a darned handy language to work with even for general programming (well at least PHP5, earlier versions are hell) |
|||
Guy Perfect Since: 11-18-05 Last post: 6433 days Last view: 6432 days |
| ||
So the whole "I helped my ISP get started" means I don't know how the internet works? Most ISPs these days put you on a bus with other customers on an internal network. You are incorrect: Not everybody has their own IP. People only tend to get their own IPs when they connect through a dial-up with DHCP or some select DSL providers. Otherwise, you're using your ISP's router.
Chances are, if you and your neighbors are using the same broadband ISP, you'll find that going to something like http://www.whatismyip.org/ will show that you all in fact have the SAME IP address. The reason you can each browse the net seperately is because your ISP's router is maintaining TCP connections with the web servers. Based on the connection ID, the router can determine where to send each incoming packet. For example, the external IP of my router is 172.17.100.101. Anyone who knows jack rubbish about internet can tell you that this is a Class B private IP address, which cannot be routed over the internet. Internally, my router's IP address is 192.168.1.1, which is a Class C private IP address. The IP that people use from the internet to access my router, however, is 63.78.181.101, which is a public IP address registered to my ISP. When my ISP gets incoming requests to that address, they have it run through a NAT and forward it to my router. Everyone else in the neighborhood does, in fact, have the same IP address. The static IP option was designed for businesses for an additional fee, but due to my assistence, my ISP gave me the first one (*.101) for free. Yes, FreeDOS, I am that special. In a feeble attempt to connect this post to the topic at hand... With your own public IP address, you can run CGI applications on your server without fear of restriction. (Perfect connective sentence. No one will ever know) Anyhow, you mentioned that PHP can do that crazy freaky wacky thing I noted. I'm curious at to how you might go about doing it. Would it be by calling shell commands or can it actually do it itself? |
|||
neotransotaku Sledge Brother Liberated from school...until MLK day Since: 11-17-05 From: In Hearst Field Annex... Last post: 6434 days Last view: 6431 days |
| ||
Originally posted by BGNGPHP can execute system commands with system() However, one could probably extend php source code to have the internal capability of doing what you said, although a little messy and not worth the effort, and would make CGI a better solution. |
|||
HyperHacker Star Mario Finally being paid to code in VB! If only I still enjoyed that. <_< Wii #7182 6487 4198 1828 Since: 11-18-05 From: Canada, w00t! My computer's specs, if anyone gives a damn. STOP TRUNCATING THIS >8^( Last post: 6432 days Last view: 6432 days |
| ||
Originally posted by BGNG They're also really expensive. Especially since you need to buy a monitor (the one built in) with each one. |
|||
Guy Perfect Since: 11-18-05 Last post: 6433 days Last view: 6432 days |
| ||
You can get a reasonable laptop for around $700 nowadays (after rebate, of course). Just check out some of the stuff at NewEgg. Not top of the line by any means, but who said a server has to be ultra fast? Memory's a good thing, and hard disk space is a must, but if you're just serving web content, then...
...well, an AMD-K6-2 processor running at 433MHz on a 4GB hard drive with 124MB of RAM will do you just fine. (-: |
Pages: 1 2 | Add to favorites | Next newer thread | Next older thread |
Acmlm's Board - I3 Archive - Programming - To make a Board - Perl? PHP? | | |