cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2236
Views
0
Helpful
5
Replies

Changing Apache @INC path

Sean Gilkes
Level 1
Level 1

Hello All,

I would love to be able to change this search path so that the scripts I have written could also be used over the web.  I know that the "official" Cisco response will be don't do it, but I was wondering if anyone has ever tried to do this on a Windows 2008 platform running LMS 3.2.

Cheers,

1 Accepted Solution

Accepted Solutions

I assume you're using tainint checking, then?  If so, then the syntax:

use lib qw(PATH);

Should work.  Alternatively, you can explicitly require modules using their fully-qualified paths.  You can also set PERL5LIB in the environment.

The environment is seeded from the standard system environment.

View solution in original post

5 Replies 5

Joe Clarke
Cisco Employee
Cisco Employee

@INC is a Perl convention.  I'm not sure what you man with respect to Apache.  If you have Perl scripts that need to find modules in other locations, you can just push elements into @INC within your scripts:

push @INC, "/usr/local/lib/perl";

Or:

use lib qw(/usr/local/lib/perl);

Another thought is to use another version of Perl outside of LMS.  This way you can control all aspects of the Perl environment.  This assumes Solaris, though:

#!/usr/local/bin/perl

...

Hello Joseph,

The Apache CGI environment sets up it's own paths and variables as such:

Environment variables:

