Sponsored Content
Top Forums Programming Problem with Perl script after moving from a Windows/Apache Server to a UNIX server. Post 302625935 by BigBobbyB on Wednesday 18th of April 2012 01:35:26 PM
Old 04-18-2012
Problem with Perl script after moving from a Windows/Apache Server to a UNIX server.

I have a Perl script that worked fine before moving it to justhost.com. It was on a Windows/Apache server. Just host is using UNIX. Other Perl scripts on other sites that were also moved work fine so I know Perl is functioning.
The script is called cwrmail.pl and is located in my cgi-bin.
When I run the script I get a 500 error. The script is called from a CGI Post form on another page. I have narrowed it down to the "read" statement...as follows:


Code:
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-FA-F0-9][a-FA-F0-9])/pack("C", hex($1))/eg;
$contents{$name} = $value;
}


If I comment out this section and add a "print" function, it works and prints to the screen so I am positive this section is the problem. The "read" statement is correct. The chmod is 755 for both the script and the cgi-bin.I have tried uploading via FTP in both ASCII and binary to no avail. I have edited in both NotePad ++ and WordPad.
The support at justhost is pretty good except they seem to be lacking Perl techs. I don't think this is a Perl issue but really not sure!
Anyone have any other ideas??
Thanks,
Bob

Moderator's Comments:
Mod Comment Code tags for code, please.

Last edited by Corona688; 04-18-2012 at 04:22 PM..
 

10 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

Unix Sco Open Server, Windows Computers Problem Access Unix Shared Files Help!!!!!

Hello Moto I hope someone can help We's here at work, have a unix box with sco openserver 5 on it, so it has a nice gui interface.. and also a fair few windows computers.. a system admin guy b4 me, has set up a user called neil, which can, when u try to access the unix box using windows... (2 Replies)
Discussion started by: haggo
2 Replies

2. UNIX for Dummies Questions & Answers

moving apache from 1 server to another

i need to move apache 2.2 from one server over to another server..... my servers are in atlanta and i'm logged in here in florida... what commands do i use ???? somebody mentioned the fetch command... please help.... i'm an idiot when it comes to unix (2 Replies)
Discussion started by: marinob007
2 Replies

3. UNIX for Dummies Questions & Answers

Script runs fine on UNIX Server...Not through MSK Tool kit on Windows Server

I have a .sh script which was running fine on all the UNIX Servers (AIX, SunSolaris). The script requires two mandatory parameters and many optional parameters. Now at a different client place who are on a Windows Server, when I try to execute the script through MKS Toolkit, there are couple of... (5 Replies)
Discussion started by: madhunk
5 Replies

4. UNIX and Linux Applications

Problem with accessing subversion installed on unix server through windows GUI

