[Mediawiki-l] Re: setting environmental variables for a wiki

Kate Turner keturner at livejournal.com
Fri May 27 14:31:45 UTC 2005


Emma Gottesman wrote in gmane.org.wikimedia.mediawiki:

> As part of the set-up I need to set the environmental variables
> MAGICK_HOME and LD_LIBRARY_PATH.
> I've got the following lines in /etc/profile
> export MAGICK_HOME="/usr/local/ImageMagick-6.2.1"
> export LD_LIBRARY_PATH="/usr/local/ImageMagick-6.2.1/lib:$LD_LIBRARY_PATH"
> and I've got them again in /.login and /.profile.

instead of doing this, i'd recommend either:
* recompile imagemagick with -R/usr/local/ImageMagick-6.2.1/lib so it can
find its libraries automatically; or
* run "crle -l /lib:/usr/lib:/usr/local/ImageMagick-6.2.1/lib" so the
runtime linker can find them normally.

either of these is probably preferable to hardcoding $LD_LIBRARY_PATH
everywhere.

however, if you don't want to do either of these, you can put this in
LocalSettings.php:

 putenv("LD_LIBRARY_PATH=/usr/local/ImageMagick-6.2.1/lib:" 
        . getenv("LD_LIBRARY_PATH"));

and something similar for MAGICK_HOME.

your shell init files are not (normally) read by PHP, so they won't have an
effect on PHP's environment.

alternatively, you could set these before starting Apache and they would
take effect for all CGI programs.  (for example,
copy /lib/svc/method/http-apache2 to somewhere else, modify it as needed
and change the 'start/exec' SMF property for network/http:apache2 to the
new file:

 mkdir -p /etc/local/svc/method/
 cp /lib/svc/method/httpd-apache2 /etc/local/svc/method/httpd-apache2
 vi /etc/local/svc/method/httpd-apache
  [ ... add exports ... ]
 svccfg -s network/httpd:apache2 setprop \
    start/exec = /etc/local/svc/method/httpd-apache2

i've not tested this, but i believe it should work.
)

> How do I set an evironmental variable for the wiki? What user is it?  I
> think it may be webservd:
> (extract from /etc/passwd) **webservd:x:80:80:WebServer Reserved UID:/:
> and that has no home directory or shell so I can't set it in ~/home.

i believe that Sun's supplied apache2 (in /usr/apache2/) does run as
"webservd" by default, but you can do:

 grep \^User /etc/apache2/httpd.conf

to find out.   since Apache isn't normally started by this user, though,
changing its shell profile isn't likely to affect it.

> Just in case it makes a difference the wiki is installed in
> /var/apache2/htdocs/wiki. Also I've enabled $wgUseTeX in
> LocalSettings.php and the make in /var/apache2/htdocs/wiki/math
> generated no errors.
> 
> Help?
> -- Emma

kate.




More information about the MediaWiki-l mailing list