Closed Thread
Results 1 to 13 of 13




  

Thread: CGI Script Acting Up

      
  1. #1
    Zap
    Zap is offline
    I Love Lesbians! Zap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond repute Zap's Avatar
    Join Date
    September 29, 2006
    Location
    Canada, Eh?
    Posts
    4,385
    Rep Power
    10
    Feedback Score
    0

    Default CGI Script Acting Up

    I have a CGI script. It runs fine when I point to it in a browser.
    However, when I use Cron to schedule it, I keep getting this sent to my e-mail...

    Can't locate mvars.cgi in @INC (@INC contains: /usr/lib/perl5/5.8.8/i686-linux /usr/lib/perl5/5.8.8 /usr/lib/perl5/site_perl/5.8.8/i686-linux /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl/5.8.4 /usr/lib/perl5/site_perl/5.8.3 /usr/lib/perl5/site_perl/5.8.2 /usr/lib/perl5/site_perl/5.8.1 /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl .) at /home/account/public_html/subdir/vars.cgi line 14.
    Compilation failed in require at /home/account/public_html/subdir/cron_freeze.cgi line 7.
    Would someone know how to remedy this? It runs fine in the browser, but Cron is a no-go.
    Any help would be appreciated.
    Toronto Forum ♫ ♫ ♫ ♫ ♫ ♫ ♫ ♫ ♫ ♫ ♫ GET FREE EXPOSURE FOR YOUR BLOG!

  2. #2
    The Force is Strong! iowadawg has a reputation beyond reputeiowadawg has a reputation beyond reputeiowadawg has a reputation beyond reputeiowadawg has a reputation beyond reputeiowadawg has a reputation beyond reputeiowadawg has a reputation beyond reputeiowadawg has a reputation beyond reputeiowadawg has a reputation beyond reputeiowadawg has a reputation beyond reputeiowadawg has a reputation beyond reputeiowadawg has a reputation beyond repute
    Join Date
    October 18, 2006
    Posts
    6,872
    Rep Power
    11
    Feedback Score
    0

    Default

    I have a script that also returns a chron error.
    Just says error, can not run.

    Weird, I think it is the hosting?

    Anyways, to bypass the fact that my cron jobs refuse to run automatically, I use this in the browser:
    http://www.mydowmain.com/cron.php

    Check your script and see if you can do the same.

  3. #3
    I'm New! jronmo is on a distinguished road
    Join Date
    December 27, 2007
    Posts
    2
    Rep Power
    0
    Feedback Score
    0

    Default

    Cron does not load .profile so all your paths have to be hardcoded.

  4. #4
    Jedi Master Cyberbite is a jewel in the roughCyberbite is a jewel in the roughCyberbite is a jewel in the roughCyberbite is a jewel in the roughCyberbite is a jewel in the roughCyberbite is a jewel in the rough Cyberbite's Avatar
    Join Date
    October 8, 2007
    Location
    Quincy, MA
    Posts
    362
    Rep Power
    5
    Feedback Score
    0

    Default

    Do you have access to the shell? You could try running

    Code:
    perl -w script.cgi
    BeanTown Host- Web Hosting, Dedicated Servers, Boston Colocation and Domain Names
    CPanel,RVSkins,Fantastico,RVSiteBuilder on all accounts.
    SysAdmin Valley - a sysadmin's ramblings, tips and tricks
    Cisco Sphere - Forum for Cisco users

  5. #5
    Idolized By All noppid is just really nicenoppid is just really nicenoppid is just really nicenoppid is just really nicenoppid is just really nicenoppid is just really nicenoppid is just really nice noppid's Avatar
    Join Date
    October 12, 2006
    Location
    Florida
    Posts
    487
    Rep Power
    6
    Feedback Score
    0

    Default

    Either hard code full paths or call the code from a shell script which changes to the local directory of the code before calling the cron script.
    Free vBulletin hacks and vBulletin Support.
    Talk to bikers around the world about motorcycles.
    Clogging an american dance step.

  6. #6
    Zap
    Zap is offline
    I Love Lesbians! Zap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond repute Zap's Avatar
    Join Date
    September 29, 2006
    Location
    Canada, Eh?
    Posts
    4,385
    Rep Power
    10
    Feedback Score
    0

    Default

    I have a VPS with WHM but I'm no coder.
    Could someone please detail what is needed? :P
    Toronto Forum ♫ ♫ ♫ ♫ ♫ ♫ ♫ ♫ ♫ ♫ ♫ GET FREE EXPOSURE FOR YOUR BLOG!

  7. #7
    Grand Masters Colleen has a reputation beyond reputeColleen has a reputation beyond reputeColleen has a reputation beyond reputeColleen has a reputation beyond reputeColleen has a reputation beyond reputeColleen has a reputation beyond reputeColleen has a reputation beyond reputeColleen has a reputation beyond reputeColleen has a reputation beyond reputeColleen has a reputation beyond reputeColleen has a reputation beyond repute Colleen's Avatar
    Join Date
    September 22, 2006
    Location
    Canada
    Posts
    11,144
    Rep Power
    26
    Feedback Score
    0

    Default

    Is the file which is called by the cron, chmod correctly?

  8. #8
    Zap
    Zap is offline
    I Love Lesbians! Zap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond repute Zap's Avatar
    Join Date
    September 29, 2006
    Location
    Canada, Eh?
    Posts
    4,385
    Rep Power
    10
    Feedback Score
    0

    Default

    Quote Originally Posted by Kalina View Post
    Is the file which is called by the cron, chmod correctly?
    Yeah. It works fine if I open it manually in a browser.
    I have a feeling it might be a problem with my syntax in cPanel in Cron.
    Toronto Forum ♫ ♫ ♫ ♫ ♫ ♫ ♫ ♫ ♫ ♫ ♫ GET FREE EXPOSURE FOR YOUR BLOG!

  9. #9
    Idolized By All noppid is just really nicenoppid is just really nicenoppid is just really nicenoppid is just really nicenoppid is just really nicenoppid is just really nicenoppid is just really nice noppid's Avatar
    Join Date
    October 12, 2006
    Location
    Florida
    Posts
    487
    Rep Power
    6
    Feedback Score
    0

    Default

    Show us the instructions to put the cron job in the cron system. Or is this cron job called by a php script on a schedule?

    Maybe from there we can get a better idea of what suits your needs. I know what has to be done, just not exactly how to do it for your app and in your environment.
    Free vBulletin hacks and vBulletin Support.
    Talk to bikers around the world about motorcycles.
    Clogging an american dance step.

  10. #10
    Zap
    Zap is offline
    I Love Lesbians! Zap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond repute Zap's Avatar
    Join Date
    September 29, 2006
    Location
    Canada, Eh?
    Posts
    4,385
    Rep Power
    10
    Feedback Score
    0

    Default

    Thanks Noppid!

    The command I have entered into cron in cPanel is

    Code:
    /home/username/public_html/subdir/cron_freeze.cgi
    Within cron_freeze.cgi, there is a reference to mvars.cgi (noted in error above) but it works fine in a browser.


    Any help would be appreciated and thanks for the help so far.
    Toronto Forum ♫ ♫ ♫ ♫ ♫ ♫ ♫ ♫ ♫ ♫ ♫ GET FREE EXPOSURE FOR YOUR BLOG!

  11. #11
    Idolized By All noppid is just really nicenoppid is just really nicenoppid is just really nicenoppid is just really nicenoppid is just really nicenoppid is just really nicenoppid is just really nice noppid's Avatar
    Join Date
    October 12, 2006
    Location
    Florida
    Posts
    487
    Rep Power
    6
    Feedback Score
    0

    Default

    It works in a browser because you are running it from the folder it lives in that way.

    Cron runs in the home folder of whatever user cron runs under and calls the script via the fully qualified path /home/username/public_html/subdir/cron_freeze.cgi. So, when the include('./something.php') or include('something.php') is encountered, which says, find a file named something.php in the folder we are running in, it is looking in cron's home folder, not the script folder.

    Ok, so, I would say the easiest fix is to put this before the include() in cron_freeze.cgi.

    Code:
    chdir '/home/username/public_html/subdir';
    Now when cron calls the script, the script will move from the cron home folder to where the application files are so includes without full paths work.

    You can get fancy and make another php file to do this and then call this one. Or you could make a shell script to call and do the chrid and then call this php file. There's more then one way to skin a cat.

    So, good luck.

    BIG EDIT: I was thinking in PHP, not perl. That CHDIR() call is likely wrong. BRB
    EDIT 2: The function is the same, the syntax however seems to be different in that there are no parentheses used as in php. I've edited the code above.
    Last edited by noppid; Dec 28th, 2007 at 7:51 am.
    Free vBulletin hacks and vBulletin Support.
    Talk to bikers around the world about motorcycles.
    Clogging an american dance step.

  12. #12
    Zap
    Zap is offline
    I Love Lesbians! Zap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond reputeZap has a reputation beyond repute Zap's Avatar
    Join Date
    September 29, 2006
    Location
    Canada, Eh?
    Posts
    4,385
    Rep Power
    10
    Feedback Score
    0

    Default

    Thanks Noppid!

    I inserted the code and it worked like a charm. Now I can sleep at night.
    Thanks a ton!



    Thanks to you too, Cyberbite for offering your help!
    Toronto Forum ♫ ♫ ♫ ♫ ♫ ♫ ♫ ♫ ♫ ♫ ♫ GET FREE EXPOSURE FOR YOUR BLOG!

  13. #13
    Idolized By All noppid is just really nicenoppid is just really nicenoppid is just really nicenoppid is just really nicenoppid is just really nicenoppid is just really nicenoppid is just really nice noppid's Avatar
    Join Date
    October 12, 2006
    Location
    Florida
    Posts
    487
    Rep Power
    6
    Feedback Score
    0

    Default

    You're welcome. I'm glad it worked out.
    Free vBulletin hacks and vBulletin Support.
    Talk to bikers around the world about motorcycles.
    Clogging an american dance step.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Myspace Script for sale - Comment script
    By Steve in forum Scripts
    Replies: 2
    Last Post: Feb 17th, 2008, 7:31 pm
  2. Best script to use?
    By einsteinsboi in forum HTML & Website Design
    Replies: 10
    Last Post: Aug 14th, 2007, 7:40 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
WebTalkForums
WebTalkForums
Recent Forum Threads