Question
How can I test and verify Perl is working with a test script?
Answer
You can copy the test script below and place in this in the cPanel users cgi-bin folder.
/home/$user/public_html/cgi-bin
cat test.cgi
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<html><body>\n";
print "<h1>Hello World</h1>\n";
print "Using Perl<p>\n";
print "</body></html>\n";
Be sure the file is executable with 0755 permissions, and owned by the user.
Then curl the domain from the command-line to verify the output:
curl -v http://domain.tld/cgi-bin/test.cgi
* About to connect() to domain.tld port 80 (#0)
* Trying 11.22.33.44... connected
* Connected todomain.tld (11.22.33.44) port 80 (#0)
> GET /cgi-bin/test.cgi HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: domain.tld
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: text/html
< Transfer-Encoding: chunked
< Date: Thu, 03 Sep 2020 17:09:27 GMT
< Server: LiteSpeed
< Connection: Keep-Alive
<
<html><body>
<h1>Hello World</h1>
Using Perl<p>
</body></html>
* Connection #0 to host domain.tld left intact
* Closing connection #0
Comments
0 comments
Article is closed for comments.