We are using subversion as a version control system in our project. We are connecting to client`s sun Solaris box through check point VPN. Client has installed subversion . We have created repository and add files to it. Now we want to access the same from our windows machine (through... (0 Replies)
Discussion started by: aasid
0 Replies

5. Shell Programming and Scripting

Perl: Sending file from UNIX server to Windows server

I'm trying to write a Perl script where a file from a UNIX server box connects to a Windows server box and copies that file into the Window box. The main problem I have right now is that whenever I try to connect to the Windows box, the connection is refused. The error message that always pops... (2 Replies)
Discussion started by: kooshi
2 Replies

6. Shell Programming and Scripting

Unix shell script to Copy files from one Windows server to another Windows server.

Can anybody please help me on how to code for the below requirement: I need to write a shell script (on different unix server) to copy files from multiple folders (ex. BRN-000001) from one windows server (\\boldls-mwe-dev4)to a different windows server(\\rrwin-ewhd04.ecomad.int). This shell... (4 Replies)
Discussion started by: SravsJaya
4 Replies

7. Shell Programming and Scripting

Needed SFTP script from windows to UNIX server and from UNIX to windows server(reverse SFTP)

hi guys, i need a script to sftp the file from windows to unix server ....(before that i have to check whether the file exists in the windows server or not and again i have to reverse sftp the files from unix to windows server..... regards, Vasa Saikumar. (13 Replies)
Discussion started by: hemanthsaikumar
13 Replies

8. Solaris

FTP-ing files from Windows server to UNIX server

I need to transfer files from a Windows server to the Unix server and have to run some shell script on it to get the required output. Is it possible to transfer files from Windows server to unix server through any shell script? If so can you please help me with the details. Thanks in... (8 Replies)
Discussion started by: ssk250
8 Replies

9. Shell Programming and Scripting

Script to communicate from UNIX server to windows server

I have two servers linux and windows and i want to compare files which are in unix server that to windows server and find out which are missing that means i have 50 files with 6000 records in each file on linux server and i want to verify weather these 50 files are present in windows server... (5 Replies)
Discussion started by: sagar_1986
5 Replies

10. Shell Programming and Scripting

Do I require remote login access to a windows server to transfer files from a UNIX server

Hi All I need to transfer a file from a UNIX server to a windows server. I saw that it is possible to do this using scp command by looking at the forum listed below: ... (2 Replies)
Discussion started by: vx04
2 Replies
CGI::Fast(3pm)						 Perl Programmers Reference Guide					    CGI::Fast(3pm)

NAME
CGI::Fast - CGI Interface for Fast CGI SYNOPSIS
use CGI::Fast qw(:standard); $COUNTER = 0; while (new CGI::Fast) { print header; print start_html("Fast CGI Rocks"); print h1("Fast CGI Rocks"), "Invocation number ",b($COUNTER++), " PID ",b($$),".", hr; print end_html; } DESCRIPTION
CGI::Fast is a subclass of the CGI object created by CGI.pm. It is specialized to work well with the Open Market FastCGI standard, which greatly speeds up CGI scripts by turning them into persistently running server processes. Scripts that perform time-consuming initializa- tion processes, such as loading large modules or opening persistent database connections, will see large performance improvements. OTHER PIECES OF THE PUZZLE
In order to use CGI::Fast you'll need a FastCGI-enabled Web server. Open Market's server is FastCGI-savvy. There are also freely redis- tributable FastCGI modules for NCSA httpd 1.5 and Apache. FastCGI-enabling modules for Microsoft Internet Information Server and Netscape Communications Server have been announced. In addition, you'll need a version of the Perl interpreter that has been linked with the FastCGI I/O library. Precompiled binaries are available for several platforms, including DEC Alpha, HP-UX and SPARC/Solaris, or you can rebuild Perl from source with patches provided in the FastCGI developer's kit. The FastCGI Perl interpreter can be used in place of your normal Perl without ill consequences. You can find FastCGI modules for Apache and NCSA httpd, precompiled Perl interpreters, and the FastCGI developer's kit all at URL: http://www.fastcgi.com/ WRITING FASTCGI PERL SCRIPTS
FastCGI scripts are persistent: one or more copies of the script are started up when the server initializes, and stay around until the server exits or they die a natural death. After performing whatever one-time initialization it needs, the script enters a loop waiting for incoming connections, processing the request, and waiting some more. A typical FastCGI script will look like this: #!/usr/local/bin/perl # must be a FastCGI version of perl! use CGI::Fast; &do_some_initialization(); while ($q = new CGI::Fast) { &process_request($q); } Each time there's a new request, CGI::Fast returns a CGI object to your loop. The rest of the time your script waits in the call to new(). When the server requests that your script be terminated, new() will return undef. You can of course exit earlier if you choose. A new version of the script will be respawned to take its place (this may be necessary in order to avoid Perl memory leaks in long-running scripts). CGI.pm's default CGI object mode also works. Just modify the loop this way: while (new CGI::Fast) { &process_request; } Calls to header(), start_form(), etc. will all operate on the current request. INSTALLING FASTCGI SCRIPTS
See the FastCGI developer's kit documentation for full details. On the Apache server, the following line must be added to srm.conf: AddType application/x-httpd-fcgi .fcgi FastCGI scripts must end in the extension .fcgi. For each script you install, you must add something like the following to srm.conf: FastCgiServer /usr/etc/httpd/fcgi-bin/file_upload.fcgi -processes 2 This instructs Apache to launch two copies of file_upload.fcgi at startup time. USING FASTCGI SCRIPTS AS CGI SCRIPTS
Any script that works correctly as a FastCGI script will also work correctly when installed as a vanilla CGI script. However it will not see any performance benefit. EXTERNAL FASTCGI SERVER INVOCATION
FastCGI supports a TCP/IP transport mechanism which allows FastCGI scripts to run external to the webserver, perhaps on a remote machine. To configure the webserver to connect to an external FastCGI server, you would add the following to your srm.conf: FastCgiExternalServer /usr/etc/httpd/fcgi-bin/file_upload.fcgi -host sputnik:8888 Two environment variables affect how the "CGI::Fast" object is created, allowing "CGI::Fast" to be used as an external FastCGI server. (See "FCGI" documentation for "FCGI::OpenSocket" for more information.) FCGI_SOCKET_PATH The address (TCP/IP) or path (UNIX Domain) of the socket the external FastCGI script to which bind an listen for incoming connections from the web server. FCGI_LISTEN_QUEUE Maximum length of the queue of pending connections. For example: #!/usr/local/bin/perl # must be a FastCGI version of perl! use CGI::Fast; &do_some_initialization(); $ENV{FCGI_SOCKET_PATH} = "sputnik:8888"; $ENV{FCGI_LISTEN_QUEUE} = 100; while ($q = new CGI::Fast) { &process_request($q); } CAVEATS
I haven't tested this very much. AUTHOR INFORMATION
Copyright 1996-1998, Lincoln D. Stein. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Address bug reports and comments to: lstein@cshl.org BUGS
This section intentionally left blank. SEE ALSO
CGI::Carp, CGI perl v5.8.0 2002-06-01 CGI::Fast(3pm)
All times are GMT -4. The time now is 12:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy