<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>"Technically" Advanced &#187; suPHP</title>
	<atom:link href="http://www.lecaptain.org/tag/suphp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lecaptain.org</link>
	<description>Random thoughts, words, deeds, and sometimes, even something technical!</description>
	<lastBuildDate>Tue, 06 Jan 2009 03:22:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>suPHP on Plesk with CentOS 5.1</title>
		<link>http://www.lecaptain.org/tech/suphp-on-plesk-with-centos-51/</link>
		<comments>http://www.lecaptain.org/tech/suphp-on-plesk-with-centos-51/#comments</comments>
		<pubDate>Tue, 17 Jun 2008 21:31:13 +0000</pubDate>
		<dc:creator>Curt</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Plesk]]></category>
		<category><![CDATA[suPHP]]></category>

		<guid isPermaLink="false">http://www.lecaptain.org/?p=14</guid>
		<description><![CDATA[Since SuSE Enterprise does cost money, I&#8217;ve decided to also write this for a CentOS 5.1 install of Plesk.
Prerequisites:

PHP/LAMP Server installed by Plesk/Apache
PHP FastCGI Component
apr-1-util Component
httpd-devel Component
Development Tools (gcc/flex/bison)
suPHP 0.63
Plesk8.4

Procedure:

After all prerequisites are installed, download the suPHP 0.6.3 source to the directory of your choosing. For the purposes of this document, we&#8217;re using /usr/local/src
Untar the [...]]]></description>
			<content:encoded><![CDATA[<p>Since SuSE Enterprise does cost money, I&#8217;ve decided to also write this for a CentOS 5.1 install of Plesk.</p>
<p><strong>Prerequisites</strong>:</p>
<ul>
<li>PHP/LAMP Server installed by Plesk/Apache</li>
<li>PHP FastCGI Component</li>
<li>apr-1-util Component</li>
<li>httpd-devel Component</li>
<li>Development Tools (gcc/flex/bison)</li>
<li>suPHP 0.63</li>
<li>Plesk8.4</li>
</ul>
<p><strong>Procedure:</strong></p>
<ol>
<li>After all prerequisites are installed, download the suPHP 0.6.3 source to the directory of your choosing. For the purposes of this document, we&#8217;re using /usr/local/src</li>
<li>Untar the suPHP application, it should install into a directory named  suphp-0.6.3</li>
<li>Run configure with the following options (or, change for your preferred environment:)</li>
<p><em>./configure &#8211;with-apxs=/usr/sbin/apxs &#8211;with-php=/usr/bin/php-cgi &#8211;with-logfile=/var/log/suphp.log &#8211;with-min-uid=30 &#8211;with-min-gid=30 &#8211;with-apache-user=apache &#8211;with-apr=/usr/bin/apr-1-config &#8211;with-setid-mode=owner &#8211;prefix=/usr &#8211;sysconfdir=/etc</em></p>
<li>After configure succeeds, run the usual make:</li>
<p><em>make</em></p>
<li>All should go well with your make.  If so, then run make install:</li>
<p><em>make install</em></p>
<li>We&#8217;re not done yet. We&#8217;ve created mod_suphp.so, which is now located in /usr/lib/httpd/modules, but need to create a new file in /etc/httpd/conf.d/ called &#8220;suphp.conf&#8221;.  It should look like this:</li>
<p><em>LoadModule suphp_module modules/mod_suphp.so</em></p>
<p><em>&lt;Directory /var/www/vhosts&gt;<br />
php_admin_value engine off<br />
suPHP_Engine On<br />
AddHandler x-httpd-php .php .php3 .php4 .php5<br />
suPHP_AddHandler x-httpd-php<br />
&lt;/Directory&gt;</em></p>
<li>Now that we&#8217;ve added this file, we need to restart apache:</li>
<p><em>service httpd restart</em></p>
<li>We&#8217;re nearly finished. Now we need to create our configuration for suPHP. Create a file in /etc named &#8220;suphp.conf&#8221;. Add in the following lines to configure it:</li>
<p><em>[global]<br />
logfile=/var/log/suphp.log<br />
loglevel=info<br />
webserver_user=apache<br />
docroot=/var/www/vhosts<br />
allow_file_group_writeable=false<br />
allow_file_others_writeable=false<br />
allow_directory_group_writeable=false<br />
allow_directory_others_writeable=false<br />
check_vhost_docroot=false<br />
errors_to_browser=false<br />
env_path=/bin:/usr/bin<br />
umask=0022<br />
min_uid=30<br />
min_gid=30</em></p>
<p><em>[handlers]<br />
x-httpd-php=php:/usr/bin/php-cgi<br />
x-suphp-cgi=execute:!self</em></p>
<li>You need to edit /etc/httpd/conf/httpd.conf and either remove the following two lines, or comment them out:<br />
<em>AddType application/x-httpd-php .php<br />
AddType application/x-httpd-php-source .phps</em></li>
<li>Restart apache one more time.</li>
<p><em>service httpd restart</em></ol>
<p>Voila! If you add a file into a directory, say named info.php that had permissions above 0644 &#8211; the execution should fail. Directories are required to be 755, files can be no more than 644. This is especially useful for things like Joomla that have their own installers that use incorrect permissions due to PHP running as the user that runs apache. There is only one file that CentOS uses for PHP configuration, which is /etc/php.ini</p>
<p>A great way to test this is by trying software like Joomla &#8211; files will execute as you&#8217;d expect them to, as the user in question. There may be some issues due to things like not supporting PHP-FastCGI support, but most files won&#8217;t notice the difference. Also, make sure you rotate that suphp.log file, as it will grow in info mode, as it logs each file execution.<span id="more-14"></span><!--more--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lecaptain.org/tech/suphp-on-plesk-with-centos-51/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>suPHP on Plesk with SuSE Linux Enterprise Server 10</title>
		<link>http://www.lecaptain.org/tech/suphp-on-plesk-with-suse-linux-enterprise-server-10/</link>
		<comments>http://www.lecaptain.org/tech/suphp-on-plesk-with-suse-linux-enterprise-server-10/#comments</comments>
		<pubDate>Thu, 21 Feb 2008 21:03:01 +0000</pubDate>
		<dc:creator>Curt</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Plesk]]></category>
		<category><![CDATA[suPHP]]></category>
		<category><![CDATA[SuSE]]></category>

		<guid isPermaLink="false">http://www.lecaptain.org/?p=12</guid>
		<description><![CDATA[Recently, I&#8217;ve come across an issue with Plesk/PHP sites, particularly those that are running applications like Joomla, which for some reason require 777 permissions quite often.  I&#8217;m not terribly thrilled by this, so I went in search of a solution to help combat this.  Right now, we&#8217;ve got this in testing, but we&#8217;re [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I&#8217;ve come across an issue with Plesk/PHP sites, particularly those that are running applications like Joomla, which for some reason require 777 permissions quite often.  I&#8217;m not terribly thrilled by this, so I went in search of a solution to help combat this.  Right now, we&#8217;ve got this in testing, but we&#8217;re using <a href="http://www.suphp.org" title="suPHP">suPHP</a> to do our dirty work.  Installation wasn&#8217;t necessarily trivial, as we did have some issues during the compile phase, along with the fact that you do need the fastcgi version of PHP (installable via YaST) installed.  Here&#8217;s my step-by-step installation instructions:</p>
<p><strong>Prerequisites</strong>:</p>
<ul>
<li>PHP/LAMP Server installed by Plesk/Apache</li>
<li>PHP FastCGI Component</li>
<li>apr-1-util Component</li>
<li>apache2-devel Component</li>
<li>Development Tools (gcc/flex/bison)</li>
<li>suPHP 0.62</li>
<li>Plesk8.3</li>
</ul>
<p><strong>Procedure:</strong></p>
<ol>
<li>After all prerequisites are installed, download the suPHP 0.62 source to the directory of your choosing.  For the purposes of this document, we&#8217;re using /usr/local/src</li>
<li>Untar the suPHP application, it should install into a directory named  suphp-0.6.2</li>
<li>Copy or link all files from /usr/include/apr-1 into /usr/include/apache2</li>
<li>Copy /srv/www/cgi-bin/php5 to /usr/bin/php5-cgi</li>
<li>Run configure with the following options (or, change for your preferred environment:)</li>
<p><em>./configure &#8211;with-apxs=/usr/sbin &#8211;with-php=/usr/bin/php5-cgi &#8211;with-logfile=/var/log/suphp.log &#8211;with-min-uid=30 &#8211;with-min-gid=30 &#8211;with-apache-user=wwwrun &#8211;with-apr=/usr/bin/apr-1-config &#8211;with-setid-mode=owner &#8211;prefix=/usr &#8211;sysconfdir=/etc</em></p>
<li>After configure succeeds, run the usual make:</li>
<p><em>make</em></p>
<li>All should go well with your make.  If so, then run make install:</li>
<p><em>make install</em></p>
<li>We&#8217;re not done yet.  We&#8217;ve created mos_suphp.so, which is now located in /usr/lib/apache2, but need to modify /etc/sysconfig/apache2 so that our suphp module is included.  You can do so by changing the following line:</li>
<p><em>APACHE_MODULES=&#8221;rewrite actions alias auth_basic authn_file authz_host authz_groupfile authz_default authz_user authn_dbm autoindex cgi dir env expires include log_config mime negotiation setenvif ssl suexec userdir php5 perl&#8221;</em></p>
<p>To:</p>
<p><em>APACHE_MODULES=&#8221;rewrite actions alias auth_basic authn_file authz_host authz_groupfile authz_default authz_user authn_dbm autoindex cgi dir env expires include log_config mime negotiation setenvif ssl suexec userdir php5 perl suphp&#8221;</em></p>
<p>Notice, all I&#8217;ve done is added in &#8220;suphp&#8221; to the end of the string.</p>
<li>Now that we&#8217;ve done this, we need to restart apache:</li>
<p><em>rcapache2 restart</em></p>
<li>Once this is done, check /etc/apache2/sysconfig.d/loadmodule.conf to make sure the following line is added:</li>
<p><em>LoadModule suphp_module                   /usr/lib/apache2/mod_suphp.so</em></p>
<li>We&#8217;re nearly finished.  Now we need to create our configuration for suPHP.  Create a file in /etc named &#8220;suphp.conf&#8221;.  Add in the following lines to configure it:</li>
<p><em>[global]<br />
logfile=/var/log/suphp.log<br />
loglevel=info<br />
webserver_user=wwwrun<br />
docroot=/srv/www/vhosts<br />
allow_file_group_writeable=false<br />
allow_file_others_writeable=false<br />
allow_directory_group_writeable=false<br />
allow_directory_others_writeable=false<br />
check_vhost_docroot=false<br />
errors_to_browser=false<br />
env_path=/bin:/usr/bin<br />
umask=0022<br />
min_uid=30<br />
min_gid=30</em></p>
<p><em>[handlers]<br />
x-httpd-php=php:/usr/bin/php5-cgi<br />
x-suphp-cgi=execute:!self</em></p>
<li> Save this file, our final configuration is within the /etc/apache2/httpd.conf file at the end of that file:</li>
<p><em>&lt;Directory /srv/www/vhosts&gt;<br />
php_admin_value engine off<br />
suPHP_Engine On<br />
AddHandler x-httpd-php .php .php3 .php4 .php5<br />
suPHP_AddHandler x-httpd-php<br />
&lt;/Directory&gt;</em></p>
<p>Which will also add the following two lines, make sure to comment them out:</p>
<p><em>#AddType application/x-httpd-php .php<br />
#AddType application/x-httpd-php-source .phps</em></p>
<li>Restart apache one more time:</li>
<p><em>rcapache2 restart</em></ol>
<p>Voila!  If you add a file into a directory, say named info.php that had permissions above 0644 &#8211; the execution should fail.  Directories are required to be 755, files can be no more than 644.  This is especially useful for things like Joomla that have their own installers that use incorrect permissions due to PHP running as the user that runs apache.  Remember, there are two PHP configurations now, /etc/php5/apache2/php.ini (this is our general config for things like plesk/webmail), and /etc/php5/fastcgi/php.ini (this is our config for websites that run under suPHP).</p>
<p>A great way to test this is by trying software like Joomla &#8211; files will execute as you&#8217;d expect them to, as the user in question.  There may be some issues due to things like not supporting PHP-FastCGI support, but most files won&#8217;t notice the difference.  Also, make sure you rotate that suphp.log file, as it will grow in info mode, as it logs each file execution.<span id="more-12"></span><!--more--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lecaptain.org/tech/suphp-on-plesk-with-suse-linux-enterprise-server-10/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

