<?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>Kernel-Panik.com &#187; php</title>
	<atom:link href="http://www.kernel-panik.com/wordpress/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kernel-panik.com/wordpress</link>
	<description>science, technology, linux, howto&#039;s</description>
	<lastBuildDate>Tue, 27 Oct 2009 08:49:52 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Cherokee + php + Zoneminder on Gentoo Linux Howto</title>
		<link>http://www.kernel-panik.com/wordpress/2007/11/20/cherokee-php-zoneminder-on-gentoo-linux-how-to/</link>
		<comments>http://www.kernel-panik.com/wordpress/2007/11/20/cherokee-php-zoneminder-on-gentoo-linux-how-to/#comments</comments>
		<pubDate>Tue, 20 Nov 2007 20:26:31 +0000</pubDate>
		<dc:creator>Jorge_S</dc:creator>
				<category><![CDATA[Cherokee Web Server]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[kernel-panik.com]]></category>
		<category><![CDATA[zoneminder]]></category>
		<category><![CDATA[cctv]]></category>
		<category><![CDATA[cherokee]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.kernel-panik.com/wordpress/?p=4</guid>
		<description><![CDATA[In this How-to I will explain how to install and configure:


Cherokee 	Web Server


Zoneminder 	video camera security and surveillance solution


ffmpeg 	support with mpeg-4 codec (xvid)


php 	and other relevant packages


I have divided this guide in 2 parts: Cherokee + php and Zoneminder installation.
&#160;
So, let&#8217;s begin!




PART 1 : Installing Cherokee Web Server and PHP on Gentoo Linux
&#160;
First we [...]]]></description>
			<content:encoded><![CDATA[<p align="left">In this How-to I will explain how to install and configure:</p>
<ul>
<li>
<p style="margin-bottom: 0in" align="left"><a href="http://www.cherokee-project.com/" onclick="javascript:urchinTracker('/external/www.cherokee-project.com/');" target="_blank">Cherokee</a> 	Web Server</p>
</li>
<li>
<p style="margin-bottom: 0in" align="left"><a href="http://zoneminder.com/" onclick="javascript:urchinTracker('/external/zoneminder.com');" target="_blank">Zoneminder</a> 	video camera security and surveillance solution</p>
</li>
<li>
<p style="margin-bottom: 0in" align="left"><a href="http://ffmpeg.mplayerhq.hu/" onclick="javascript:urchinTracker('/external/ffmpeg.mplayerhq.hu/');">ffmpeg</a> 	support with mpeg-4 codec (xvid)</p>
</li>
<li>
<p align="left"><a href="http://www.php.net/" onclick="javascript:urchinTracker('/external/www.php.net');" target="_blank">php</a> 	and other relevant packages</p>
</li>
</ul>
<p align="left">I have divided this guide in 2 parts: Cherokee + php and Zoneminder installation.</p>
<p align="left">&nbsp;</p>
<p align="left">So, let&#8217;s begin!</p>
<p align="left"><span id="more-4"></span><br />
<script type="text/javascript"><!--
google_ad_client = "pub-0018366203309875";
//www.kernel-panik.com 200x200 Ad unit text
google_ad_slot = "9155669200";
google_ad_width = 200;
google_ad_height = 200;
//--></script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
<strong>PART 1 : Installing Cherokee Web Server and PHP on Gentoo Linux</strong></p>
<p align="left">&nbsp;</p>
<p align="left">First we need to <a href="http://gentoo-wiki.com/Masked" onclick="javascript:urchinTracker('/external/gentoo-wiki.com/Masked');" target="_blank">unmask</a> <a href="http://gentoo-portage.com/www-servers/cherokee/ChangeLog" onclick="javascript:urchinTracker('/external/gentoo-portage.com/www-servers/cherokee/ChangeLog');">www-servers/cherokee</a> package</p>
<p align="left"><font color="#339966">	# echo &#8220;www-servers/cherokee&#8221; &gt;&gt; /etc/portage/package.keywords</font></p>
<p align="left">next we set up our make options for cherokee</p>
<p align="left"><font color="#999999">	Edit /etc/make.conf and add &#8220;threads&#8221; to the USE variable</font></p>
<p align="left">finally we use emerge to compile and install the package</p>
<p align="left"><font color="#339966">	# emerge &#8211;quiet www-servers/cherokee</font></p>
<p align="left"><font color="#ffff99">	</font><font color="#999999">TIP: using the &#8211;quiet reduces the output produced by emerge, reducing the cpu consumption.</font></p>
<p align="left">Now we will add php support to Cherokee. This is quite simple as portage do most of the work for us, you just need php compiled with FastCGI support. &#8211; This is my usual configuration:</p>
<p align="left"><span style="text-decoration: none"><font color="#ccffcc"><font color="#999999">	edit /etc/make.conf</font><br />
<font color="#999999"> add</font> <font color="#339966">&#8220;cgi gd ftp hash mysql opd sockets xml&#8221;</font> <font color="#999999">to the USE variable</font></font></span></p>
<p align="left"><font color="#999999">	cgi &#8211; Add support for the cgi / FastCGI interface<br />
gd &#8211; Adds support for media-libs/gd (to generate graphics on the fly)<br />
</font> <font color="#999999">ftp &#8211; Adds FTP (File Transfer Protocol) support<br />
</font> <font color="#999999">mhash &#8211; Adds support for the mhash library<br />
</font> <font color="#999999">mysql &#8211; Adds mySQL Database support<br />
</font> <font color="#999999">pdo – database access libraries </font><font color="#999999">sockets – Adds support for tcp/ip sockets<br />
xml &#8211; Add support for XML files</font></p>
<p align="left">Now we are now ready to emerge our package (this will take while to finish):</p>
<p style="text-decoration: none" align="left"><font color="#339966">	# emerge &#8211;quiet dev-lang/php</font></p>
<p style="text-decoration: none" align="left">and start Cherokee Web Server:</p>
<p style="text-decoration: none" align="left"><font color="#339966">	# /etc/init.d/cherokee start</font></p>
<p style="text-decoration: none" align="left">Cherokee + PHP should be working fine now, if you want to test it you follow this simple process:</p>
<p style="text-decoration: none" align="left"><font color="#339966">	# echo &#8220;&lt;? phpinfo(); ?&gt;&#8221; &gt; /var/www/localhost/htdocs/test.php</font></p>
<p style="text-decoration: none" align="left"><font color="#999999">	open http://your_domain_or_ip_address/test.php and you should see a php report. </font></p>
<p style="text-decoration: none" align="left"><font color="#999999">	If everything is ok we remove the file:</font></p>
<p style="text-decoration: none" align="left"><font color="#ccffcc">	</font><font color="#339966"># rm /var/www/localhost/htdocs/test.php</font></p>
<p align="left"><font color="#999999"><span style="text-decoration: none">	TIP: the phpinfo(); function can be a dangerous security issue! it displays sensitive information 	about our php configuration!</span></font></p>
<p align="left"><strong>PART 2 : Zoneminder + ffmpeg + mpeg4 (divx) support on Gentoo Linux + Cherokee</strong></p>
<p align="left">Zoneminder is really cool video security and surveillance system, and it&#8217;s even cooler when you add ffmpeg with mpeg4 codec support!. For this guide I assume you have your video capture device, webcam, or video streaming service already up and running. First we modify our USE variable in make.conf:</p>
<p align="left"><font color="#999999"><span style="text-decoration: none">	edit /etc/make.conf with you favorite editor and add the following values to your USE varible:</span></font></p>
<p align="left"><font color="#ffff99"><span style="text-decoration: none">	</span><font color="#339966">&#8220;a52 aac encode ieee1394 imlib ogg sdl theora truetype v4l vorbis x264 xvid aalib alsa fbcon flac ggi libcaca bzip2 gif jpeg jpeg2k mp3 png tiff mpeg vhosts&#8221;</font></font></p>
<p align="left"><font color="#ffff99">	</font><font color="#ccffcc"><font color="#999999">USE variables for</font> <a href="http://gentoo-portage.com/media-video/ffmpeg" onclick="javascript:urchinTracker('/external/gentoo-portage.com/media-video/ffmpeg');" target="_blank">media-video/ffmpeg </a></font></p>
<p align="left"><font color="#999999">a52 &#8211; Enables support for decoding ATSC A/52 streams used in DVD<br />
aac &#8211; Enables support for MPEG-4 AAC Audio<br />
encode &#8211; Adds support for encoding of audio or video files eee1394 &#8211; Enable FireWire/iLink IEEE1394 support (dv, camera, &#8230;)<br />
imlib &#8211; Adds support for imlib, an image loading and rendering library<br />
ogg &#8211; Adds support for the Ogg container format (commonly used by Vorbis, Theora and flac)<br />
sdl &#8211; Adds support for Simple Direct Layer (media library)<br />
theora &#8211; Adds support for the Theora Video Compression Codec<br />
truetype &#8211; Adds support for FreeType and/or FreeType2 fonts<br />
v4l &#8211; Enables video4linux support<br />
vorbis &#8211; Adds support for the OggVorbis audio codec<br />
x264 &#8211; Enable h264 encoding using x264<br />
xvid &#8211; Adds support for xvid.org&#8217;s open-source mpeg-4 codec</font></p>
<p align="left"><font color="#ccffcc"><font color="#999999"><span style="text-decoration: none">	USE variables for </span></font><a href="http://gentoo-portage.com/media-libs/libsdl" onclick="javascript:urchinTracker('/external/gentoo-portage.com/media-libs/libsdl');" target="_blank"><span style="text-decoration: none">media-libs/libsdl</span></a></font></p>
<p align="left"><font color="#999999">aalib &#8211; Adds support for media-libs/aalib (ASCII-Graphics Library)<br />
alsa &#8211; Adds support for media-libs/alsa-lib (Advanced Linux Sound Architecture)<br />
fbcon &#8211; Adds framebuffer support for the console, via the kernel<br />
flac &#8211; Adds support for the flac audio codec<br />
cgi &#8211; Adds support for media-libs/libggi (non-X video api/drivers)<br />
libcaca &#8211; Add support for colored ASCII-art graphics</font></p>
<p align="left"><font color="#ccffcc"><font color="#999999">	USE variables for</font> <a href="http://gentoo-portage.com/media-libs/imlib2" onclick="javascript:urchinTracker('/external/gentoo-portage.com/media-libs/imlib2');">media-libs/imlib2</a></font></p>
<p align="left"><font color="#999999">bzip2 &#8211; Use the bzlib compression library<br />
gif &#8211; Adds GIF image support<br />
jpeg &#8211; Adds JPEG image support<br />
jpeg2k &#8211; Support for JPEG 2000, a wavelet-based image compression format<br />
mp3 &#8211; Add support for reading mp3 files tiff &#8211; Adds support for the tiff image format</font></p>
<p align="left"><font color="#ccffcc"><font color="#999999">	USE variables for </font><a href="http://gentoo-portage.com/www-misc/zoneminder" onclick="javascript:urchinTracker('/external/gentoo-portage.com/www-misc/zoneminder');">www-misc/zoneminder</a></font></p>
<p align="left"><font color="#999999">mpeg -Adds libmpeg3 support to various packages<br />
vhosts &#8211; Adds support for installing web-based applications into a virtual-hosting environment</font></p>
<p align="left">We unmask Zoneminder ebuild and it&#8217;s dependencies:</p>
<p align="left"><font color="#339966">	# echo &#8220;www-misc/zoneminder&#8221; &gt;&gt; /etc/portage/package.keywords </font></p>
<p align="left"><font color="#339966">	# echo &#8220;dev-perl/X10&#8243; &gt;&gt; /etc/portage/package.keywords</font></p>
<p align="left">Zoneminder ebuild needs apache user/group to finish installing, so we need create them (we will delete them later)</p>
<p align="left"><font color="#339966">	# useradd apache (this will create both user and group)</font></p>
<p align="left"><font color="#339966">we are now ready to launch the emerge process for Zoneminder + ffmpeg</font></p>
<p align="left"><font color="#ffff99"><font color="#339966">	# emerge &#8211;quiet web-misc/zoneminder media-video/ffmpeg</font> </font></p>
<p align="left"><font color="#999999">	NOTE: at this point you might see a webapp-config error, this is because you probably didn&#8217;t use vhosts USE variable, in this cases webapp-config runs automatically for user localhost, showing you this error:</font></p>
<p align="left"><font color="#999999">* Fatal error: Your configuration file sets the server type &#8220;Apache&#8221;</font></p>
<p align="left"><font color="#999999">* Fatal error: but the corresponding package does not seem to be installed!</font></p>
<p align="left"><font color="#999999">if this happens, just ignore the error, we will copy the files by hand later.</font></p>
<p align="left">we delete the apache user/group we created earlier</p>
<p align="left"><font color="#ffff99"><font color="#339966">	# userdel apache # groudel apache</font> </font></p>
<p align="left">webapp-config won&#8217;t work because we don&#8217;t have Apache installed, so we copy Zoneminder files manually:</p>
<p align="left"><font color="#339966">	# mkdir /var/www/localhost/htdocs/zoneminder/</font></p>
<p align="left"><font color="#339966">	# cp /usr/share/webapps/zoneminder/1.22.3/htdocs/* /var/www/localhost/htdocs/zoneminder/ -R</font></p>
<p align="left"><font color="#ffff99"><font color="#339966">	# cp /usr/share/webapps/zoneminder/1.22.3/hostroot/cgi-bin/* /var/www/localhost/cgi-bin/ -R</font> </font></p>
<p align="left"><font color="#999999">	TIP: Gentoo always saves emerged webapps in /usr/share/webapps/</font></p>
<p align="left">time to modify directory permissions so Zoneminder works with Cherokee:</p>
<p style="text-decoration: none" align="left"><font color="#339966">	# chown cherokee:cherokee /var/log/zoneminder/ -R</font></p>
<p style="text-decoration: none" align="left"><font color="#339966"># chown cherokee:cherokee /var/run/zm -R</font></p>
<p style="text-decoration: none" align="left"><font color="#339966"># chown cherokee:cherokee /var/www/localhost/ -R</font></p>
<p style="text-decoration: none" align="left">Zoneminder needs a mysql database to store it&#8217;s data, let&#8217;s set things up!</p>
<p style="text-decoration: none" align="left"><font color="#999999">	We check if our hostname is configured in /etc/hosts </font></p>
<p style="text-decoration: none" align="left"><font color="#339966">	kp_1 ~ # vi /etc/hosts</font></p>
<p style="text-decoration: none" align="left"><font color="#339966">127.0.0.1 localhost your_hostname</font></p>
<p style="text-decoration: none" align="left"><font color="#ffcc99"><font color="#999999">Now we run mysql first installation script</font> </font></p>
<p style="text-decoration: none" align="left"><font color="#339966">	kp_1 ~ # /usr/bin/mysql_install_db</font></p>
<p style="text-decoration: none" align="left"><font color="#339966">Installing MySQL system tables&#8230; OK</font></p>
<p style="text-decoration: none" align="left"><font color="#339966">Filling help tables&#8230; OK</font></p>
<p style="text-decoration: none" align="left"><font color="#339966">(etc)</font></p>
<p style="text-decoration: none" align="left"><font color="#000000">	time to set our mysql root password </font></p>
<p style="text-decoration: none" align="left"><font color="#339966">	kp_1 ~ # /etc/init.d/mysql start </font></p>
<p style="text-decoration: none" align="left"><font color="#ffff99"><font color="#339966">	kp_1 ~ # /usr/bin/mysqladmin -u root password &#8216;your_password</font>&#8216;</font></p>
<p style="text-decoration: none" align="left"><font color="#ffcc99"><font color="#000000">	now we fill our sql data and set up database permissions</font><font color="#ffff99"> </font></font></p>
<p style="text-decoration: none" align="left"><font color="#339966">	kp_1 ~ # mysql -p -u root &lt; /usr/share/zoneminder/db/zm_create.sql</font></p>
<p style="text-decoration: none" align="left"><font color="#339966">kp_1 ~ # mysql -p -u root zm</font></p>
<p style="text-decoration: none" align="left"><font color="#339966">mysql&gt; grant all on zm.* to &#8216;zoneminder&#8217;@localhost identified by &#8216;password&#8217;;</font><font color="#ffcc99"> </font></p>
<p style="text-decoration: none" align="left">setting up our system information in /etc/zm.conf</p>
<p style="text-decoration: none" align="left"><font color="#339966">ZM_PATH_BUILD=/usr/share/zoneminder</font></p>
<p style="text-decoration: none" align="left"><font color="#339966">ZM_PATH_WEB=/var/www/localhost/htdocs/zoneminder</font></p>
<p style="text-decoration: none" align="left"><font color="#339966">ZM_PATH_CGI=/var/www/localhost/cgi-bin</font></p>
<p style="text-decoration: none" align="left"><font color="#339966">ZM_WEB_USER=cherokee</font></p>
<p style="text-decoration: none" align="left"><font color="#339966">ZM_WEB_GROUP=cherokee</font></p>
<p style="text-decoration: none" align="left"><font color="#339966">ZM_DB_HOST=localhost</font></p>
<p style="text-decoration: none" align="left"><font color="#339966">ZM_DB_NAME=zm</font></p>
<p style="text-decoration: none" align="left"><font color="#339966">ZM_DB_USER=zoneminder</font></p>
<p style="text-decoration: none" align="left"><font color="#339966">ZM_DB_PASS=you_db_password_for_user_zoneminder</font></p>
<p style="text-decoration: none" align="left">To avoid having low shared memory errors (usually happens) we modify our sysctl.com:</p>
<p style="text-decoration: none" align="left"><font color="#339966">	kp_1 ~ # vi /etc/sysctl.conf</font></p>
<p style="text-decoration: none" align="left"><font color="#339966">kernel.shmmax=200000000</font></p>
<p style="text-decoration: none" align="left"><font color="#339966">kernel.shmall=200000000</font></p>
<p style="text-decoration: none" align="left"><font color="#339966">kp_1 ~ # sysctl -p /etc/sysctl.conf</font></p>
<p style="text-decoration: none" align="left"><font color="#339966">kernel.shmmax = 200000000</font></p>
<p style="text-decoration: none" align="left"><font color="#339966">kernel.shmall = 200000000</font></p>
<p style="text-decoration: none" align="left"><font color="#339966">kp_1 ~ #</font></p>
<p align="left"><span style="text-decoration: none">We set the permissions so user cherokee can read from video devices:</span></p>
<p align="left"><font color="#ffff99"><span style="text-decoration: none">	</span><font color="#339966"># usermod -G video cherokee</font></font></p>
<p align="left"><span style="text-decoration: none">If needed, modify the following line with your video device(s):</span></p>
<p align="left"><font color="#339966">	# chmod 660 /dev/v4l/video0</font></p>
<p align="left">restart involved services “just-in-case(tm)”:</p>
<p align="left"><font color="#339966">	# /etc/init.d/mysql restart</font></p>
<p align="left"><font color="#339966"># /etc/init.d/cherokee restart</font></p>
<p align="left"><font color="#339966"># /etc/init.d/zoneminder restart</font></p>
<p align="left">Point your browser (preferably firefox, gives better streaming performance) to htpp://yoursite/zoneminder, You should now have a working Zoneminder system!</p>
<p align="left">&nbsp;</p>
<p align="left"><font color="#000000">- Feel free to leave any comments, suggestions, bug reports, or any kind of feedback you want<br />
I will try to answer most of your questions &#8211; This page will be updated periodically -</font></p>
<p align="left">-=kp=-</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kernel-panik.com/wordpress/2007/11/20/cherokee-php-zoneminder-on-gentoo-linux-how-to/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
