This Page describes how to compile suPHP 0.7.1 on Solaris 11
We need some additional Software:
$ ssh tggasser@vsps $ cd /net/adm-int/datapool/dvds/SunStudio12u2 $ scp sparc.tar root@172.16.0.21:
On the remote Machine, unpack the tar to /opt/. No installation needed:
# cd /opt/ # tar xf ~/sparc.tar
# pkg install pkg:/web/server/apache-22@2.2.16-0.151.0.1
# pkg install pkg:/library/apr-13@1.3.9-0.151.0.1
# pkg install pkg:/system/library/math/header-math@0.5.11-0.151.0.1
# wget http://www.suphp.org/download/suphp-0.7.1.tar.gz
Unpack the suPHP source Code
# cd src/suphp/ # tar xzf ~/suphp-0.7.1.tar.gz # cd suphp-0.7.1
Change PATH to include the Oracle Solaris Studio Binarys:
# export PATH=/opt/solstudio12.2/bin/:$PATH
Set Compiler Flags, we want to use cc
# export CC=cc # export CXX=CC
Set additional Include Paths. Used to find apr_buckets.h
# export CPPFLAGS="-I/usr/apr-util/1.3/include/"
Now Configure:
# ./configure --with-apxs=/usr/apache2/2.2/bin/apxs --with-apr=/usr/apr/1.3/bin/apr-1-config --prefix=/opt/HSLUsuphp --with-apache-user=websrvd --with-setid-mode=owner
The Source won't compile on Solaris:
# gmake [...] "IniSection.cpp", line 33: Error: Could not find a match for std::multimap<const std::string, const std::string, std::less<const std::string>, std::allocator<std::pair<const std::string, const std::string>>>::insert(std::pair<std::string, std::string>) needed in suPHP::IniSection::putValue(const std::string, const std::string ). 1 Error(s) detected.
Open the file and fix the code:
# vi src/IniSection.cpp
Around line 33 replace:
void suPHP::IniSection::putValue(const std::string key, const std::string value) {
std::pair<std::string, std::string> p;
p.first = key;
p.second = value;
this->entries.insert(p);
}
with:
void suPHP::IniSection::putValue(const std::string key, const std::string value) {
this->entries.insert( std::pair<const std::string, const std::string>(key,value) );
}
Then Compile and install:
# gmake # gmake install
The Apache Module is already in place:
# ls -lah /usr/apache2/2.2/libexec/mod_suphp.so # -rwxr-xr-x 1 root root 54K 2011-05-16 09:02 /usr/apache2/2.2/libexec/mod_suphp.so
Add a suphp Config File:
# mkdir /opt/HSLUsuphp/etc # vi /opt/HSLUsuphp/etc/suphp.conf
[global] ;Path to logfile logfile=/var/apache2/2.2/logs/suphp.log ;Loglevel loglevel=info ;User Apache is running as webserver_user=webservd ;Path all scripts have to be in docroot=${HOME}/public_html ;Path to chroot() to before executing script ;chroot=/mychroot ; Security options allow_file_group_writeable=false allow_file_others_writeable=false allow_directory_group_writeable=false allow_directory_others_writeable=false ;Check wheter script is within DOCUMENT_ROOT check_vhost_docroot=false ;Send minor error messages to browser errors_to_browser=false ;PATH environment variable env_path=/bin:/usr/bin ;Umask to set, specify in octal notation umask=0077 ; Minimum UID min_uid=100 ; Minimum GID min_gid=10 [handlers] ;Handler for php-scripts x-httpd-php="php:/usr/php/5.2/bin/php-cgi" ;Handler for CGI-scripts x-suphp-cgi="execute:!self"
Now we need to disable the php module in apache and load suphp:
# cd /etc/apache2/2.2/conf.d/ # mv php5.2.conf php5.2.old # vi suphp.conf
LoadModule suphp_module libexec/mod_suphp.so <IfModule mod_suphp.c> suPHP_Engine on AddType application/x-httpd-php .php AddHandler x-httpd-php .php DirectoryIndex index.php <Location /> suPHP_AddHandler x-httpd-php </Location> </IfModule>
Now we have to fix a bug: the php-cgi binary uses a broken php ini:
# cd /etc/php/5.2/ # mv nsapi/php.ini nsapi/php.bak # cp php.ini nsapi/
Restart apache22
svcadm restart apache22