Hello I am using RHEL 4 (full Install) and created a simple perl script with 'perl filename' the command is working correctly but when I run the script ./script I get bad interpreter error
[[root@rhel4es Test]# pwd /var/www/html/Test [root@rhel4es Test]# perl tryPerl2.pl this content is from perl file ! [root@rhel4es Test]# [root@rhel4es Test]# which perl /usr/bin/perl [root@rhel4es Test]# [root@rhel4es Test]# cat tryPerl2.pl #!/usr/bin/perl print "this content is from perl file !\n"; [root@rhel4es Test]# [root@rhel4es Test]# ./tryPerl2.pl : bad interpreter: No such file or directory [root@rhel4es Test]#
So I cant browse this file from my internet browser So whats the problem
Thanks in advance
With warm regards
MAHESH DESHPANDE
Hello Mahesh,
Quoting deshpande@vsnl.com:
Hello I am using RHEL 4 (full Install) and created a simple perl script with 'perl filename' the command is working correctly but when I run the script ./script I get bad interpreter error
[[root@rhel4es Test]# pwd /var/www/html/Test [root@rhel4es Test]# perl tryPerl2.pl this content is from perl file ! [root@rhel4es Test]# [root@rhel4es Test]# which perl /usr/bin/perl [root@rhel4es Test]# [root@rhel4es Test]# cat tryPerl2.pl #!/usr/bin/perl print "this content is from perl file !\n"; [root@rhel4es Test]# [root@rhel4es Test]# ./tryPerl2.pl : bad interpreter: No such file or directory [root@rhel4es Test]#
did you try chmod 755 tryPerl2.pl ? also do this on first line #!/usr/bin/perl -W
So I cant browse this file from my internet browser So whats the problem
For displaying in browser you might have to add this before anything gets printed on browser :
print "Content-type:text/html\n\n";
Thanks in advance With warm regards MAHESH DESHPANDE
Thanks & Regards, Mitul Limbani, Founder & CEO, Enterux Solutions, The Enterprise Linux Company (TM), www.enterux.com
ML dropped bits saying:
did you try chmod 755 tryPerl2.pl ? also do this on first line #!/usr/bin/perl -W
shouldn't that be -w (lowercase)
So I cant browse this file from my internet browser So whats the problem
For displaying in browser you might have to add this before anything gets printed on browser :
print "Content-type:text/html\n\n";
better to do it this way:
use CGI; my $cgi = new CGI;
print $cgi->header();
This works correctly when testing via the command line, running via mod_perl and running via CGI.
It also prints the correct line terminating character for the platform in use. \n\n is actually wrong, though apache will forgive you for making that mistake. For more details, man perlipc and search for Client/Server
Hey,
Quoting Philip Tellis philip.tellis@gmx.net:
ML dropped bits saying:
did you try chmod 755 tryPerl2.pl ? also do this on first line #!/usr/bin/perl -W
shouldn't that be -w (lowercase)
Yeah thats correct, i made a type mistake.
Thanks & Regards, Mitul Limbani, Founder & CEO, Enterux Solutions, The Enterprise Linux Company (TM), www.enterux.com
On Saturday 26 May 2007 12:39, deshpande@vsnl.com wrote:
Hello I am using RHEL 4 (full Install) and created a simple perl script with 'perl filename' the command is working correctly but when I run the script ./script I get bad interpreter error
[[root@rhel4es Test]# pwd /var/www/html/Test [root@rhel4es Test]# perl tryPerl2.pl this content is from perl file ! [root@rhel4es Test]# [root@rhel4es Test]# which perl /usr/bin/perl [root@rhel4es Test]# [root@rhel4es Test]# cat tryPerl2.pl #!/usr/bin/perl print "this content is from perl file !\n"; [root@rhel4es Test]# [root@rhel4es Test]# ./tryPerl2.pl
: bad interpreter: No such file or directory
Probably /var mounted as a noexec partition.
-- Raju