Jump to content
The Uniform Server Community
meows

How to define a variable in apache httpd conf

Recommended Posts

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"

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...