<?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>Eddie On Everything &#187; upload_max_filesize</title>
	<atom:link href="http://www.eddieoneverything.com/tag/upload_max_filesize/feed" rel="self" type="application/rss+xml" />
	<link>http://www.eddieoneverything.com</link>
	<description>Tips &#38; tricks on things that interest me</description>
	<lastBuildDate>Wed, 11 Jan 2012 08:29:23 +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>Uploading Large Files to a LAMP setup &#8211; upload_max_filesize, post_max_size, and max_allowed_packet</title>
		<link>http://www.eddieoneverything.com/linux/uploading-large-files-to-a-lamp-setup-upload_max_filesize-post_max_size-and-max_allowed_packet.php</link>
		<comments>http://www.eddieoneverything.com/linux/uploading-large-files-to-a-lamp-setup-upload_max_filesize-post_max_size-and-max_allowed_packet.php#comments</comments>
		<pubDate>Fri, 28 Dec 2007 16:57:02 +0000</pubDate>
		<dc:creator>eddie</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[filesize]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[httpd]]></category>
		<category><![CDATA[L.A.M.P.]]></category>
		<category><![CDATA[LAMP]]></category>
		<category><![CDATA[max_allowed_packet]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysqld]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[post_max_size]]></category>
		<category><![CDATA[uploading files]]></category>
		<category><![CDATA[upload_max_filesize]]></category>

		<guid isPermaLink="false">http://www.eddieoneverything.com/linux/uploading-large-files-to-a-lamp-setup-upload_max_filesize-post_max_size-and-max_allowed_packet.php</guid>
		<description><![CDATA[So you&#8217;re trying to upload a large file via PHP and you&#8217;re getting an error, eh?  It&#8217;s probably because of PHP&#8217;s default configuration, which limits uploads to 2 Megs, or because of MySQL&#8217;s default 1.5 Meg limitation.  Here&#8217;s how you change these defaults.
First, find your php.ini file.  If you don&#8217;t know where [...]]]></description>
			<content:encoded><![CDATA[<p><!--adsense--><br />
So you&#8217;re trying to upload a large file via PHP and you&#8217;re getting an error, eh?  It&#8217;s probably because of PHP&#8217;s default configuration, which limits uploads to 2 Megs, or because of MySQL&#8217;s default 1.5 Meg limitation.  Here&#8217;s how you change these defaults.</p>
<p>First, find your php.ini file.  If you don&#8217;t know where it is, create a php file on your server that contains only the following:</p>
<p><code>&lt;? phpinfo(); ?&gt;</code></p>
<p>Load that up in your browser and look for the line that says<br />
<code>Configuration File (php.ini) Path</code></p>
<p>It&#8217;s probably set to something like /usr/local/lib/php.ini.</p>
<p>Once found, open up this file and edit the following lines as you see fit:<br />
<code>file_uploads = On<br />
upload_max_filesize = 30M<br />
post_max_size = 30M</code></p>
<p>In the above example, I&#8217;ve updated my configuration to allow uploads of up to 30 Megs.</p>
<p>Once this is complete, restart apache (using something like &#8220;/etc/init.d/httpd restart&#8221;) and voila, the file upload size limitation should be lifted.</p>
<p>If you&#8217;re trying to insert this large uploaded file into a MySQL database, you may, at this time, run into a second limitation:</p>
<blockquote><p>An error has occured uploading that fileGot a packet bigger than &#8216;max_allowed_packet&#8217; bytes<br />
SQL: INSERT INTO &#8230;</p></blockquote>
<p>That&#8217;s because mysql also has a limit on how large a single SQL query can be.  This, too, can be raised &#8211; I edited my mysql configuration file at /etc/my.cnf and changed the max_allowed_packet size to 30M as well:</p>
<p><code>max_allowed_packet = 30M</code></p>
<p>After doing so, simply restart mysql using something like &#8220;/etc/init.d/mysql restart&#8221; and the problem should disappear.<br />
<!--adsense#468banner--></p>
<h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li><a href="http://www.eddieoneverything.com/articles/linux-forward-file-not-working-make-sure-you-have-the-permissions-set-correctly.php" title="Linux .forward file not working?  Make sure you have the permissions set correctly">Linux .forward file not working?  Make sure you have the permissions set correctly</a></li><li><a href="http://www.eddieoneverything.com/articles/validating-an-email-address-with-phps-filter_var-isnt-perfect.php" title="Validating an Email Address with PHP&rsquo;s filter_var isn&rsquo;t perfect">Validating an Email Address with PHP&rsquo;s filter_var isn&rsquo;t perfect</a></li><li><a href="http://www.eddieoneverything.com/articles/managing-server-load-when-unzipping-many-large-files.php" title="Managing Server Load when unzipping many large files">Managing Server Load when unzipping many large files</a></li><li><a href="http://www.eddieoneverything.com/linux/caution-filename-not-matched-error-when-unzipping-multiple-files-workaround.php" title="Caution: filename not matched error when unzipping multiple files workaround">Caution: filename not matched error when unzipping multiple files workaround</a></li><li><a href="http://www.eddieoneverything.com/articles/how-to-scan-a-computer-for-open-ports.php" title="How to Scan a Computer for Open Ports">How to Scan a Computer for Open Ports</a></li><li><a href="http://www.eddieoneverything.com/articles/the-zen-of-taco-bell-programming-using-unix-tools-to-prevent-reinventing-the-wheel.php" title="The Zen of Taco Bell Programming &#8211; Using Unix Tools to Prevent Reinventing the Wheel">The Zen of Taco Bell Programming &#8211; Using Unix Tools to Prevent Reinventing the Wheel</a></li><li><a href="http://www.eddieoneverything.com/articles/how-to-make-phpbb3-forum-links-automatically-relnofollow.php" title="How to Make phpbb3 Forum Links Automatically rel=&#8221;nofollow&#8221;">How to Make phpbb3 Forum Links Automatically rel=&#8221;nofollow&#8221;</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.eddieoneverything.com/linux/uploading-large-files-to-a-lamp-setup-upload_max_filesize-post_max_size-and-max_allowed_packet.php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

