Run program on webserver

This is a discussion on Run program on webserver within the Tech Board forums, part of the Community Boards category; Does anyone have an experience with running an application on their (paid) webserver? And mean CGI, I can run CGI ...

  1. #1
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,691

    Run program on webserver

    Does anyone have an experience with running an application on their (paid) webserver?
    And mean CGI, I can run CGI (C written) programs from 'within' my PHP pages just fine.
    But I'm trying to run a program that'll run seperate from a page being viewed.
    If my server allows me to run programs on it, and gives me a home directory (not just my public_html dir), I figure I might be able to do this.
    I thought of forking a CGI, or even making it execute a process seperately, but I have a strong feeling that they'll get terminated when the web page's execution time expires.
    Also, I would like to go so far as to make the program run automatically when the server reboots. (But I doubt that one's even possible)
    The server is Apache of course.
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  2. #2
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,183
    Do you have SSH access to the server?

    If not, you can try using exec to run a process asynchronously (append a "&"). I doubt the server will allow that if it doesn't want you running programs, though.

    Not possible to run it at boot. You will need root access for that (modify /etc/rc.local or other boot scripts).

  3. #3
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Hmmm. I think they can limit the possibility, otherwise people would do silly things like prolonged computation using their accounts.

    One thing you might want to investigate is unmanaged VPS hosting. I got one a while ago, $11/month for 8gb storage plus 128mb RAM. The reason the RAM is set is because you get root access to a complete system which operates under a hypervisor by itself. In other words, the server is set up by you (I had to ssh in and install apache), configured by you, and exclusively serves your content, no one else. It's the same thing as having control of a physical server box, only the resources have been split up (google "hypervisor"). Everything is yours to do with as you please, /etc, /root, the kernel. Everything. You can apache2ctl -k restart to your heart's content. You can shut apache down and leave it down, if you want.

    If you want my opinion, it is totally awesome dude! They installed a base debian lenny OS, which takes up 1.5-2 gigs of the 8. I put in a ton of apache and perl related stuff (using apt-get on the ssh command line) that added maybe another gig. The ram overhead IS somewhat limited; I have not tried installing gcc or compiling. But apache handles fine within it with say 3-4 people accessing server-side intensive stuff all at once -- the server itself has not gone down even once in the past six weeks, and it's as fast as my connection to it. If you were doing commercial stuff you'd want to spend more, etc.

    Okay I've said enough. Nb. This is where linux just ROCKS!!! You can run vim and mc -- anything with an ncurses interface -- via ssh. I did have to install an ftp server to upload, that was about the hardest part.
    Last edited by MK27; 08-27-2009 at 09:21 PM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  4. #4
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,581
    If this isn't a shared server you may be able to do it, no problem. But if you are asking, probably you can't. Shared hosts don't normally allow execution of programs. Check with your host.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  5. #5
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,691
    Well, I'm not surprised. But at least now I know - and no time wasted trying.

    The unmanaged VPS hosting does sound cool, but I'm not willing to spend 4x just to satisfy a little more of my adventurous side.
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  6. #6
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,183
    If you have a spare computer lying around, you can just set up your own little server, too. Just install some skinny Linux distro and do some port forwarding on your router. Or you can try Windows Server. I find Linux to be easier to set up for servers, though, and the default configuration is fairly secure.

    I'm thinking about trying WIndows Server 2008 next time I reinstall my server (that has been up for a few months already), since I can get it for free (DreamSpark). But then I'll have to somehow move my postfix emails to whatever it uses.
    Last edited by cyberfish; 08-28-2009 at 01:30 AM.

  7. #7
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    23,022
    Quote Originally Posted by Mario F. View Post
    If this isn't a shared server you may be able to do it, no problem. But if you are asking, probably you can't. Shared hosts don't normally allow execution of programs. Check with your host.
    Some may allow it if it doesn't consume too many resources. I know my host used to allow you to run a specific script in a set interval, so long as it didn't consume too many resources.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  8. #8
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Yarin View Post
    Well, I'm not surprised. But at least now I know - and no time wasted trying.

    The unmanaged VPS hosting does sound cool, but I'm not willing to spend 4x just to satisfy a little more of my adventurous side.
    Well, $11/4 = $2.75. If you are paying $2.75/month for web space, don't be surprised that there are certain limitations. Would you let people run executables on your computer any time they want for $2.75 a month?

    If you are interested in web programming, it's well worth it IMO. If you spend half an hour a day working on it, I'm sure if someone said during that half hour: "Hey, for 30 cents a day you could have a VPS server right now" you'd probably fork over the cash at that point.

    Now, if you're going so far as to spend several hours or even days working on the site each month, what's $11* on top of your time? Is your time worth nothing to you? I think you need more self-respect, Yarin. Think of it like this: You deserve a VPS account. Don't hold out on yourself like that over pennies

    Anyway, I'm not a salesman, I just can't expressed how totally thrilled I've been with that service and what an amazing deal I think it is. If you are comfortable on the command line, it's the exact equivalent of what cyberfish is talking about, except you don't need port forwarding, you won't be limited by your ISP's upload speed, and best of all you don't need to find space to connect another computer and leave it plugged in 24/7. And, beyond whatever is going on at any point in time, there is no limit on processor usage (and you don't have to provide the processor).

    * key to the $11 is the UNMANAGED angle. A normal VPS account that size is $30-50+, but probably they install/configure apache for you and provide other support.
    Last edited by MK27; 08-28-2009 at 09:20 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  9. #9
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,183
    A ghetto dedicated server can serve a few additional roles. My server, for instance, is also a file server on the LAN, a print server, and a scan server. I used to use it for NAT as well (it felt quite a bit faster than a $30 off the shelf router, but that could well be placebo effect).

    Running your own server is time consuming, though, and comes with many annoying issues. ISP connection issues affecting your uptime, backup, hardware failures, blowing out the dust regularly...

  10. #10
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,581
    Quote Originally Posted by MK27 View Post
    Anyway, I'm not a salesman, I just can't expressed how totally thrilled I've been with that service and what an amazing deal I think it is.
    Indeed. I don't go with anything less these days. Even if the only thing I have to show for the past 5 months is a one-page wonder setting the mood for a business some friends and I are planning to start come January... if our sponsors don't let us down.

    True dedicated servers are eventually the way to go. But over VPS they mostly only answer lingering issues like data backup and control over system upgrades. At a steep increase in price this is often just not enough. Besides the task of server administration falls in our hands and is no simple matter. Many dedicated solutions offer one form or another of easing server administration. But this mostly falls under software installation and system backup. The daily management tasks are ours to care for.

    On the lower end, shared hosting is indeed just not enough. Good for low bandwidth requirements static websites. And that's it. As soon as one enters into PHP, ASP.Net, Ruby on Rails, or any other server-side scripting solution the need to have your own modules installed and otherwise configure your web server to your tastes and needs is just incompatible with that hosting plan. No matter what they say about reviewing your request, chances are it will be turned down and in the end it's never in your hands. So wanting to have your own process executing is even more of a pipe dream.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  11. #11
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,691
    Quote Originally Posted by MK27 View Post
    Well, $11/4 = $2.75. If you are paying $2.75/month for web space, don't be surprised that there are certain limitations. Would you let people run executables on your computer any time they want for $2.75 a month?

    If you are interested in web programming, it's well worth it IMO. If you spend half an hour a day working on it, I'm sure if someone said during that half hour: "Hey, for 30 cents a day you could have a VPS server right now" you'd probably fork over the cash at that point.

    Now, if you're going so far as to spend several hours or even days working on the site each month, what's $11* on top of your time? Is your time worth nothing to you? I think you need more self-respect, Yarin. Think of it like this: You deserve a VPS account. Don't hold out on yourself like that over pennies
    Ha ha. In the future then!
    I haven't really gotten into anything yet - just had some ideas that I would like to play around with.
    On the lower end, shared hosting is indeed just not enough. Good for low bandwidth requirements static websites. And that's it. As soon as one enters into PHP, ASP.Net, Ruby on Rails, or any other server-side scripting solution the need to have your own modules installed and otherwise configure your web server to your tastes and needs is just incompatible with that hosting plan.
    I'm currently hosing a couple low-traffic sites from my server, and one of them uses a CGI program that I made to decrypt 1024 bit key RSA data. Some client-side script encrypts it. This way, people can make online purchases without me needing to get a dedicated IP, or SSL certificate. Saves me money! And the (shared) server seems to preform just fine. Are you suggestion that I'm pushing my limits by doing this?
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  12. #12
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    23,022
    Quote Originally Posted by Yarin View Post
    I'm currently hosing a couple low-traffic sites from my server, and one of them uses a CGI program that I made to decrypt 1024 bit key RSA data. Some client-side script encrypts it. This way, people can make online purchases without me needing to get a dedicated IP, or SSL certificate. Saves me money! And the (shared) server seems to preform just fine. Are you suggestion that I'm pushing my limits by doing this?
    I would say that depends on the amount of traffic you get.
    Obviously, if you get a lot, then you might be pushing your limits because you would be encrypting and decrypting a lot.
    Still, I don't know how expensive it is. Remember that the resources on a shared server should be for everyone, so I would check with the host provider to see if it's OK.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  13. #13
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,581
    Quote Originally Posted by Yarin View Post
    Are you suggestion that I'm pushing my limits by doing this?
    No. I'm not.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  14. #14
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Yarin View Post
    This way, people can make online purchases without me needing to get a dedicated IP, or SSL certificate. Saves me money! And the (shared) server seems to preform just fine.
    A VPS, obviously enough, has it's own IP. But if you don't need it, you don't need it. Cheapskate.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  15. #15
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,581
    And of course, he can't run his own process. Loser.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program Plan
    By Programmer_P in forum C++ Programming
    Replies: 0
    Last Post: 05-11-2009, 02:42 AM
  2. Client-server system with input from separate program
    By robot-ic in forum Networking/Device Communication
    Replies: 3
    Last Post: 01-16-2009, 03:30 PM
  3. Re-doing a C program to run in Win2000 or XP
    By fifi in forum C Programming
    Replies: 5
    Last Post: 08-17-2007, 06:32 PM
  4. Replies: 3
    Last Post: 07-11-2005, 04:07 AM
  5. plz help me run this program!!!
    By galmca in forum C Programming
    Replies: 8
    Last Post: 02-01-2005, 01:00 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21