Jump to content


Photo

How to define a variable in apache httpd conf

define variable apache httpd conf

  • Please log in to reply
1 reply to this topic

#1 meows

meows

    Junior Member

  • Member
  • Pip
  • 28 posts
  • SourceForge IDmeows
  • Main OS: Windows XP

Posted 12 February 2015 - 10:52 PM

47

I just got real tired of seeing errors from apache about no server path found.

I set and reset paths in my computer, even edited reg, and went through every darn file

in all libs. so in flustration i set my own and so far it works

Quick setup is using the existing variable that apache can't find in HTTP.CONF

at the top add

  <IfDefine US_ROOTF>
     Define US_ROOTF C:/PATH   **The path i want the variable for**
    </IfDefine>
    <IfDefine !US_ROOTF>
     Define US_ROOTF C:/PATH    **The path i want the variable for**
    #  Define SSL
    </IfDefine>

Thats it//

NOW TEST it safely using httpd_z.exe -t -D DUMP_RUN_CFG

 

Apache2.4 I researched it out and here is what worked for me.
and tested using httpd_z.exe -t -D DUMP_RUN_CFG
 

       RESULTS:::
        ServerRoot: "C:/path/core/apache2"
        Main DocumentRoot: "C:/path/apache/htdocs"
        Main ErrorLog: "C:/path/core/apache2/logs/error.log"
        Mutex rewrite-map: using_defaults
        Mutex default: dir="C:/path/core/apache2/logs/" mechanism=default
        PidFile: "C:/path/core/apache2/logs/httpd.pid"
        Define: DUMP_RUN_CFG
        Define: US_ROOTF=C:/path   **THIS IS THE ROOT PATH VARIABLE I JUST MADE**
        Define: php54
 

      #<IfDefine TEST>
        #  Define servername test.example.com
        #</IfDefine>
        #<IfDefine !TEST>
        #  Define servername www.example.com
        #  Define SSL
        #</IfDefine>
        #DocumentRoot /var/www/${servername}/htdocs
    <IfDefine US_ROOTF>
     Define US_ROOTF C:/PATH   **The path i want the variable for**
    </IfDefine>
    <IfDefine !US_ROOTF>
     Define US_ROOTF C:/PATH    **The path i want the variable for**
    #  Define SSL
    </IfDefine>
    #DocumentRoot /var/www/${servername}/htdocs  OPTIONS ON HOW TO USE

    EXAMPLE of use
    ServerRoot = ${US_ROOTF}
    <IfDefine php54>
      LoadFile "${US_ROOTF}/core/php54/icudt53.dll"
    PHPIniDir "${US_ROOTF}/core/php54/php_production.ini"



#2 Ric

Ric

    Project Manager

  • Admin
  • PipPipPipPipPip
  • 1,535 posts
  • Gender:Male
  • Location:Cambridge,UK
  • Interests:Electronics
    Internet in general
    Open source projects
  • SourceForge IDmpgcan
  • Wiki ID: Ric
  • Main OS: Windows XP

Posted 13 February 2015 - 07:47 AM

An interesting post just wondering if this is a solution to a real problem!
“I just got real tired of seeing errors from apache about no server path found.” Is this issue  reproducible if so please provide details.

Your method above uses absolute paths for example Define US_ROOTF C:/PATH this forces Uniform Server to become a fixed installation probably not what you want. This conflicts with Uniform Server design see below.   

Uniform server is primarily designed for portability meaning you can run the server from any location on a hard drive or from a USB memory stick. To achieve this all environments variables are set at run time by UniController. Apache reads these environment variables and makes the appropriate substitution for example ServerRoot "${US_ROOTF}/core/apache2"

A fixed installation is required only when running servers as a service. You move servers to the desired fixed location and using the service module install servers as a service. Configuration backups are created and all occurrences of environments variables in all current configuration files are replaced by absolute paths.

All the best
Ric
 







Also tagged with one or more of these keywords: define, variable, apache, httpd, conf

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users