Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 11-11-2013, 11:44 AM
Impromptu Impromptu is offline
 
Join Date: Jun 2012
Posts: 56
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Php or Html code to execute PERL script

Hi All,

I asked a friend to program me a script, but he did the script in PERL, but he doesn't code online (ie php or html).

Does anyone how to call a PERL script in VB via html or php code?

I tried the PERL script via command prompt and it works (he gave instruction), but I've tried it so many ways in html/php code to execute the PERL script but it won't work.

Thanks in advance.. Jay

parts of the code are below.

#!/usr/bin/perl

use warnings;
use strict;
use URI;
use Web::Scraper;
use HTML::Entities;
use List::MoreUtils 'first_index';
Reply With Quote
  #2  
Old 11-11-2013, 12:37 PM
Max Taxable's Avatar
Max Taxable Max Taxable is offline
 
Join Date: Feb 2011
Posts: 3,134
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That code is so old it might have come from Hammurabi. Are you one of the folks trying to fix the Obamacare website?

CGI.
Reply With Quote
3 благодарности(ей) от:
ozzy47, tbworld
  #3  
Old 11-11-2013, 07:56 PM
nhawk nhawk is offline
 
Join Date: Jan 2011
Posts: 1,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

1) Make sure the user php runs as has permission to execute the perl script.

2) Make sure safe_mode is OFF in PHP.

3) This should work in PHP..
Code:
 exec("sudo perl /path/to/your/script.pl $variables $here");
Reply With Quote
Благодарность от:
Max Taxable
  #4  
Old 11-12-2013, 03:30 AM
Impromptu Impromptu is offline
 
Join Date: Jun 2012
Posts: 56
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Max Taxable View Post
That code is so old it might have come from Hammurabi. Are you one of the folks trying to fix the Obamacare website?

CGI.
Not sure what Hammurabi means TBH. I assume Obama Care is some charity organised by the US President, but no I'd be the last person trying to fix any website. As per my post, I don't know how to program (far from it) and asked someone to help me.

Cheers for the link!

--------------- Added [DATE]1384237676[/DATE] at [TIME]1384237676[/TIME] ---------------

Tried in HTML (or PHP) but both didn't work:

lscgid: execve():/clientdata/apache-www/s/u/MYWEBSITEDOMAIN/www/cgi-bin/myscraper.pl: No such file or directory

Any ideas?

#!/usr/cgi-bin/perl -w

# use warnings;
use strict;
use URI;
use Web::Scraper;
use HTML::Entities;
use List::MoreUtils 'first_index';
Reply With Quote
  #5  
Old 11-12-2013, 08:15 AM
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Posts: 1,987
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, the error message is quite plain: No such file or directory. Your path is wrong.
Reply With Quote
  #6  
Old 11-12-2013, 09:04 AM
Impromptu Impromptu is offline
 
Join Date: Jun 2012
Posts: 56
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by cellarius View Post
Well, the error message is quite plain: No such file or directory. Your path is wrong.
Hahaha I know that, but how do I change it...

Sorry I'm a layman in terms of programming...
Reply With Quote
  #7  
Old 11-12-2013, 09:29 AM
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Posts: 1,987
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, we can't tell you what the correct path to your script on the server is. Try finding out via the pwd shell command (if you have shell access).
Reply With Quote
Благодарность от:
Max Taxable
  #8  
Old 11-12-2013, 11:02 AM
nhawk nhawk is offline
 
Join Date: Jan 2011
Posts: 1,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

cgi-bin is almost never in the www directory. It's almost always one below that.

IE:
/clientdata/apache-www/s/u/MYWEBSITEDOMAIN/cgi-bin/myscraper.pl

Hence why safe_mode needs to be off in php.ini.
Reply With Quote
Благодарность от:
Max Taxable
  #9  
Old 11-12-2013, 07:17 PM
Impromptu Impromptu is offline
 
Join Date: Jun 2012
Posts: 56
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by nhawk View Post
cgi-bin is almost never in the www directory. It's almost always one below that.

IE:
/clientdata/apache-www/s/u/MYWEBSITEDOMAIN/cgi-bin/myscraper.pl

Hence why safe_mode needs to be off in php.ini.
My webhosting company has confirmed it is not in SAFE MODE.

You can check here: http://supercoachscores.com/phpinfo.php

This is so painful, but thank you everyone for the help.
Reply With Quote
  #10  
Old 11-12-2013, 10:09 PM
Max Taxable's Avatar
Max Taxable Max Taxable is offline
 
Join Date: Feb 2011
Posts: 3,134
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Impromptu View Post
My webhosting company has confirmed it is not in SAFE MODE.

You can check here: http://supercoachscores.com/phpinfo.php

This is so painful, but thank you everyone for the help.
As I joked earlier - you are working with byzantine code- PERL, which went into the bin of technological obsolescence along with floppy disks and audio cassette tapes. This is the 21st Century, Mack and there's no reason I can think of, to call a Perl script.

There's nothing you can do in Perl that can't be done better in PHP so I don't understand why your friend codes in PERL. Does he live in a cave or something? My reference to Hammurabi was trying to say just the above. Hammurabi's code? Never heard of it?
Reply With Quote
Благодарность от:
nhawk
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:46 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06663 seconds
  • Memory Usage 2,266KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (6)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete