PHP‎ > ‎

Setup suphp

posted 17 May 2011, 16:45 by Muhammad Jazman   [ updated 13 Jul 2012, 00:38 ]

Intro

Rencananya, mau mensetup mod suexec di php, agar user lebih aman dengan filenya.

Log

Wednesday, 18 May 2011
6:23:48 AM

root@bb1:/etc/apache2/mods-available# apt-get install libapache2-mod-suphp
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  php5-cgi suphp-common
Suggested packages:
  php-pear
The following NEW packages will be installed:
  libapache2-mod-suphp php5-cgi suphp-common
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 5,909kB of archives.
After this operation, 16.2MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://id.archive.ubuntu.com/ubuntu/ lucid-updates/main php5-cgi 5.3.2-1ubuntu4.9 [5,807kB]
Get:2 http://id.archive.ubuntu.com/ubuntu/ lucid/universe suphp-common 0.7.1-1 [82.7kB]
Get:3 http://id.archive.ubuntu.com/ubuntu/ lucid/universe libapache2-mod-suphp 0.7.1-1 [19.8kB]
Fetched 5,909kB in 50s (117kB/s)
Selecting previously deselected package php5-cgi.
(Reading database ... 92166 files and directories currently installed.)
Unpacking php5-cgi (from .../php5-cgi_5.3.2-1ubuntu4.9_amd64.deb) ...
Selecting previously deselected package suphp-common.
Unpacking suphp-common (from .../suphp-common_0.7.1-1_amd64.deb) ...
Selecting previously deselected package libapache2-mod-suphp.
Unpacking libapache2-mod-suphp (from .../libapache2-mod-suphp_0.7.1-1_amd64.deb) ...
Processing triggers for man-db ...
Setting up php5-cgi (5.3.2-1ubuntu4.9) ...

Creating config file /etc/php5/cgi/php.ini with new version
update-alternatives: using /usr/bin/php5-cgi to provide /usr/bin/php-cgi (php-cgi) in auto mode.
update-alternatives: using /usr/lib/cgi-bin/php5 to provide /usr/lib/cgi-bin/php (php-cgi-bin) in auto mode.

Setting up suphp-common (0.7.1-1) ...
Setting up libapache2-mod-suphp (0.7.1-1) ...
 * Reloading web server config apache2                                   [ OK ]

root@bb1:/etc/apache2/mods-available# a2dis
a2dismod   a2dissite
root@bb1:/etc/apache2/mods-available# a2dismod  php5
Module php5 disabled.
Run '/etc/init.d/apache2 restart' to activate new configuration!
root@bb1:/etc/apache2/mods-available# a2enmod suphp
Module suphp already enabled
root@bb1:/etc/apache2/mods-available# /etc/init.d/apache2 reload
 * Reloading web server config apache2                                   [ OK ]
root@bb1:/etc/apache2/mods-available# /etc/init.d/apache2 restart
 * Restarting web server apache2                                                 ... waiting                                                             [ OK ]
root@bb1:/etc/apache2/mods-available#

Kendala: 500 Internal Server Error

Coba check error log Apache2 nya:

root@bb1:/etc/apache2/conf.d# tail /var/log/apache2/error.log
[Wed May 18 06:35:42 2011] [error] [client 180.2.1.2] SoftException in Application.cpp:221: File "/usr/share/wordpress//index.php" is not in document root of Vhost "/htdocs"
[Wed May 18 06:35:42 2011] [error] [client 180.2.1.2] Premature end of script headers: index.php
[Wed May 18 06:40:40 2011] [notice] Apache/2.2.14 (Ubuntu) mod_ssl/2.2.14 OpenSSL/0.9.8k configured -- resuming normal operations
[Wed May 18 06:40:57 2011] [error] [client 180.2.1.2] SoftException in Application.cpp:350: UID of script "/var/www/index.php" is smaller than min_uid
[Wed May 18 06:40:57 2011] [error] [client 180.2.1.2] Premature end of script headers: index.php
[Wed May 18 06:41:15 2011] [error] [client 180.2.1.2] SoftException in Application.cpp:350: UID of script "/var/www/index.php" is smaller than min_uid
[Wed May 18 06:41:15 2011] [error] [client 180.2.1.2] Premature end of script headers: index.php


ternyata karena document root di suphp nya

root@bb1:/etc/apache2/conf.d# vi /etc/suphp/suphp.conf


ganti docroot menjadi / saja, agar bisa parse wordpress nya
docroot=/

ubah minimum UID dan minimum GID agar sesuai dengan www-data
min_uid=30
min_gid=30

yang satu ini gw ngga yakin, tapi enaknya di false in ajah
;Check wheter script is within DOCUMENT_ROOT
check_vhost_docroot=false

restart apache nya
root@bb1:/etc/apache2/conf.d# /etc/init.d/apache2 restart
 * Restarting web server apache2                                                 ... waiting                                                             [ OK ]







Comments