<?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>has an internet?</title>
	<atom:link href="http://hasaninter.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://hasaninter.net</link>
	<description>Tales from adminland</description>
	<lastBuildDate>Wed, 16 May 2012 11:01:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Latest ffmpeg on CentOS</title>
		<link>http://hasaninter.net/2012/04/28/latest-ffmpeg-on-centos/</link>
		<comments>http://hasaninter.net/2012/04/28/latest-ffmpeg-on-centos/#comments</comments>
		<pubDate>Sat, 28 Apr 2012 08:38:48 +0000</pubDate>
		<dc:creator>Jordan Cooks</dc:creator>
				<category><![CDATA[Installing Shit]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://hasaninter.net/?p=100</guid>
		<description><![CDATA[It&#8217;s been a long time coming, but here&#8217;s my guide to install the latest ffmpeg and associated packages for a video upload site on base CentOS, no cPanel required (if Google got you here and you have cPanel, try the cPanel ffmpeg guide). This article assumes you&#8217;ve already set up your HTTP daemon (Apache, nginx, <a href='http://hasaninter.net/2012/04/28/latest-ffmpeg-on-centos/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a long time coming, but here&#8217;s my guide to install the latest ffmpeg and associated packages for a video upload site on base CentOS, no cPanel required (if Google got you here and you have cPanel, try <a href="http://hasaninter.net/2011/04/01/cpanel-ffmpeg-install/">the cPanel ffmpeg guide</a>). This article assumes you&#8217;ve already set up your HTTP daemon (Apache, nginx, lighttpd, litespeed, etc), scripting agent (PHP), and database provider (mySQL, PostgreSQL, etc). The commands in this guide assume you are running the latest CentOS 5.8 64-bit. Some modifications may be necessary for other architectures and versions of CentOS.</p>
<ol>
<li>Make sure you&#8217;re up to date</li>
<p>Make sure you&#8217;re on the latest CentOS branch. We&#8217;re installing the latest version of ffmpeg, and if you&#8217;re not running the latest version of your CentOS branch, you may run into unexpected issues.<br />
<code><br />
yum update<br />
</code><br />
Install whatever is required, and compatible with your other software. If you update your kernel, reboot before continuing.</p>
<li>Extra Repositories</li>
<p>RPMForge is a useful, fully-compatible extra repository. We will use it for a number of packages that don&#8217;t need to be bleeding-edge. For more information, see <a href="http://wiki.centos.org/AdditionalResources/Repositories/RPMForge">the CentOS wiki</a>.<br />
<code><br />
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm<br />
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt<br />
rpm -K rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm<br />
rpm -i rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm<br />
</code></p>
<li>Development Tools</li>
<p>You must have the required packages to download and compile the source code.<br />
<code><br />
yum groupinstall "Development Tools"<br />
yum install subversion git<br />
</code></p>
<li>Install RPM libraries</li>
<p>Some libraries don&#8217;t need to be bleeding-edge. We&#8217;ll install those now.<br />
<code><br />
yum install gettext-devel expat-devel curl-devel zlib-devel openssl-devel libXext libXext-devel flvtool2<br />
</code></p>
<li>ldconfig</li>
<p>We need to make sure ldconfig is checking the correct directories for libraries.<br />
<code><br />
echo /usr/local/lib >> /etc/ld.so.conf; ldconfig<br />
</code></p>
<li>Download libraries</li>
<p>Okay, here&#8217;s the big one. It&#8217;s probably a good idea to go ahead and copy+paste this whole code block into your terminal at once to save time. One note; the official distribution release of ffmpeg-php no longer compiles. The SVN version available <a href="http://ffmpeg-php.svn.sourceforge.net/viewvc/ffmpeg-php/trunk/ffmpeg-php/">here</a> works, but the SVN tarball link <a href="http://ffmpeg-php.svn.sourceforge.net/viewvc/ffmpeg-php/trunk/ffmpeg-php/?view=tar">here</a> can&#8217;t easily be downloaded in a terminal session, so I&#8217;ve rehosted the file here on this server. This is not my file, I haven&#8217;t modified it, and I take no responsibility for it &#8211; it&#8217;s merely a copy of the file available from the above link.<br />
<code><br />
cd /usr/local/src<br />
wget http://iweb.dl.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz<br />
tar zxf lame-3.99.5.tar.gz<br />
wget http://hasaninter.net/ffmpeg-php.tar.gz<br />
tar xzf ffmpeg-php.tar.gz<br />
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz<br />
tar xzf libvorbis-1.3.3.tar.gz<br />
wget http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz<br />
tar xzf libogg-1.3.0.tar.gz<br />
wget http://iweb.dl.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.3.tar.gz<br />
tar xzf opencore-amr-0.1.3.tar.gz<br />
wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2<br />
tar xjf libtheora-1.1.1.tar.bz2<br />
wget http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gz<br />
tar zxf xvidcore-1.3.2.tar.gz<br />
wget http://downloads.sourceforge.net/faac/faad2-2.7.tar.gz<br />
tar zxf faad2-2.7.tar.gz<br />
wget http://downloads.sourceforge.net/faac/faac-1.28.tar.gz<br />
tar zxf faac-1.28.tar.gz<br />
mkdir /usr/local/lib/codecs<br />
wget ftp://ftp.mplayerhq.hu/MPlayer/releases/codecs/all-20110131.tar.bz2<br />
tar -jxf all-20110131.tar.bz2<br />
wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz<br />
tar zxf yasm-1.2.0.tar.gz<br />
cp all-20110131/* /usr/local/lib/codecs/<br />
chmod -R 755 /usr/local/lib/codecs/<br />
mkdir /usr/local/src/tmp<br />
chmod 777 /usr/local/src/tmp<br />
export TMPDIR=/usr/local/src/tmp<br />
svn co https://gpac.svn.sourceforge.net/svnroot/gpac/trunk/gpac gpac<br />
git clone git://git.videolan.org/x264.git<br />
git clone git://git.videolan.org/ffmpeg.git ffmpeg<br />
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer<br />
</code></p>
<li>Compile everything</li>
<p>Here we go! This is the hard part, where we compile bleeding-edge libraries. At the time this was posted, this all worked. If you run into any errors, try Googling them. If you still can&#8217;t figure it out (or more importantly, if you do!) please comment here and I&#8217;ll edit this post with the latest fixes.</p>
<ol type="a">
<li>Lame</li>
<p><code><br />
cd /usr/local/src/lame-3.99.5/<br />
./configure<br />
make<br />
make install<br />
</code></p>
<li>Libogg</li>
<p><code><br />
cd /usr/local/src/libogg-1.3.0<br />
./configure<br />
make<br />
make install<br />
</code></p>
<li>Libvorbis</li>
<p><code><br />
cd /usr/local/src/libvorbis-1.3.3<br />
./configure<br />
make<br />
make install<br />
</code></p>
<li>yasm</li>
<p><code><br />
cd /usr/local/src/yasm-1.2.0<br />
./configure<br />
make<br />
make install<br />
</code></p>
<li>Libxvid</li>
<p><code><br />
cd /usr/local/src/xvidcore/build/generic<br />
./configure<br />
make<br />
make install<br />
</code></p>
<li>Libx264</li>
<p><code><br />
cd /usr/local/src/x264<br />
./configure --enable-shared<br />
make<br />
make install<br />
</code></p>
<li>Opencore-amr</li>
<p><code><br />
cd /usr/local/src/opencore-amr-0.1.3<br />
./configure<br />
make<br />
make install<br />
</code></p>
<li>Libtheora</li>
<p><code><br />
cd /usr/local/src/libtheora-1.1.1<br />
./configure<br />
make<br />
make install<br />
</code></p>
<li>Fadd2</li>
<p><code><br />
cd /usr/local/src/faad2-2.7<br />
./configure<br />
make<br />
make install<br />
</code></p>
<li>Faac</li>
<p><code><br />
cd /usr/local/src/faac-1.28<br />
./configure<br />
make<br />
make install<br />
</code></p>
<li>MP4Box</li>
<p><code><br />
cd /usr/local/src/gpac<br />
./configure<br />
make<br />
make install<br />
</code></p>
<li>mplayer</li>
<p><code><br />
cd /usr/local/src/mplayer/<br />
./configure --enable-jpeg<br />
make<br />
make install<br />
</code></p>
<li>ffmpeg</li>
<p><code><br />
cd /usr/local/src/ffmpeg<br />
./configure --enable-libmp3lame --enable-libvorbis --enable-shared --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-nonfree --enable-libtheora --enable-version3 --enable-gpl --enable-libxvid<br />
make<br />
make install<br />
</code></p>
<li>ffpmeg-php</li>
<p><code><br />
cd /usr/local/src/ffmpeg-php<br />
phpize<br />
./configure<br />
make<br />
make install<br />
</code></p>
<li>php.ini</li>
<p>If you&#8217;re adding in the ffmpeg module to PHP (which this guide assumes you are), you need to add the extension to PHP. Again, this guide assumes you&#8217;re using PHP on Apache with CentOS 5.<br />
<code><br />
echo "extension=ffmpeg.so" > /etc/php.d/ffmpeg.ini<br />
/etc/init.d/httpd restart<br />
</code>
</ol>
<li>ldconfig</li>
<p>To ensure that all of the libraries are loaded and linkable by ffmpeg, etc, run:<br />
<code><br />
ldconfig<br />
</code>
</ol>
<p>That&#8217;s it! There are a few tests you can run to ensure that this is actually installed properly. Here are the two most important.</p>
<p><code><br />
php -m | grep ffmpeg<br />
ffmpeg<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://hasaninter.net/2012/04/28/latest-ffmpeg-on-centos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RCS, or, oh my god how do I just get my old httpd.conf back</title>
		<link>http://hasaninter.net/2012/04/27/rcs-or-oh-my-god-how-do-i-just-get-my-old-httpd-conf-back/</link>
		<comments>http://hasaninter.net/2012/04/27/rcs-or-oh-my-god-how-do-i-just-get-my-old-httpd-conf-back/#comments</comments>
		<pubDate>Fri, 27 Apr 2012 09:54:03 +0000</pubDate>
		<dc:creator>Jordan Cooks</dc:creator>
				<category><![CDATA[cPanel]]></category>
		<category><![CDATA[Fixing Shit]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://hasaninter.net/?p=92</guid>
		<description><![CDATA[So, you just did something that broke your entire everything. You&#8217;ve tried restoring backups, or you don&#8217;t have any. You&#8217;ve tried correcting the cPanel userdata files, but for some reason, httpd.conf just isn&#8217;t changing. And then you notice this file httpd.conf,v &#8211; this beautiful file, that contains all of the changes you&#8217;ve ever made to <a href='http://hasaninter.net/2012/04/27/rcs-or-oh-my-god-how-do-i-just-get-my-old-httpd-conf-back/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>So, you just did something that broke your entire everything. You&#8217;ve tried restoring backups, or you don&#8217;t have any. You&#8217;ve tried correcting the cPanel userdata files, but for some reason, httpd.conf just isn&#8217;t changing. And then you notice this file httpd.conf,v &#8211; this beautiful file, that contains all of the changes you&#8217;ve ever made to httpd.conf, and has exactly the information you need in it. But how do you convert httpd.conf,v to httpd.conf? Using RCS!</p>
<ol>
<li>Make backups</li>
<p>You got into this situation because you didn&#8217;t make enough backups, you silly little lamb, so let&#8217;s not make that mistake again.<br />
<code><br />
cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.broken<br />
cp /usr/local/apache/conf/httpd.conf /root<br />
cp /usr/local/apache/conf/httpd.conf\,v /root<br />
</code></p>
<li>Find the revision you need</li>
<p>The file is formatted with revision numbers, dates, author information, etc. It&#8217;ll look something like this.<br />
<code><br />
1.517<br />
date    2012.04.11.10.27.03;    author root;    state Exp;<br />
branches;<br />
next    1.516;<br />
</code><br />
Here&#8217;s an example of a revision with actual data. Let&#8217;s say you accidentally deleted this vhost and you need it back. We&#8217;ll be using the revision from this code block in the following examples.<br />
<code><br />
1.365<br />
log<br />
@"Modified by /usr/local/cpanel/scripts/killvhost After removing vhosts"<br />
@<br />
text<br />
@a8725 32<br />
&lt;VirtualHost 1.2.3.4:80&gt;<br />
    ServerName test.com<br />
    ServerAlias www.test.com<br />
    DocumentRoot /home/test/public_html<br />
    ServerAdmin webmaster@@test.com<br />
    ## User test # Needed for Cpanel::ApacheConf<br />
    &lt;IfModule mod_suphp.c&gt;<br />
        suPHP_UserGroup test test<br />
    &lt;/IfModule&gt;<br />
    &lt;IfModule concurrent_php.c&gt;<br />
        php4_admin_value open_basedir "/home/test:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"<br />
        php5_admin_value open_basedir "/home/test:/usr/lib/php:/usr/local/lib/php:/tmp"<br />
    &lt;/IfModule&gt;<br />
    &lt;IfModule !concurrent_php.c&gt;<br />
        &lt;IfModule mod_php4.c&gt;<br />
            php_admin_value open_basedir "/home/test:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"<br />
        &lt;/IfModule&gt;<br />
        &lt;IfModule mod_php5.c&gt;<br />
            php_admin_value open_basedir "/home/test:/usr/lib/php:/usr/local/lib/php:/tmp"<br />
        &lt;/IfModule&gt;<br />
        &lt;IfModule sapi_apache2.c&gt;<br />
            php_admin_value open_basedir "/home/test:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"<br />
    &lt;/IfModule&gt;<br />
    &lt;IfModule !mod_disable_suexec.c&gt;<br />
        SuexecUserGroup onst onst<br />
    &lt;/IfModule&gt;<br />
    CustomLog /usr/local/apache/domlogs/test.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."<br />
    CustomLog /usr/local/apache/domlogs/test.com combined<br />
    Options -ExecCGI -Includes<br />
    RemoveHandler cgi-script .cgi .pl .plx .ppl .perl<br />
&lt;/VirtualHost&gt;<br />
@<br />
</code><br />
Let&#8217;s take this apart a bit.<br />
<strong>1.365</strong> &#8211; this is our revision number. This tells the RCS command to roll back to the version with this data. Location the correct revision to restore is the most important part of the process.</p>
<li>Revert</li>
<p>Now it&#8217;s time to go ahead and revert the files. Make sure you&#8217;re in /root and not overwriting your existing httpd.conf first.<br />
<code><br />
cd /root<br />
co -l -r1.365 httpd.conf<br />
</code><br />
This will ask you if you wish to replace the existing httpd.conf. Say yes. The /root/httpd.conf file will be overwritten with the RCS version from revision 1.356.</p>
<li>Restore httpd.conf</li>
<p><code><br />
cp /root/httpd.conf /usr/local/apache/conf<br />
/etc/init.d/httpd restart<br />
</code><br />
Overwrite your existing httpd.conf file and restart Apache. That&#8217;s it!
</ul>
<p><strong>Final notes</strong>: since this is cPanel, the httpd.conf you just made will eventually get overwritten with the broken one from cPanel configs. This is just a stop-gap measure to get the sites up while you investigate the real problem. Good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://hasaninter.net/2012/04/27/rcs-or-oh-my-god-how-do-i-just-get-my-old-httpd-conf-back/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enable SpamAssassin and Anti-Virus filtering on all domains (Plesk)</title>
		<link>http://hasaninter.net/2012/04/23/enable-spamassassin-and-anti-virus-filtering-on-all-domains-plesk/</link>
		<comments>http://hasaninter.net/2012/04/23/enable-spamassassin-and-anti-virus-filtering-on-all-domains-plesk/#comments</comments>
		<pubDate>Mon, 23 Apr 2012 11:06:41 +0000</pubDate>
		<dc:creator>Jordan Cooks</dc:creator>
				<category><![CDATA[Plesk]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://hasaninter.net/?p=89</guid>
		<description><![CDATA[Just a few quick commandlets. These will enable SpamAssassin on all existing e-mail accounts: for i in `mysql -uadmin -p\`cat /etc/psa/.psa.shadow\` psa -Ns -e "select concat(mail.mail_name,\"@\",domains.name) as address from mail,domains,accounts where mail.dom_id=domains.id and mail.account_id=accounts.id order by address"`; do /usr/local/psa/bin/spamassassin -u $i -status true And enable the anti-virus scanner for inbound and outbound mail on all <a href='http://hasaninter.net/2012/04/23/enable-spamassassin-and-anti-virus-filtering-on-all-domains-plesk/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Just a few quick commandlets. These will enable SpamAssassin on all existing e-mail accounts:<br />
<code><br />
for i in `mysql -uadmin -p\`cat /etc/psa/.psa.shadow\` psa -Ns -e "select concat(mail.mail_name,\"@\",domains.name) as address from mail,domains,accounts where mail.dom_id=domains.id and mail.account_id=accounts.id order by address"`; do /usr/local/psa/bin/spamassassin -u $i -status true<br />
</code><br />
And enable the anti-virus scanner for inbound and outbound mail on all existing e-mail accounts:<br />
<code><br />
for i in `mysql -uadmin -p\`cat /etc/psa/.psa.shadow\` psa -Ns -e "select concat(mail.mail_name,\"@\",domains.name) as address from mail,domains,accounts where mail.dom_id=domains.id and mail.account_id=accounts.id order by address"`; do /usr/local/psa/bin/mail -u $i -antivirus inout; done<br />
</code><br />
To delete all spam messages with a score of 5 or higher:<br />
<code><br />
for i in `mysql -uadmin -p\`cat /etc/psa/.psa.shadow\` psa -Ns -e "select concat(mail.mail_name,\"@\",domains.name) as address from mail,domains,accounts where mail.dom_id=domains.id and mail.account_id=accounts.id order by address"`; do /usr/local/psa/bin/spamassassin -u $i -status true -hits 5 -action del; done<br />
</code><br />
Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://hasaninter.net/2012/04/23/enable-spamassassin-and-anti-virus-filtering-on-all-domains-plesk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Multiple/secondary memcached instance</title>
		<link>http://hasaninter.net/2012/04/13/multiplesecondary-memcached-instance/</link>
		<comments>http://hasaninter.net/2012/04/13/multiplesecondary-memcached-instance/#comments</comments>
		<pubDate>Fri, 13 Apr 2012 09:51:51 +0000</pubDate>
		<dc:creator>Jordan Cooks</dc:creator>
				<category><![CDATA[Installing Shit]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://hasaninter.net/?p=86</guid>
		<description><![CDATA[Need to run 2 versions of memcached? I have no idea why you&#8217;d need to do this, but I had a request for it tonight, and all of the Google results for it are terrible. Here&#8217;s what you need to know. /etc/sysconfig/memcached2 PORT="11212" USER="memcached" MAXCONN="8000" CACHESIZE="1024" OPTIONS="" /etc/init.d/memcached2 #! /bin/sh # # chkconfig: - 55 <a href='http://hasaninter.net/2012/04/13/multiplesecondary-memcached-instance/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Need to run 2 versions of memcached? I have no idea why you&#8217;d need to do this, but I had a request for it tonight, and all of the Google results for it are terrible. Here&#8217;s what you need to know.</p>
<ol>
<li>/etc/sysconfig/memcached2</li>
<p><code><br />
PORT="11212"<br />
USER="memcached"<br />
MAXCONN="8000"<br />
CACHESIZE="1024"<br />
OPTIONS=""<br />
</code></p>
<li>/etc/init.d/memcached2</li>
<p><code><br />
#! /bin/sh<br />
#<br />
# chkconfig: - 55 45<br />
# description:  The memcached daemon is a network memory cache service.<br />
# processname: memcached<br />
# config: /etc/sysconfig/memcached<br />
# pidfile: /var/run/memcached/memcached.pid</p>
<p># Standard LSB functions<br />
#. /lib/lsb/init-functions</p>
<p># Source function library.<br />
. /etc/init.d/functions</p>
<p>PORT=11212<br />
USER=memcached<br />
MAXCONN=1024<br />
CACHESIZE=64<br />
OPTIONS=""</p>
<p>if [ -f /etc/sysconfig/memcached2 ];then<br />
        . /etc/sysconfig/memcached2<br />
fi</p>
<p># Check that networking is up.<br />
. /etc/sysconfig/network</p>
<p>if [ "$NETWORKING" = "no" ]<br />
then<br />
        exit 0<br />
fi</p>
<p>RETVAL=0<br />
prog="memcached"</p>
<p>start () {<br />
        echo -n $"Starting $prog: "<br />
        # insure that /var/run/memcached has proper permissions<br />
    if [ "`stat -c %U /var/run/memcached`" != "$USER" ]; then<br />
        chown $USER /var/run/memcached<br />
    fi</p>
<p>        daemon --pidfile /var/run/memcached/memcached2.pid memcached -d -p $PORT -u $USER  -m $CACHESIZE -c $MAXCONN -P /var/run/memcached/memcached2.pid $OPTIONS<br />
        RETVAL=$?<br />
        echo<br />
        [ $RETVAL -eq 0 ] &#038;&#038; touch /var/lock/subsys/memcached2<br />
}<br />
stop () {<br />
        echo -n $"Stopping $prog: "<br />
        killproc -p /var/run/memcached/memcached2.pid /usr/bin/memcached<br />
        RETVAL=$?<br />
        echo<br />
        if [ $RETVAL -eq 0 ] ; then<br />
            rm -f /var/lock/subsys/memcached2<br />
            rm -f /var/run/memcached2.pid<br />
        fi<br />
}</p>
<p>restart () {<br />
        stop<br />
        start<br />
}</p>
<p># See how we were called.<br />
case "$1" in<br />
  start)<br />
        start<br />
        ;;<br />
  stop)<br />
        stop<br />
        ;;<br />
  status)<br />
        status memcached<br />
        ;;<br />
  restart|reload|force-reload)<br />
        restart<br />
        ;;<br />
  condrestart)<br />
        [ -f /var/lock/subsys/memcached2 ] &#038;&#038; restart || :<br />
        ;;<br />
  *)<br />
        echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"<br />
        exit 1<br />
esac</p>
<p>exit $?<br />
</code></p>
<li>Configure the service to run on start-up</li>
<p><code><br />
chmod +x /etc/init.d/memcached2<br />
chkconfig memcached2 on<br />
/etc/init.d/memcached2<br />
</code><br />
That&#8217;s it!</p>
]]></content:encoded>
			<wfw:commentRss>http://hasaninter.net/2012/04/13/multiplesecondary-memcached-instance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing mod_pagespeed on a cPanel/WHM server</title>
		<link>http://hasaninter.net/2012/04/13/installing-mod_pagespeed-on-a-cpanelwhm-server/</link>
		<comments>http://hasaninter.net/2012/04/13/installing-mod_pagespeed-on-a-cpanelwhm-server/#comments</comments>
		<pubDate>Fri, 13 Apr 2012 08:27:15 +0000</pubDate>
		<dc:creator>Jordan Cooks</dc:creator>
				<category><![CDATA[cPanel]]></category>
		<category><![CDATA[Installing Shit]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://hasaninter.net/?p=80</guid>
		<description><![CDATA[Google&#8217;s mod_pagespeed is an Apache module for performance optimization. It can be used to increase the speed of pages served through Apache. This module is compatible with cPanel and WHM&#8217;s Apache setup, and it&#8217;s pretty easy to install. Download the correct mod_pagespeed RPM for your architecture. mod_pagespeed has RPMs available for 32-bit and 64-bit systems. <a href='http://hasaninter.net/2012/04/13/installing-mod_pagespeed-on-a-cpanelwhm-server/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p><a href="https://developers.google.com/speed/pagespeed/mod">Google&#8217;s mod_pagespeed</a> is an Apache module for performance optimization. It can be used to increase the speed of pages served through Apache. This module is compatible with cPanel and WHM&#8217;s Apache setup, and it&#8217;s pretty easy to install.</p>
<ol>
<li>Download the correct mod_pagespeed RPM for your architecture.</li>
<p>mod_pagespeed has RPMs available for 32-bit and 64-bit systems. First, let&#8217;s download the RPM files.<br />
For 32-bit:<br />
<code><br />
cd /usr/local/src<br />
mkdir mod_pagespeed<br />
cd mod_pagespeed<br />
wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-beta_current_i386.rpm<br />
</code><br />
For 64-bit:<br />
<code><br />
cd /usr/local/src/<br />
mkdir mod_pagespeed<br />
wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-beta_current_x86_64.rpm<br />
</code></p>
<li>Extract the necessary files.</li>
<p>I&#8217;m going to assume a 64-bit system from here on out. If you&#8217;re on a 32-bit system, the extracted files exist in slightly different paths; adjust accordingly.<br />
<code><br />
rpm2cpio mod-pagespeed-beta_current_x86_64.rpm | cpio -idmv<br />
cp usr/lib64/httpd/modules/mod_pagespeed.so /usr/local/apache/modules/<br />
chmod 755 /usr/local/apache/modules/mod_pagespeed.so<br />
</code></p>
<li>Create pagespeed directories.</li>
<p><code><br />
mkdir -p /var/mod_pagespeed/{cache,files}<br />
chown nobody:nobody /var/mod_pagespeed/*<br />
</code></p>
<li>Enable mod_deflate (required for mod_pagespeed).</li>
<p>The location of your httpd source directory will vary depending on the version of Apache you have installed. The quickest way to find the correct location is tab completion.<br />
<code><br />
/usr/local/apache/bin/apxs -c -i /home/cpeasyapache/src/httpd-[tab]/modules/filters/mod_deflate.c<br />
</code></p>
<li>Set up your mod_pagespeed configuration.</li>
<p>Add the following to the Apache configuration files. The simplest way to do this is to create a new configuration file called /usr/local/apache/conf/pagespeed.conf and then include that using the cPanel include files. Place the following in pagespeed.conf:<br />
<code><br />
LoadModule pagespeed_module modules/mod_pagespeed.so</p>
<p># Only attempt to load mod_deflate if it hasn't been loaded already.<br />
&lt;IfModule !mod_deflate.c&gt;<br />
 LoadModule deflate_module modules/mod_deflate.so<br />
&lt;/IfModule&gt;<br />
&lt;IfModule pagespeed_module&gt;<br />
    # Turn on mod_pagespeed. To completely disable mod_pagespeed, you<br />
    # can set this to "off".<br />
    ModPagespeed on</p>
<p>    # Direct Apache to send all HTML output to the mod_pagespeed<br />
    # output handler.<br />
    AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html</p>
<p>    # The ModPagespeedFileCachePath and<br />
    # ModPagespeedGeneratedFilePrefix directories must exist and be<br />
    # writable by the apache user (as specified by the User<br />
    # directive).<br />
    ModPagespeedFileCachePath            "/var/mod_pagespeed/cache/"<br />
    ModPagespeedGeneratedFilePrefix      "/var/mod_pagespeed/files/"</p>
<p>    # Override the mod_pagespeed 'rewrite level'. The default level<br />
    # "CoreFilters" uses a set of rewrite filters that are generally<br />
    # safe for most web pages. Most sites should not need to change<br />
    # this value and can instead fine-tune the configuration using the<br />
    # ModPagespeedDisableFilters and ModPagespeedEnableFilters<br />
    # directives, below. Valid values for ModPagespeedRewriteLevel are<br />
    # PassThrough, CoreFilters and TestingCoreFilters.<br />
    #<br />
    # ModPagespeedRewriteLevel PassThrough</p>
<p>    # Explicitly disables specific filters. This is useful in<br />
    # conjuction with ModPagespeedRewriteLevel. For instance, if one<br />
    # of the filters in the CoreFilters needs to be disabled for a<br />
    # site, that filter can be added to<br />
    # ModPagespeedDisableFilters. This directive contains a<br />
    # comma-separated list of filter names, and can be repeated.<br />
    #<br />
    # ModPagespeedDisableFilters rewrite_images</p>
<p>    # Explicitly enables specific filters. This is useful in<br />
    # conjuction with ModPagespeedRewriteLevel. For instance, filters<br />
    # not included in the CoreFilters may be enabled using this<br />
    # directive. This directive contains a comma-separated list of<br />
    # filter names, and can be repeated.<br />
    #<br />
    # ModPagespeedEnableFilters rewrite_javascript,rewrite_css<br />
    # ModPagespeedEnableFilters collapse_whitespace,elide_attributes</p>
<p>    # ModPagespeedDomain<br />
    # authorizes rewriting of JS, CSS, and Image files found in this<br />
    # domain. By default only resources with the same origin as the<br />
    # HTML file are rewritten. For example:<br />
    #<br />
    #   ModPagespeedDomain cdn.myhost.com<br />
    #<br />
    # This will allow resources found on http://cdn.myhost.com to be<br />
    # rewritten in addition to those in the same domain as the HTML.<br />
    #<br />
    # Wildcards (* and ?) are allowed in the domain specification. Be<br />
    # careful when using them as if you rewrite domains that do not<br />
    # send you traffic, then the site receiving the traffic will not<br />
    # know how to serve the rewritten content.</p>
<p>    # Other defaults (cache sizes and thresholds):<br />
    #<br />
    # ModPagespeedFileCacheSizeKb          102400<br />
    # ModPagespeedFileCacheCleanIntervalMs 3600000<br />
    # ModPagespeedLRUCacheKbPerProcess     1024<br />
    # ModPagespeedLRUCacheByteLimit        16384<br />
    # ModPagespeedCssInlineMaxBytes        2048<br />
    # ModPagespeedImageInlineMaxBytes      2048<br />
    # ModPagespeedCssImageInlineMaxBytes   2048<br />
    # ModPagespeedJsInlineMaxBytes         2048<br />
    # ModPagespeedCssOutlineMinBytes       3000<br />
    # ModPagespeedJsOutlineMinBytes        3000</p>
<p>    # Bound the number of images that can be rewritten at any one time; this<br />
    # avoids overloading the CPU.  Set this to 0 to remove the bound.<br />
    #<br />
    # ModPagespeedImageMaxRewritesAtOnce      8</p>
<p>    # Settings for image optimization:<br />
    #<br />
    # Jpeg recompression quality (0 to 100, -1 strips metadata):<br />
    # ModPagespeedJpegRecompressionQuality -1<br />
    #<br />
    # Percent of original image size below which optimized images are retained:<br />
    # ModPagespeedImageLimitOptimizedPercent 100<br />
    #<br />
    # Percent of original image area below which image resizing will be<br />
    # attempted:<br />
    # ModPagespeedImageLimitResizeAreaPercent 100</p>
<p>    # When Apache is set up as a browser proxy, mod_pagespeed can record<br />
    # web-sites as they are requested, so that an image of the web is built up<br />
    # in the directory of the proxy administrator's choosing.  When ReadOnly is<br />
    # on, only files already present in the SlurpDirectory are served by the<br />
    # proxy.<br />
    #<br />
    # ModPagespeedSlurpDirectory ...<br />
    # ModPagespeedSlurpReadOnly on</p>
<p>    # The maximum URL size is generally limited to about 2k characters<br />
    # due to IE: See http://support.microsoft.com/kb/208427/EN-US.<br />
    # Apache servers by default impose a further limitation of about<br />
    # 250 characters per URL segment (text between slashes).<br />
    # mod_pagespeed circumvents this limitation, but if you employ<br />
    # proxy servers in your path you may need to re-impose it by<br />
    # overriding the setting here.  The default setting is 1024<br />
    # characters.<br />
    #<br />
    # ModPagespeedMaxSegmentLength 250</p>
<p>    # Uncomment this if you want to prevent mod_pagespeed from combining files<br />
    # (e.g. CSS files) across paths<br />
    #<br />
    # ModPagespeedCombineAcrossPaths off</p>
<p>    # Explicitly tell mod_pagespeed to load some resources from disk.<br />
    # This will speed up load time and update frequency.<br />
    #<br />
    # This should only be used for static resources which do not need<br />
    # specific headers set or other processing by Apache.<br />
    #<br />
    # Both URL and filesystem path should specify directories and<br />
    # filesystem path must be absolute (for now).<br />
    #<br />
    # ModPagespeedLoadFromFile "http://example.com/static/" "/var/www/static/"</p>
<p>    # Enables server-side instrumentation and statistics.  If this rewriter is<br />
    # enabled, then each rewritten HTML page will have instrumentation javacript<br />
    # added that sends latency beacons to /mod_pagespeed_beacon.  These<br />
    # statistics can be accessed at /mod_pagespeed_statistics.  You must also<br />
    # enable the mod_pagespeed_statistics and mod_pagespeed_beacon handlers<br />
    # below.<br />
    #<br />
    # ModPagespeedEnableFilters add_instrumentation</p>
<p>    # Uncomment the following line so that ModPagespeed will not cache or<br />
    # rewrite resources with Vary: in the header, e.g. Vary: User-Agent.<br />
    # ModPagespeedRespectVary on</p>
<p>    # This handles the client-side instrumentation callbacks which are injected<br />
    # by the add_instrumentation filter.<br />
    # You can use a different location by adding the ModPagespeedBeaconUrl<br />
    # directive; see the documentation on add_instrumentation.<br />
    &lt;Location /mod_pagespeed_beacon&gt;<br />
          SetHandler mod_pagespeed_beacon<br />
    &lt;/Location&gt;</p>
<p>    # Uncomment the following line if you want to disable statistics entirely.<br />
    #<br />
    # ModPagespeedStatistics off</p>
<p>    # This page lets you view statistics about the mod_pagespeed module.<br />
    &lt;Location /mod_pagespeed_statistics&gt;<br />
        Order allow,deny<br />
        # You may insert other "Allow from" lines to add hosts you want to<br />
        # allow to look at generated statistics.  Another possibility is<br />
        # to comment out the "Order" and "Allow" options from the config<br />
        # file, to allow any client that can reach your server to examine<br />
        # statistics.  This might be appropriate in an experimental setup or<br />
        # if the Apache server is protected by a reverse proxy that will<br />
        # filter URLs in some fashion.<br />
        Allow from localhost<br />
        Allow from 127.0.0.1<br />
        SetHandler mod_pagespeed_statistics<br />
    &lt;/Location&gt;</p>
<p>    # Page /mod_pagespeed_message lets you view the latest messages from<br />
    # mod_pagespeed, regardless of log-level in your httpd.conf<br />
    # ModPagespeedMessageBufferSize is the maximum number of bytes you would<br />
    # like to dump to your /mod_pagespeed_message page at one time,<br />
    # its default value is 100k bytes.<br />
    # Set it to 0 if you want to disable this feature.</p>
<p>    ModPagespeedMessageBufferSize 100000</p>
<p>    # mod_pagespeed has the ability to collect statistics about page visits as<br />
    # well as page, resource, and div location (see div_structure_filter)<br />
    # referrals.  These will eventually be used to speed up pages with at least<br />
    # resource pre-fetch, if not Chrome's new pre-render, technology.  See<br />
    # googlewebmastercentral.blogspot.com/2011/06/announcing-instant-pages.html<br />
    #   We recommend enabling the div_structure filter if turning on statistics<br />
    # collection below.  Enabling the div_structure filter will increase the<br />
    # effectiveness of pre-rendering prediction, because it will take into<br />
    # account both URLs and page locations when aggregating user click through<br />
    # behavior.  To enable the div_structure filter, uncomment the appropriate<br />
    # line below or add div_structure to the enabled filters at the top of this<br />
    # configuration file.<br />
    #   Page /mod_pagespeed_referer_statistics lets you view the accumulated<br />
    # referral statistics.<br />
    #   ModPagespeedCollectRefererStatistics on enables collection (default off)<br />
    #   ModPagespeedHashRefererStatistics obscures collected info (default off)<br />
    #   ModPagespeedRefererStatisticsOutputLevel can be changed if the page<br />
    # /mod_pagespeed_referer_statistics is slow to load:<br />
    #   - Organized (default) is the most readable and ordered logically, but<br />
    #       involves computation<br />
    #   - Simple is readable but unordered<br />
    #   - Fast is the fastest and contains all necessary information, but is<br />
    #       fairly unreadable</p>
<p>    # ModPagespeedCollectRefererStatistics on<br />
    # ModPagespeedHashRefererStatistics on<br />
    # ModPagespeedRefererStatisticsOutputLevel Simple<br />
    # ModPagespeedEnableFilters div_structure</p>
<p>    &lt;Location /mod_pagespeed_message&gt;<br />
        Allow from localhost<br />
        Allow from 127.0.0.1<br />
        SetHandler mod_pagespeed_message<br />
    &lt;/Location&gt;<br />
    &lt;Location /mod_pagespeed_referer_statistics&gt;<br />
        Allow from localhost<br />
        Allow from 127.0.0.1<br />
        SetHandler mod_pagespeed_referer_statistics<br />
    &lt;/Location&gt;<br />
&lt;/IfModule&gt;<br />
</code><br />
And then open /usr/local/apache/conf/includes/pre_main_global.conf and add:<br />
<code><br />
Include conf/pagespeed.conf<br />
</code></p>
<li>Rebuild Apache config and restart apache.</li>
<p><code><br />
/scripts/buildhttpdconf<br />
/etc/init.d/httpd restart<br />
</code>
</ol>
<p>That&#8217;s it!</p>
]]></content:encoded>
			<wfw:commentRss>http://hasaninter.net/2012/04/13/installing-mod_pagespeed-on-a-cpanelwhm-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Increasing cPanel /tmp size</title>
		<link>http://hasaninter.net/2011/05/07/increasing-cpanel-tmp-size/</link>
		<comments>http://hasaninter.net/2011/05/07/increasing-cpanel-tmp-size/#comments</comments>
		<pubDate>Sun, 08 May 2011 04:43:31 +0000</pubDate>
		<dc:creator>Jordan Cooks</dc:creator>
				<category><![CDATA[cPanel]]></category>
		<category><![CDATA[Fixing Shit]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://hasaninter.net/?p=50</guid>
		<description><![CDATA[By default, cPanel sets up a paltry]]></description>
			<content:encoded><![CDATA[<p>By default, cPanel sets up a paltry <512MB /tmp disk. This isn't nearly large enough for large file uploads or other disk-intensive purposes. While it's better to use RAM for temporary storage, sometimes you need a place to dump huge files (such as uploads). Luckily, raising the /tmp disk size has been fairly simple. cPanel's script to secure the /tmp partition against drop-in hacks by making it noexec can also resize the /tmp directory.</p>
<p>The file we'll be modifying is:</p>
<p><code><br />
/scripts/securetmp<br />
</code></p>
<p>Until recently, modifying one variable was enough to change this, but it seems like there was a change recently that has caused that method to no longer remount /tmp properly. Luckily, the fix for this is two additional small changes to the file.</p>
<p>Let's open up /scripts/securetmp in your favorite editor:</p>
<p><code><br />
nano /scripts/securetmp<br />
</code></p>
<p>First, we're going to modify line 49:</p>
<p><code><br />
my $auto = 1<br />
</code></p>
<p>If this isn't already set to 1, set it. Just makes things easier. Next, let's set the /tmp size, line 148:</p>
<p><code><br />
my $tmpdsksize = 2097152;<br />
</code></p>
<p>This size is in KB - 2GB aught to do it. Now, to fix the issue of mounting /tmp, line 289:</p>
<p><code><br />
system 'mount', '-o', $mountkeyword . ',loop,noexec,nosuid', $tmpmnt, '/tmp';<br />
</code></p>
<p>We're adding "loop," to the options passed to the mount command to ensure that the system understands /tmp is a loopback device being created on /usr/tmpDSK. Save and exit your file.</p>
<p>Next, we need to shut off anything using /tmp:</p>
<p><code><br />
/etc/init.d/mysql stop<br />
/etc/init.d/httpd stop<br />
</code></p>
<p>And unmount it and /var/tmp:</p>
<p><code><br />
umount /tmp<br />
umount /var/tmp<br />
</code></p>
<p>If you get errors, retry a few times, it'll usually unmount after the 2nd or 3rd try. If you're still getting errors, make sure nothing is open in /tmp:</p>
<p><code><br />
lsof | grep /tmp<br />
</code></p>
<p>Shut it down or delete it. Next, we need to remove the existing /tmp partition file:</p>
<p><code><br />
rm -f /usr/tmpDSK<br />
</code></p>
<p>And finally, create the new device:</p>
<p><code><br />
/scripts/securetmp<br />
</code></p>
<p>Depending on the size of your partition, this may take up to 15-20 minutes. After you're done, start everything back up and ensure /tmp is mounted and the right size with a simple:</p>
<p><code><br />
df -h<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://hasaninter.net/2011/05/07/increasing-cpanel-tmp-size/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing New Plesk Components on Linux</title>
		<link>http://hasaninter.net/2011/04/09/installing-new-plesk-components-on-linux/</link>
		<comments>http://hasaninter.net/2011/04/09/installing-new-plesk-components-on-linux/#comments</comments>
		<pubDate>Sun, 10 Apr 2011 01:40:47 +0000</pubDate>
		<dc:creator>Jordan Cooks</dc:creator>
				<category><![CDATA[Fixing Shit]]></category>
		<category><![CDATA[Installing Shit]]></category>
		<category><![CDATA[Plesk]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://hasaninter.net/?p=45</guid>
		<description><![CDATA[Installing New Components Ever been in a Plesk box but can&#8217;t find certain components, like ASP support, or the backup manager? This is because Plesk installs whatever you tell it to at the initial install, and only whatever you tell it to. This leads to a lot of missing components that you might be used <a href='http://hasaninter.net/2011/04/09/installing-new-plesk-components-on-linux/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<h1>Installing New Components</h1>
<p>Ever been in a Plesk box but can&#8217;t find certain components, like ASP support, or the backup manager? This is because Plesk installs whatever you tell it to at the initial install, and only whatever you tell it to. This leads to a lot of missing components that you might be used to having access to. Plesk won&#8217;t tell you anything in the GUI except that the component is not installed, so you must hunt down this binary:</p>
<p><code>/usr/local/psa/admin/bin/autoinstaller</code><br />
<br />This is the Plesk Autoinstaller, which will allow you, through its byzantine menu corridors, to find the gold that is the component you need. Navigating it is fairly simple, although you&#8217;ll probably want to read all of the text on the screen if this is your first time.</p>
<p>However, a more sinister condition awaits you &#8211; the fact that the Plesk autoinstaller apparently doesn&#8217;t know how to fucking resolve rpm dependencies. Why is it called an autoinstaller if it doesn&#8217;t automatically install anything extra? I don&#8217;t know.</p>
<h1>Resolving Plesk Component Dependencies</h1>
<p>Luckily, it&#8217;s not that difficult to resolve RPM dependency errors. Did you get an error message that looks something like this?</p>
<p><code><br />
Retrieving information about the installed packages...<br />
File downloading PSA_9.3.0/dist-rpm-CentOS-5-x86_64/build-9.3.0-cos5-x86_64.hdr.gz: 10%..20%..30%..40%..50%..60%..70%..80%..90%..100% was finished.<br />
File downloading PSA_9.3.0/update-rpm-CentOS-5-x86_64/update-9.3.0-cos5-x86_64.hdr.gz: 10%..20%..30%..40%..50%..60%..70%..80%..90%..100% was finished.<br />
File downloading PSA_9.3.0/thirdparty-rpm-CentOS-5-x86_64/thirdparty-9.3.0-cos5-x86_64.hdr.gz: 13%..25%..31%..40%..54%..60%..72%..83%..95%..100% was finished.<br />
Determining the packages that need to be installed.<br />
ERROR: Unable to install the "psa-backup-manager-9.3.0-cos5.build93091230.06.x86_64" package.<br />
Not all packages were installed.<br />
Please, contact product technical support.<br />
[root@host2 plesk]#</code><br />
<br />Not to worry! First, try Google to find that RPM &#8211; Plesk allows their FTP server to be directory indexed, so it shouldn&#8217;t be hard to find the exact RPM it&#8217;s erroring out on. Try downloading the .rpm file and installing it manually using rpm -i:</p>
<p><code>wget http://autoinstall.swsoft.com.cn/PSA_9.3.0/dist-rpm-CentOS-5-x86_64/opt/backup/psa-backup-manager-9.3.0-cos5.build93091230.06.x86_64.rpm<br />
rpm -i psa-backup-manager-9.3.0-cos5.build93091230.06.x86_64.rpm</code></p>
<p>If all goes well, you&#8217;ll get output messages listing the failed dependencies. Ignore any Plesk-looking dependencies, the auto-installer actually fixes these. Use yum to install any other system packages you may need.</p>
]]></content:encoded>
			<wfw:commentRss>http://hasaninter.net/2011/04/09/installing-new-plesk-components-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cPanel&#8217;s Built-in php.ini File</title>
		<link>http://hasaninter.net/2011/04/09/cpanels-built-in-php-ini-file/</link>
		<comments>http://hasaninter.net/2011/04/09/cpanels-built-in-php-ini-file/#comments</comments>
		<pubDate>Sat, 09 Apr 2011 19:00:04 +0000</pubDate>
		<dc:creator>Jordan Cooks</dc:creator>
				<category><![CDATA[cPanel]]></category>
		<category><![CDATA[Fixing Shit]]></category>
		<category><![CDATA[Installing Shit]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://hasaninter.net/?p=43</guid>
		<description><![CDATA[Because I lose track of it all the time, this is the location to the php.ini file for cPanel&#8217;s built-in PHP installation. /usr/local/cpanel/3rdparty/etc/php.ini And, since it&#8217;s slightly relevant, you can rebuild the internal PHP installation with this script: /scripts/makecppphp]]></description>
			<content:encoded><![CDATA[<p>Because I lose track of it all the time, this is the location to the php.ini file for cPanel&#8217;s built-in PHP installation.</p>
<p><code>/usr/local/cpanel/3rdparty/etc/php.ini</code></p>
<p>And, since it&#8217;s slightly relevant, you can rebuild the internal PHP installation with this script:</p>
<p><code>/scripts/makecppphp</code></p>
]]></content:encoded>
			<wfw:commentRss>http://hasaninter.net/2011/04/09/cpanels-built-in-php-ini-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Troubleshooting Slow mySQL Performance with mtop</title>
		<link>http://hasaninter.net/2011/04/08/troubleshooting-slow-mysql-performance-with-mtop/</link>
		<comments>http://hasaninter.net/2011/04/08/troubleshooting-slow-mysql-performance-with-mtop/#comments</comments>
		<pubDate>Sat, 09 Apr 2011 02:46:02 +0000</pubDate>
		<dc:creator>Jordan Cooks</dc:creator>
				<category><![CDATA[Fixing Shit]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://hasaninter.net/?p=29</guid>
		<description><![CDATA[mySQL is the database backbone behind a wide variety of software programs and scripts, but most people don&#8217;t know how to code for it properly. As such, mySQL-related overloads and optimization of sub-par mySQL databases can take a lot of time. The easiest way to track and troubleshoot troublesome threads is with mtop &#8211; live <a href='http://hasaninter.net/2011/04/08/troubleshooting-slow-mysql-performance-with-mtop/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>mySQL is the database backbone behind a wide variety of software programs and scripts, but most people don&#8217;t know how to code for it properly. As such, mySQL-related overloads and optimization of sub-par mySQL databases can take a lot of time. The easiest way to track and troubleshoot troublesome threads is with mtop &#8211; live mySQL query querying.</p>
<h1>Prerequisites</h1>
<p>mtop requires curses. In CentOS, this is as simple as a few yum commands. There are a few extra steps for cPanel compatibility.</p>
<ol>
<li>Install curses and curses-devel:<br />
<code><br />
yum install curses curses-devel</code></li>
<p>
<li>Install curses-Perl:</p>
<p><code>yum install curses-Perl</code></p>
<ol type="a">
<li>If you&#8217;re on cPanel, you&#8217;ll first need to remove the perl* exclude from yum.conf.</p>
<p><code>nano /etc/yum.conf</code></p>
<p>In the exclude= line, remove “perl*” – save (CTRL+O) and exit (CTRL+X). Be sure to add it back after installing curses-Perl as per the above command.</li>
</ol>
</li>
</ol>
<h1>Install mtop</h1>
<p>Now it&#8217;s time to fetch the latest version of mtop and compile it. The homepage is <a href="http://mtop.sourceforge.net/">here</a> if you wish to check for the latest version. As of this post, we will be using 0.6.6, the latest version.</p>
<ol>
<li>Grab the mtop source:</p>
<p><code>wget http://softlayer.dl.sourceforge.net/project/mtop/mtop/v0.6.6/mtop-0.6.6.tar.gz</code></li>
<p>
<li>Configure, make, and install:</p>
<p><code>tar -zxf mtop-0.6.6.tar.gz<br />
cd mtop-0.6.6<br />
perl Makefile.PL<br />
make<br />
make install</code></li>
</ol>
<h1>Configure and run</h1>
<p>By default, mtop doesn&#8217;t connect as the root user. For most server installations, we want to connect as root. Here&#8217;s the quickest and easiest way to run mtop.</p>
<ol>
<li>Find your current mySQL root password:</p>
<p><code>cat /root/.my.cnf</code></li>
<li>Copy the root password (and hostname, if different than localhost) and run the command as follows:
<p><code>mtop --host=YOURHOSTNAME --dbuser=root --password=YOURPASSWORD --seconds=1</code></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://hasaninter.net/2011/04/08/troubleshooting-slow-mysql-performance-with-mtop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding a New mySQL Access Host</title>
		<link>http://hasaninter.net/2011/04/08/adding-a-new-mysql-access-host/</link>
		<comments>http://hasaninter.net/2011/04/08/adding-a-new-mysql-access-host/#comments</comments>
		<pubDate>Fri, 08 Apr 2011 18:30:36 +0000</pubDate>
		<dc:creator>Jordan Cooks</dc:creator>
				<category><![CDATA[cPanel]]></category>
		<category><![CDATA[Fixing Shit]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://hasaninter.net/?p=27</guid>
		<description><![CDATA[So you&#8217;ve migrated to a new database server, or a new web server, or you&#8217;ve added a new database server to your cluster. The problem is, all of your mySQL users only have grants on the old server. Luckily, the guys at cPanel know your pain and have added an easy way to make sure <a href='http://hasaninter.net/2011/04/08/adding-a-new-mysql-access-host/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>So you&#8217;ve migrated to a new database server, or a new web server, or you&#8217;ve added a new database server to your cluster. The problem is, all of your mySQL users only have grants on the old server. Luckily, the guys at cPanel know your pain and have added an easy way to make sure all of your users have access to their databases.</p>
<h1>Add the new hostname</h1>
<ol>
<li><strong>Back up the &#8220;mysql&#8221; database before making ANY changes.</strong></p>
<li>Log in to WHM as root</li>
<li>Navigate to SQL Services->Additional SQL Access Hosts</li>
<li>Put the new IP address that you&#8217;ll be accessing FROM in the box</li>
</ol>
<p>If you&#8217;ve got a deadline, you can add the host % here &#8211; this will allow access to mySQL from all hosts. SQL authentication is still required, so you&#8217;re not exposing any passwords, but if your clients use insecure mySQL usernames, passwords, and database prefixes, this could still leave you open to a huge SQL injection vulnerability risk, so it is highly not recommended.</p>
<h1>Add the grants</h1>
<ol>
<li>Navigate back to the Additional SQL Access Hosts page, and at the bottom of the page, click the link labeled &#8220;click here.&#8221;</li>
<li>Wait for the process to finish and confirm access.</li>
</ol>
<p>This quick-and-dirty method will ensure your users will still be able to authenticate using their same passwords, and saves a lot of nasty mySQL batch work.</p>
]]></content:encoded>
			<wfw:commentRss>http://hasaninter.net/2011/04/08/adding-a-new-mysql-access-host/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