COMPUTERNAME="SG2213P"
COMSPEC="C:\Windows\system32\cmd.exe"
DOCUMENT_ROOT="D:/Program Files/CSCOpx/htdocs"
GATEWAY_INTERFACE="CGI/1.1"
HTTPS="on"
HTTP_ACCEPT="image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*"
HTTP_ACCEPT_ENCODING="gzip, deflate"
HTTP_ACCEPT_LANGUAGE="de-ch"
HTTP_CONNECTION="Keep-Alive"
HTTP_COOKIE="MICEcookie=6A77FDCF4A1316DC1F6776BB85ABDB05"
HTTP_HOST="sgcw02.swissptt.ch"
HTTP_UA_CPU="x86"
HTTP_USER_AGENT="Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.2; .NET4.0C; .NET4.0E; MS-RTC LM 8)"
NOKEEPALIVE="1"
PATH="C:\Windows\SysWOW64\\wbem;D:\PROGRA~2\CSCOpx\bin;D:\PROGRA~2\CSCOpx\objects\smarts\lib;D:\PROGRA~2\CSCOpx\objects\smarts\bin;D:\PROGRA~2\CSCOpx\campus\bin;D:\PROGRA~2\CSCOpx\MDC\tomcat\bin;D:\PROGRA~2\CSCOpx\MDC\Apache;D:\PROGRA~2\CSCOpx\MDC\Apache\bin;D:\PROGRA~2\CSCOpx\MDC\jre\bin;D:\PROGRA~2\CSCOpx\MDC\bin;D:\PROGRA~2\CSCOpx\lib\jre\bin\server;D:\PROGRA~2\CSCOpx\objects\db\win32;C:\Program Files\Support Tools\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Admin\Tools;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Admin\Tools;C:\Admin\Tools;C:\Program Files (x86)\HITACHI\DynamicLinkManager\bin;C:\Program Files (x86)\HITACHI\DynamicLinkManager\lib;C:\Program Files (x86)\HDVM\HBaseAgent\bin;C:\Program Files (x86)\HDVM\HBaseAgent\util\bin;C:\Program Files (x86)\Common Files\Hitachi;C:\PROGRA~2\BMCSOF~1\Patrol3\bin;C:\Program Files (x86)\BMC Software\Patrol3\bin;D:\PROGRA~2\CSCOpx\objects\wfengine\Program\procsys;C:\perl\lib;C:\tools32"
PATHEXT=".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC"
QUERY_STRING=""
REMOTE_ADDR="10.45.22.122"
REMOTE_PORT="1536"
REQUEST_METHOD="GET"
REQUEST_URI="/cgi-bin/PrintEnvironment.pl"
SCRIPT_FILENAME="D:/Program Files/CSCOpx/cgi-bin/PrintEnvironment.pl"
SCRIPT_NAME="/cgi-bin/PrintEnvironment.pl"
SCRIPT_URI="https://10.185.64.101/cgi-bin/PrintEnvironment.pl"
SCRIPT_URL="/cgi-bin/PrintEnvironment.pl"
SERVER_ADDR="10.185.64.101"
SERVER_ADMIN="GIN_CiscoWorks@swisscom.com"
SERVER_NAME="10.185.64.101"
SERVER_PORT="443"
SERVER_PROTOCOL="HTTP/1.1"
SERVER_SIGNATURE=""
SERVER_SOFTWARE="Apache"
SSL_CIPHER="RC4-MD5"
SSL_CIPHER_ALGKEYSIZE="128"
SSL_CIPHER_EXPORT="false"
SSL_CIPHER_USEKEYSIZE="128"
SSL_CLIENT_CERT=""
SSL_CLIENT_VERIFY="NONE"
SSL_COMPRESS_METHOD="NULL"
SSL_PROTOCOL="TLSv1"
SSL_SERVER_A_KEY="rsaEncryption"
SSL_SERVER_A_SIG="sha1WithRSAEncryption"
SSL_SERVER_CERT="-----BEGIN CERTIFICATE-----\nMIICqzCCAhQCCQD/+94cRhrtoTANBgkqhkiG9w0BAQUFADCBmTELMAkGA1UEBhMC\nQ0gxCzAJBgNVBAgTAkJFMQ0wCwYDVQQHEwRCZXJuMRcwFQYDVQQKEw5JVCBTZXJ2\naWNlcyBBRzEMMAoGA1UECxMDUE5FMRswGQYDVQQDExJzZ2N3MDIuc3dpc3NwdHQu\nY2gxKjAoBgkqhkiG9w0BCQEWG0dJTl9DaXNjb1dvcmtzQHN3aXNzY29tLmNvbTAe\nFw0xMDA3MDgxMDI2MTdaFw0xNTA3MDgxMDI2MTdaMIGZMQswCQYDVQQGEwJDSDEL\nMAkGA1UECBMCQkUxDTALBgNVBAcTBEJlcm4xFzAVBgNVBAoTDklUIFNlcnZpY2Vz\nIEFHMQwwCgYDVQQLEwNQTkUxGzAZBgNVBAMTEnNnY3cwMi5zd2lzc3B0dC5jaDEq\nMCgGCSqGSIb3DQEJARYbR0lOX0Npc2NvV29ya3NAc3dpc3Njb20uY29tMIGfMA0G\nCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDRGsB/vKjf4smI67XaPx9AAP6Lp/3AoqQc\nMdGtOatUTETpg0FA1Ju4cElxLHDTtZVdiBi5jAClFpj3YWmS5VtVgOaAmK0gyzZz\nYGjrmYhfmJ+daLp5FMi8YGnh3Y2Vj8uiGwAeerLlDDhllvMWNGTPPQtVC4ghZIo0\nbOP5X5e21QIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFGfuRQSGwu7Us/3+ZVC24ni\nj8Bgdpku7XMDZpuCaETMr4J+Jt6ZfXM3idWcMpRaRDmJ26BToW5N7vfaEgwNI0RP\nQb+UPu9ZSfNQg+lVdAq3H9lnkYeQhcwLK4vH3lONt/5WciP3gU47zitx2l3owNno\n36QQ5aCbxphG6OsYDK7p\n-----END CERTIFICATE-----\n"
SSL_SERVER_I_DN="/C=CH/ST=BE/L=Bern/O=IT Services AG/OU=PNE/CN=sgcw02.swissptt.ch/emailAddress=GIN_CiscoWorks@swisscom.com"
SSL_SERVER_I_DN_C="CH"
SSL_SERVER_I_DN_CN="sgcw02.swissptt.ch"
SSL_SERVER_I_DN_EMAIL="GIN_CiscoWorks@swisscom.com"
SSL_SERVER_I_DN_L="Bern"
SSL_SERVER_I_DN_O="IT Services AG"
SSL_SERVER_I_DN_OU="PNE"
SSL_SERVER_I_DN_ST="BE"
SSL_SERVER_M_SERIAL="FFFBDE1C461AEDA1"
SSL_SERVER_M_VERSION="1"
SSL_SERVER_S_DN="/C=CH/ST=BE/L=Bern/O=IT Services AG/OU=PNE/CN=sgcw02.swissptt.ch/emailAddress=GIN_CiscoWorks@swisscom.com"
SSL_SERVER_S_DN_C="CH"
SSL_SERVER_S_DN_CN="sgcw02.swissptt.ch"
SSL_SERVER_S_DN_EMAIL="GIN_CiscoWorks@swisscom.com"
SSL_SERVER_S_DN_L="Bern"
SSL_SERVER_S_DN_O="IT Services AG"
SSL_SERVER_S_DN_OU="PNE"
SSL_SERVER_S_DN_ST="BE"
SSL_SERVER_V_END="Jul  8 10:26:17 2015 GMT"
SSL_SERVER_V_START="Jul  8 10:26:17 2010 GMT"
SSL_SESSION_ID="E1EC1963F40E892A763DBCEC805ECCDE104837281E95F6F0358A7BC67A6C6251"
SSL_UNCLEAN_SHUTDOWN="1"
SSL_VERSION_INTERFACE="mod_ssl/2.2.10"
SSL_VERSION_LIBRARY="OpenSSL/0.9.8k"
SYSTEMROOT="C:\Windows"
WINDIR="C:\Windows"


Perl @INC:

D:\PROGRA~2\CSCOpx\objects\perl5\lib
D:/Program Files/CSCOpx/lib
D:\PROGRA~2\CSCOpx\objects\perl5\site\lib
.

That is the envrionment exported by CGI for use by scripts written.  The "Perl @INC" variable is somehow set and is NOT overwritten from within a script, for obvious security reasons.  I would like to know how to change the CGI environment to incorporate the paths I need...

I hope that this is a little clearer...

Cheers,

SRGi

I assume you're using tainint checking, then?  If so, then the syntax:

use lib qw(PATH);

Should work.  Alternatively, you can explicitly require modules using their fully-qualified paths.  You can also set PERL5LIB in the environment.

The environment is seeded from the standard system environment.

Thanks Joseph, I didn't think of using the lib module, thinking that the @INC environment variable was all that the Apache server looked to.  I've still got issues, but at least I am a step closer to my goals.  Once again, thanks for your assistance.

Sean.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Innovations in Cisco Full Stack Observability - A new webinar from Cisco