====== Howto install suphp for apache2 on ubuntu ======
===== ubuntu package install =====
- apt를 이용하여 패키지를 받는다.
apt-get install libapache2-mod-suphp suphp-common libapache2-mod-php5 php5-mysql
===== /etc/suphp.conf =====
- suphp 설정파일(/etc/suphp.conf)를 수정한다.
[global]
;Path to logfile
logfile=/var/log/suphp/suphp.log
;Loglevel
loglevel=info
;User Apache is running as
webserver_user=www-data
;Path all scripts have to be in
;docroot=/var/www:${HOME}/public_html
docroot=/
;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=true
;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
umask=0022
; Minimum UID
min_uid=100
; Minimum GID
min_gid=100
[handlers]
;Handler for php-scripts
application/x-httpd-suphp="php:/usr/bin/php-cgi"
;Handler for CGI-scripts
x-suphp-cgi="execute:!self"
===== /etc/apache2/mods-enabled/suphp.conf =====
- php5 모듈을 중지시킨다. # a2dismod php5
- suphp 모듈을 활성화시킨다. # a2enmod suphp
- apache2의 suphp.conf 설정을 한다.
SetHandler application/x-httpd-suphp
suPHP_AddHandler application/x-httpd-suphp
suPHP_Engine on
# By default, disable suPHP for debian packaged web applications as files
# are owned by root and cannot be executed by suPHP because of min_uid.
suPHP_Engine off
# # Use a specific php config file (a dir which contains a php.ini file)
# suPHP_ConfigPath /etc/php5/cgi/suphp/
suPHP_ConfigPath /etc/php5/cgi/suphp/
# # Tells mod_suphp NOT to handle requests with the type .
# suPHP_RemoveHandler
===== /etc/php5/cgi/suphp/php.ini =====
- apache2 설정파일인 suphp.conf 에 있는 php.ini 를 만들어 준다.
# cd /etc/php5/cgi
# mkdir suphp
# cd suphp
# cp ../php.ini
-
# vi /etc/php5/cgi/suphp/php.ini
...
; starlits@adminschool.net
short_open_tag = On
...
===== /etc/apache2/sites-enabled/001-adminschool.conf =====
- virtual host 설정을 한다.
ServerName adminschool.net
ServerAdmin webmaster@adminshcool.net
DocumentRoot /home/admin/html
Require all granted
suPHP_Engine on
ErrorLog /var/log/apache2/adminschool.net-error.log
CustomLog /var/log/apache2/adminschool.net-access.log combined env=!dontlog