<?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>SupportSages &#187; MySQL</title>
	<atom:link href="http://www.supportsages.com/blog/category/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.supportsages.com/blog</link>
	<description>Technical Support and Server Management : Musings in the fox hole.</description>
	<lastBuildDate>Fri, 16 Jul 2010 02:47:40 +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>mod_php explained</title>
		<link>http://www.supportsages.com/blog/2010/06/mod_php-explained/</link>
		<comments>http://www.supportsages.com/blog/2010/06/mod_php-explained/#comments</comments>
		<pubDate>Fri, 11 Jun 2010 14:32:58 +0000</pubDate>
		<dc:creator>George</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Training]]></category>
		<category><![CDATA[Apache Handler Support]]></category>
		<category><![CDATA[level1]]></category>
		<category><![CDATA[mime type support]]></category>
		<category><![CDATA[mod_php]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.supportsages.com/blog/?p=895</guid>
		<description><![CDATA[<h3>Preface</h3>
Like in the case of all apache modules, you can either compile PHP as a  static module or compile it as a dynamic module.  In the case of static  module , you  can't perform any modification for the module without  recompiling the binary to which it is attached.  For eg.  you can't add  ssl support for the mod_php without re-compiling apache as a whole. And any failure in the compilation may cause downtime for the entire webserver also, including plain html support.

The advantage is that it provides a faster  performance, because the  module is initialized  ...]]></description>
			<content:encoded><![CDATA[<h3>Preface</h3>
<p>Like in the case of all apache modules, you can either compile PHP as a  static module or compile it as a dynamic module.  In the case of static  module , you  can&#8217;t perform any modification for the module without  recompiling the binary to which it is attached.  For eg.  you can&#8217;t add  ssl support for the mod_php without re-compiling apache as a whole. And any failure in the compilation may cause downtime for the entire webserver also, including plain html support.</p>
<p>The advantage is that it provides a faster  performance, because the  module is initialized  whenever the apache binary is started.</p>
<p>In the case of a dynamic mod_php installation, the necessary modifications or module additions can be  done by recompiling the module alone. There is no need to recompile the  Apache as the mod_php is not linked with the binary of apache.  But  since the webserver loads the module on the fly, it needs to load,  initialize and then execute the module.  So it can create some level of  slowness while processing php pages.</p>
<p><strong>How does mod_php work? </strong></p>
<p>When PHP  is loaded into Apache as a module (using  mod_php), each Apache process will contain an instance of mod_php or  PHP interpreter also.   The interpreter comes with a bundle of  libraries we enabled during compilation and each  process can make use  of these libraries to process the requests. This means that the  Apache process that just started  to load a simple HTML page  too will  contain a PHP interpreter with all assigned libraries which inturn means resource consumption.</p>
<p>When the webserver gets an HTTP request. The  request header   contains the path to the requested document</p>
<blockquote><p>e.g. access.log:    xx.xx.xx.xx &#8211; - [22/June/2010:21:14:53  -0700] &#8220;GET /info.php?=PHPE9568F35-D428-11d2-A769-00AA001ACF42  HTTP/1.1&#8243; 200 2146 &#8220;http://domain.com/info.php&#8221; &#8220;Mozilla/5.0 (X11; U;  Linux i686; en-US; rv:1.9.1.7) Gecko/20100106 Ubuntu/9.10 (karmic)  Firefox/3.5.7&#8243;</p></blockquote>
<p>1. The request will be redirected to the document root of the domain  and then to the file &#8220;info.php&#8221; , if it fails then the corresponding  error message will be given.</p>
<p>2. The info.php file is to be processed. It follows the following  steps</p>
<p>Normally every httpd.conf file will have an entry like this</p>
<blockquote><p>AddType application/x-httpd-php .php5 .php4 .php</p></blockquote>
<p>It instructs the webserver that the files with extension .php  ,.php4,.ph5 are of PHP mime type  . The <strong>TypesConfig</strong> directive sets the location of the MIME     types configuration file.  This file controls what Internet media types are sent to the client for   given file extension(s).  Sending the correct media type to the client   is important so they know how to handle the content of the file.</p>
<blockquote><p>root@new [/usr/local/apache/conf]# cat mime.types | grep  x-httpd-php<br />
application/x-httpd-php-source          phps<br />
application/x-httpd-php          php php3 php4 php5 php6<br />
root@new [/usr/local/apache/conf]#</p></blockquote>
<p>Here we can see that the Mime type to be used for files with  extension .php  is application/x-httpd-php , while the file with .phps  is to be mapped to the php mime type application/x-httpd-php-source .</p>
<p>The webserver identifies that the requested file is of Mime type  x-httpd-php.</p>
<p>To handle or process it , the apache has to load the corresponding  module. Since it is a php type , the module mod_php will be loaded and  it will execute the file.</p>
<p>Since apache is a HTTP server. It gets the HTTP requests and answers  with the HTML code.  So the mod_php will execute the commands within  php flag and creates the HTML page dynamically and send it back to the  client &#8211; internet browser which sent HTTP request.</p>
<p><strong>Security concerns / Implications<br />
</strong></p>
<p>You can see that  every request or execution of a php file through  web is initiated by the webserver. So the webserver acts as the parent  of every php execution through web. It imposes a great security threat.  Since apache is being executed as an apache  user, all process will be  owned by that user. By default  it is &#8220;nobody&#8221; or &#8220;apache&#8221;.  Let me try  to explain.</p>
<p>If your  web application performs some operations in the  db, unless that database (eg: a flat text DB) has built-in access control, you will have to  make the database accessible to the &#8220;nobody&#8221; user. This means a  malicious script could access and modify the database, even without a  username and password.  Such can be the case with various configuration  files too.  Unless you protect these directories or applications with  necessary authorization techniques like .htaccess, session control etc.  There is a high possibility of attack through webapplication.</p>
<p>Another dangerous issue is of root escalation. If the webserver has a bug, by exploiting that bug, a malicious user can gain some root privileges or escalated to root. Its quite  alarming situation as an escalated apache user can do any sort of   actions without any level of authentication.</p>
<p>Also it is difficult to identify the script which performs the  malicious activity as all php scripts will be executed as &#8220;nobody&#8221;</p>
<p>Since PHP applications are executed as web server user, you need to  give access and write permissions for the directories wherever the  application  is supposed to be working. Sometimes you may be forced to  give 777 permissions and it invites lot of attacks.</p>
<p>The files created by php applications will be owned by user &#8220;nobody&#8221; .  So the user will not be able to delete the files unless it is done  through another php application. Otherwise he needs to contact the  server admin to get the same.</p>
<p>As a security measure, we may be forced to block mails from &#8220;nobody&#8221;  users . But it can create mails generated from php applications being  blocked in the server. Various php applications widely used for spamming  . So some servers are configured to block mails from nobody users. This  creates inconvenience to users.</p>
<p align="left"><a  class="tt" href="http://twitter.com/home/?status=mod_php+explained+http%3A%2F%2Fwww.supportsages.com%2Fblog%2F895" title="Post to Twitter"><img class="nothumb" src="http://www.supportsages.com/blog/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a  class="tt" href="http://twitter.com/home/?status=mod_php+explained+http%3A%2F%2Fwww.supportsages.com%2Fblog%2F895" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.supportsages.com/blog/2010/06/mod_php-explained/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How do I reset the root mysql pass, lxadmin created ?</title>
		<link>http://www.supportsages.com/blog/2009/04/how-do-i-reset-the-root-mysql-pass-lxadmin-created/</link>
		<comments>http://www.supportsages.com/blog/2009/04/how-do-i-reset-the-root-mysql-pass-lxadmin-created/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 06:47:51 +0000</pubDate>
		<dc:creator>Fabian</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[VPS]]></category>
		<category><![CDATA[forgot pass]]></category>
		<category><![CDATA[hypervm]]></category>
		<category><![CDATA[lxadmin]]></category>

		<guid isPermaLink="false">http://www.supportsages.com/blog/?p=116</guid>
		<description><![CDATA[Oh, do it from the GUI lxadmin gives you OR else, do it console based way.
<blockquote># cd /usr/local/lxlabs/lxadmin/httpdocs/
# lphp.exe ../bin/common/misc/reset-mysql-root-password.phps</blockquote>]]></description>
			<content:encoded><![CDATA[<p>Oh, do it from the GUI lxadmin gives you OR else, do it console based way.</p>
<blockquote><p># cd /usr/local/lxlabs/lxadmin/httpdocs/<br />
# lphp.exe ../bin/common/misc/reset-mysql-root-password.phps</p></blockquote>
<p align="left"><a  class="tt" href="http://twitter.com/home/?status=How+do+I+reset+the+root+mysql+pass%2C+lxadmin+created+%3F+http%3A%2F%2Fwww.supportsages.com%2Fblog%2F116" title="Post to Twitter"><img class="nothumb" src="http://www.supportsages.com/blog/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a  class="tt" href="http://twitter.com/home/?status=How+do+I+reset+the+root+mysql+pass%2C+lxadmin+created+%3F+http%3A%2F%2Fwww.supportsages.com%2Fblog%2F116" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.supportsages.com/blog/2009/04/how-do-i-reset-the-root-mysql-pass-lxadmin-created/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to upgrade MySQL 5.0 to MySQL 5.1 in a cPanel server</title>
		<link>http://www.supportsages.com/blog/2009/04/how-to-upgrade-mysql-50-to-mysql-51-in-a-cpanel-server/</link>
		<comments>http://www.supportsages.com/blog/2009/04/how-to-upgrade-mysql-50-to-mysql-51-in-a-cpanel-server/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 08:17:27 +0000</pubDate>
		<dc:creator>Fabian</dc:creator>
				<category><![CDATA[Howtos]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[cPanel]]></category>
		<category><![CDATA[mysql version 5.1]]></category>

		<guid isPermaLink="false">http://www.supportsages.com/blog/?p=40</guid>
		<description><![CDATA[A similar request came to us two years back when we had to upgrade MySQL version 4.0 to MySQL 5.0. We are listing here the same approach for the current needs of upgrading MySQL 5.0 to 5.1

File responsible for the MySQL version is <strong>/var/cpanel/cpanel.config</strong>

Open it, find the variable mysql-version and edit the value to read <strong>mysql-version=5.1</strong>

And finally run 

<blockquote>/scripts/mysqlup </blockquote>

This should upgrade your MySQL version to MySQL 5.1. For better understanding of the process behind, /scripts/mysqlup, go through the code and browse the URL http://httpupdate.cpanel.net/mysqlinstall/

SupportSages rocks!! ]]></description>
			<content:encoded><![CDATA[<p>A similar request came to us two years back when we had to upgrade MySQL version 4.0 to MySQL 5.0. We are listing here the same approach for the current needs of upgrading MySQL 5.0 to 5.1</p>
<p>File responsible for the MySQL version is <strong>/var/cpanel/cpanel.config</strong></p>
<p>Open it, find the variable mysql-version and edit the value to read <strong>mysql-version=5.1</strong></p>
<p>And finally run </p>
<blockquote><p>/scripts/mysqlup </p></blockquote>
<p>This should upgrade your MySQL version to MySQL 5.1. For better understanding of the process behind, /scripts/mysqlup, go through the code and browse the URL http://httpupdate.cpanel.net/mysqlinstall/</p>
<p>SupportSages rocks!! </p>
<p align="left"><a  class="tt" href="http://twitter.com/home/?status=How+to+upgrade+MySQL+5.0+to+MySQL+5.1+in+a+cPanel+server+http%3A%2F%2Fwww.supportsages.com%2Fblog%2F40" title="Post to Twitter"><img class="nothumb" src="http://www.supportsages.com/blog/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a  class="tt" href="http://twitter.com/home/?status=How+to+upgrade+MySQL+5.0+to+MySQL+5.1+in+a+cPanel+server+http%3A%2F%2Fwww.supportsages.com%2Fblog%2F40" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.supportsages.com/blog/2009/04/how-to-upgrade-mysql-50-to-mysql-51-in-a-cpanel-server/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
