<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0"
 xmlns:blogChannel="http://backend.userland.com/blogChannelModule"
>

<channel>
<title>Parallels knowledgebase (KB)</title>
<link>http://kb.parallels.com/</link>
<description>Parallels knowledgebase (KB)</description>
<language>en</language>
<copyright>Copyright 2008 Parallels</copyright>
<pubDate>Wed, 10 Sep 2008 00:00:00 +0600</pubDate>
<lastBuildDate>Wed, 10 Sep 2008 00:00:00 +0600</lastBuildDate>
<webMaster>rt-team@parallels.com</webMaster>

<item>
<title><![CDATA[How to recompile Apache,PHP and IMAP with increased value of file descriptors larger than FD_SETSIZE (1024) on RedHat-like system?]]></title>
<link>http://kb.parallels.com/en/260</link>
<description><![CDATA[<div id="article">
	




	<div id="kb" class="kb">
		<div class="article-container">
			<h2 class="title">How to recompile Apache,PHP and IMAP with increased value of file descriptors larger than FD_SETSIZE (1024) on RedHat-like system?</h2>
			<div class="ab-frame"><div class="bl"><div class="br"><div class="tl"><div class="tr"><!-- frame -->
				<div class="articleProperty">
					<div>Article ID: 260&nbsp;</div>
					<div>Last Review: Oct,30 2009</div>
					<tr>
						<td>Author: </td>
						<td>Bezborodova Anastasiya</td>
					</tr>
					<br/>
					<tr>
						<td>Last updated by: </td>
						<td>system</td>
					</tr>
					<strong>APPLIES TO:</strong>
					<div class="articleApplies">
						<ul>
							<li>Plesk 8.x for Linux/Unix</li>
						</ul>
					</div>
				</div><!-- articleProperty -->
			</div></div></div></div></div><!-- frame -->

			<div class="article-internal-flag"></div>

			<div id="article-content">
				<div class="article-part">
					<h2>Symptoms</h2>
					RPM packages are compiled by vendors with too small (1024) number of file descriptors and it might cause the following messages to appear in /var/log/httpd/error_log:<br /><br />&nbsp;&nbsp;&nbsp; <span style='font-family: courier new,courier;font-size: 12px;'>Segmentation fault (11)</span><br /><br />&nbsp;&nbsp;&nbsp; <span style='font-family: courier new,courier;font-size: 12px;'>[warn] make_sock: problem listening on port 443, file descriptor (1068) larger than FD_SETSIZE (1024)</span><br /><br />&nbsp;&nbsp;&nbsp; <span style='font-family: courier new,courier;font-size: 12px;'>Unable to open logs</span><br /><br />&nbsp;&nbsp;&nbsp; <span style='font-family: courier new,courier;font-size: 12px;'>Too many open files</span><br /><br />This is common Apache issue on the servers with many Virtual Hosts configured, see for more information <a href="http://kb.parallels.comhttp://httpd.apache.org/docs/2.0/misc/descriptors.html">http://httpd.apache.org/docs/2.0/misc/descriptors.html</a>.
				</div>
				<div class="article-part">
					<h2>Resolution</h2>
					<strong>NOTE: Since Plesk 8.2.0 up to 900 domains can be hosted on the OS vendor Apache build without&nbsp; system packages recompilation described in this article if Piped Logs feature is enabled on the Plesk server,&nbsp; see <a href="http://kb.parallels.comhttp://kb.swsoft.com/en/2066" target="_blank">2066</a>.<br /><br />NOTE: This article is for Linux operation systems that have RPM packages structure, such as RHEL, Fedora, CentOS, SUsE.<br />For the details on Debian system please follow <a href="http://kb.parallels.comhttp://faq.swsoft.com/article_41_967_en.html">this article</a>.<br />For the details on FreeBSD system please follow <a href="http://kb.parallels.com../en/1177" target="_blank">this article.</a></strong><br /><br /><strong>NOTE:</strong> Plesk requires, closely depends on and uses many server applications which are not part of Plesk software actually. For example, apache web server, mysql server, php module and binaries and many others are not compiled by SWsoft and not provided by SWsoft, but standard system RPM packages from operating system vendor are used by Plesk and they are used 'as is'. This allows to upgrade and recompile such packages with the options administrator wish. This article is written to help administrators of Plesk to configure their OS and system packages that are not included into Plesk distributive to use with large amount of hosted domains.<br /><br />You need to recompile related applications and libraries, such as&nbsp; openssl, apache, imap, PHP etc from source RPMs with increased FD_SETSIZE value. Please follow through the steps below.<br /><br />Make sure that the system allows to open enough files:<br /><div class="commandline"><code># /sbin/sysctl fs.file-max<br />fs.file-max = 131072</code></div><br />If <strong>fs.file-max</strong> is quite small (several thousands or so), it should be changed by adding the following lines to <strong>/etc/sysctl.conf</strong>:<br /><br /><span style='font-family: courier new,courier;font-size: 12px;'>fs.file-max = 131072</span><br /><br />and running the shell command:<br /><div class="commandline"><code># /sbin/sysctl -w fs.file-max=131072</code></div><br /><strong>NOTE:</strong> if you are running Virtuozzo you have to adjust <strong>fs.file-max</strong> on the hardware node and it will be applied to all VEs.<br /><br />You should have <strong>glibc-kernheaders</strong> and <strong>glibc-headers</strong> packages installed, they can be taken from operating system distributive CD or from your operating system download sites. Edit <strong>__FD_SETSIZE</strong> value in <strong>typesizes.h</strong> and&nbsp; <strong>posix_types.h</strong> files that can be found with:<br /><div class="commandline"><code># find /usr/include/ -name typesizes.h<br /># find /usr/include/ -name posix_types.h</code></div><br />and set it like:<br /><br /><span style='font-family: courier new,courier;font-size: 12px;'>#define __FD_SETSIZE 65536</span><br /><br />Download the following source RPMs that could be found on your operating system download sites or similar places, you may use RPM search engines such as <a href="http://kb.parallels.comhttp://rpm.pbone.net">http://rpm.pbone.net</a> or&nbsp;<a href="http://kb.parallels.comhttp://rpmfind.net">http://rpmfind.net:</a><br /><br />openssl-*.src.rpm<br />httpd-*.src.rpm<br />imap-*.src.rpm<br />php-*.src.rpm<br />libc-client-devel-*.src.rpm (if such RPM is installed)<br />curl-*.src.rpm<br /><br />Recompile <strong>openssl</strong> first. For example:<br /><div class="commandline"><code># /usr/bin/rpmbuild --rebuild openssl-0.9.7a-35.src.rpm</code></div><br />Install compiled openssl RPM with the following command line:<br /><div class="commandline"><code># rpm -Uvh --force /usr/src/redhat/RPMS/i386/openssl-0.9.7a-35.i386.rpm</code></div><br />Repeat the same actions for <strong>cURL</strong>.<br /><br />Recompile and install <strong>apache</strong>:<br /><div class="commandline"><code># rpmbuild --rebuild httpd-2.0.51-2.9.src.rpm<br /># rpm -Uvh --force /usr/src/redhat/RPMS/i386/httpd-2.0.51-2.9.i386.rpm<br /># rpm -Uvh --force /usr/src/redhat/RPMS/i386/httpd-devel-2.0.51-2.9.i386.rpm<br /># rpm -Uvh --force /usr/src/redhat/RPMS/i386/mod_ssl-2.0.51-2.9.i386.rpm</code></div><br />Recompile and install <strong>libc-client</strong> library which is provided by <strong>imap</strong> or <strong>libc-client-devel</strong> packages (it depends on OS) . You have to recompile one that is installed in the system, for example:<br /><div class="commandline"><code># /usr/bin/rpmbuild --rebuild imap-2002d-3.src.rpm<br /># rpm -Uvh --force /usr/src/redhat/RPMS/i386/imap-devel-2002d-3.i386.rpm</code></div><br />or<br /><div class="commandline"><code># /usr/bin/rpmbuild --rebuild libc-client-devel.src.rpm<br /># rpm -Uvh --force /usr/src/redhat/RPMS/i386/libc-client-devel.rpm</code></div><br />Recompile and install  <strong>PHP</strong>, for example:<br /><div class="commandline"><code># rpmbuild --rebuild php-4.3.10-2.4.src.rpm<br /># rpm -Uvh --force /usr/src/redhat/RPMS/i386/php-*</code></div><br />Add `<strong>ulimit -n 65536</strong>` command to <strong>/etc/rc.d/init.d/httpd</strong> and <strong>/usr/sbin/apachectl</strong> apache startup scripts before other commands.<br /><br />Replace /usr/sbin/suexec with Plesk one:<br /><div class="commandline"><code># cp /usr/local/psa/suexec/psa-suexec /usr/sbin/suexec<br /># chown root:apache /usr/sbin/suexec<br /># chmod 4510 /usr/sbin/suexec<br /># /etc/init.d/httpd restart</code></div><br />Since Plesk 7.5:<br /><div class="commandline"><code># cp /usr/local/psa/suexec/psa-suexec /usr/sbin/suexec<br /># /etc/init.d/httpd restart</code></div>
				</div>
			</div>
		</div><!-- article-container -->


			<br/><br/>

			<div id="SubscriptionLink24Article" class="subscriptionLink2">
<a href="http://kb.parallels.com/subscriptions/index.html?Type=Article&ArticleID=260&ArticleLanguage=en&Product=&Category="><img src="http://kb.parallels.com/images/mail.png" width="15" height="15" alt="Subscription for changes to this article"></a>
<a href="http://kb.parallels.com/subscriptions/index.html?Type=Article&ArticleID=260&ArticleLanguage=en&Product=&Category=">Subscription for changes to this article</a>

<script type="text/javascript">

$(document).ready(function() {
	$('#SubscriptionLink24Article a').each(function(){
		$(this).click(function(event) {
			event.preventDefault();
			MainPageContentHide();
			$('#subscription').html('');
			$.get('/Stuff/Subscription', {
													'Type' : 'Article',
													'ArticleID' : '260',
													'ArticleLanguage' : 'en',
													'Product' : '',
													'Category' : ''
												}, function(data) {
																	$('#subscription').html(data);
																	$('#subscription').show();
																	SUBbuildsubmenus_product();
																});
		});
	});
});

</script>

</div>





	</div><!-- kb -->

</div><!-- article -->


]]></description>
<author>Bezborodova Anastasiya</author>
<guid isPermaLink="false">104 LastUpdated: 2009-10-30 02:21:33</guid>
<pubDate>2008-10-06 09:10:24</pubDate>
</item>
</channel>
</rss>



