<?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>Grohs Fabian</title>
	<atom:link href="https://grohsfabian.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://grohsfabian.com/</link>
	<description>Yet another web developer with a blog 🤷‍♂️.</description>
	<lastBuildDate>Tue, 05 Mar 2024 15:54:39 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://grohsfabian.com/wp-content/uploads/2020/03/6iK6Agse_400x400-150x150.jpg</url>
	<title>Grohs Fabian</title>
	<link>https://grohsfabian.com/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Fixing XSS Through SVG File Uploads PHP</title>
		<link>https://grohsfabian.com/xss-through-svg-file-uploads-how-to-fix-with-php/</link>
					<comments>https://grohsfabian.com/xss-through-svg-file-uploads-how-to-fix-with-php/#respond</comments>
		
		<dc:creator><![CDATA[grohsfabian]]></dc:creator>
		<pubDate>Fri, 04 Nov 2022 21:23:59 +0000</pubDate>
				<category><![CDATA[PHP Tutorials]]></category>
		<category><![CDATA[exploit]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[svg]]></category>
		<category><![CDATA[vulnerability]]></category>
		<category><![CDATA[xss]]></category>
		<guid isPermaLink="false">https://grohsfabian.com/?p=423</guid>

					<description><![CDATA[<p>Using Javascript code inside of an SVG file and then uploading it to a website that accepts SVG files &#38; does not sanitize their content. This is how a ton of websites fail and are directly exposed to this XSS vulnerability. You have two choices: How is this exploit working? Any type of JS code ... <a title="Fixing XSS Through SVG File Uploads PHP" class="read-more" href="https://grohsfabian.com/xss-through-svg-file-uploads-how-to-fix-with-php/" aria-label="Read more about Fixing XSS Through SVG File Uploads PHP">Read more</a></p>
<p>The post <a href="https://grohsfabian.com/xss-through-svg-file-uploads-how-to-fix-with-php/">Fixing XSS Through SVG File Uploads PHP</a> appeared first on <a href="https://grohsfabian.com">Grohs Fabian</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Using Javascript code inside of an SVG file and then uploading it to a website that accepts SVG files &amp; does not sanitize their content.</p>



<p>This is how a ton of websites fail and are directly exposed to this XSS vulnerability.</p>



<p>You have two choices:</p>



<ul class="wp-block-list">
<li>Do not allow users to upload SVG files</li>



<li>Allow users to upload SVG files, but use an SVG cleaner on upload</li>
</ul>



<span id="more-423"></span>



<h2 class="wp-block-heading">How is this exploit working?</h2>



<p>Any type of JS code can be added inside an SVG file.</p>



<p>You upload the SVG image file to a website that allows SVG file uploads and does not clean them.</p>



<p>If you manage to get the URL of that uploaded SVG file &amp; that file is saved in the same domain of the main website, the exploit is complete.</p>



<p>You can write malicious JS code to dump cookies (for example) wherever you want to.</p>



<p>You can then simply send the SVG URL to any user of that particular website which you are also a part of, and if that user opens it the JS code will execute.</p>



<h2 class="wp-block-heading">How to fix it?</h2>



<p>The fix to the SVG XSS vulnerability is simple.</p>



<p>Let&#8217;s assume that you still want your users to be able to upload SVG files.</p>



<p>In that case, you would need to use an SVG cleaner before you store the uploaded file.</p>



<p>We&#8217;re going to use an SVG cleaner library: <a href="https://github.com/darylldoyle/svg-sanitizer" target="_blank" rel="noreferrer noopener nofollow">daryll/svg-sanitizer</a></p>



<h2 class="wp-block-heading">Code example</h2>



<p>I&#8217;m going to write an extremely simple example to illustrate how this can be solved with ease.</p>



<p>First off, make sure that you download the SVG-sanitizer code from the above SVG cleaner library.</p>



<p>If you use composer, simply require the library into your code.</p>



<p>Let&#8217;s say you have the following upload processing code</p>



<pre class="EnlighterJSRAW" data-enlighter-language="php" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;?php
/* Load the autoload file from vendor */
require_once './vendor/autoload.php';

/* Check for form submission */
if(!empty($_POST)) {
    $file_extension = explode('.', $_FILES['image']['name']);
    $file_extension = mb_strtolower(end($file_extension));
    $file_temp = $_FILES['image']['tmp_name'];

    /* THIS IS JUST AN EXAMPLE */
    /* Here you typically do your form processing and validations */

    /* Generate a new file name */
    $file_new_name = md5(time(). rand()) . '.' . $file_extension;

    /* Upload the file */
    move_uploaded_file($file_temp, realpath(__DIR__) . '/images/' . $file_new_name);
}
?></pre>



<p>As mentioned in the code, this is just an example. </p>



<p>Normally, you have more validations and error checks before you upload the file.</p>



<h2 class="wp-block-heading">Clean the SVG</h2>



<p>Now, let&#8217;s clean the SVG file with the library that we have imported.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="php" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">if($file_extension == 'svg') {
    $svg_sanitizer = new \enshrined\svgSanitize\Sanitizer();
    $dirty_svg = file_get_contents($file_temp);
    $clean_svg = $svg_sanitizer->sanitize($dirty_svg);
    file_put_contents($file_temp, $clean_svg);
}</pre>



<p>This code will only run if the file extension is &#8216;svg&#8217;.</p>



<p>It will take the temporary file which was uploaded.</p>



<p>Then put it through the SVG Cleaner.</p>



<p>And save it back into the initial temporary file.</p>



<h2 class="wp-block-heading">Final code example</h2>



<p>The full PHP code would look something like this:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="php" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;?php
require_once './vendor/autoload.php';

/* Check for form submission */
if(!empty($_POST)) {
    $file_extension = explode('.', $_FILES['image']['name']);
    $file_extension = mb_strtolower(end($file_extension));
    $file_temp = $_FILES['image']['tmp_name'];

    /* THIS IS JUST AN EXAMPLE */
    /* Here you typically do your form processing and validations */

    if($file_extension == 'svg') {
        $svg_sanitizer = new \enshrined\svgSanitize\Sanitizer();
        $dirty_svg = file_get_contents($file_temp);
        $clean_svg = $svg_sanitizer->sanitize($dirty_svg);
        file_put_contents($file_temp, $clean_svg);
    }


    $file_new_name = md5(time(). rand()) . '.' . $file_extension;

    /* Upload the original */
    move_uploaded_file($file_temp, realpath(__DIR__) . '/images/' . $file_new_name);
}
?></pre>



<h2 class="wp-block-heading">Video tutorial</h2>



<p>I have also recorded a video tutorial on how you can implement this library and fix this XSS SVG exploit in under 5 minutes.</p>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe title="XSS Through SVG File Uploads - How to fix - PHP" width="920" height="518" src="https://www.youtube.com/embed/1YojtYHc-Ng?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div></figure>



<h2 class="wp-block-heading">Conclusion</h2>



<p>Please, make sure that you clean all the SVG file uploads, as otherwise, you are exposing yourself to risk for no reason.</p>



<p>Hope you&#8217;ve found this useful, take care!</p>
<p>The post <a href="https://grohsfabian.com/xss-through-svg-file-uploads-how-to-fix-with-php/">Fixing XSS Through SVG File Uploads PHP</a> appeared first on <a href="https://grohsfabian.com">Grohs Fabian</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://grohsfabian.com/xss-through-svg-file-uploads-how-to-fix-with-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to get an Emoji Domain Name ✌️</title>
		<link>https://grohsfabian.com/how-to-get-an-emoji-domain-name/</link>
					<comments>https://grohsfabian.com/how-to-get-an-emoji-domain-name/#respond</comments>
		
		<dc:creator><![CDATA[grohsfabian]]></dc:creator>
		<pubDate>Thu, 06 May 2021 13:59:39 +0000</pubDate>
				<category><![CDATA[Domain names]]></category>
		<guid isPermaLink="false">https://grohsfabian.com/?p=143</guid>

					<description><![CDATA[<p>Yes, emoji 🔥 domain names are possible and they are a thing. Emoji domain names are a great opportunity for marketing 💰 in my opinion and shouldn&#8217;t be ignored. For instance, ✌️.com is a great emoji domain name example that is accessible and redirects to AngelList.com. Now, let me tell you everything you want to ... <a title="How to get an Emoji Domain Name ✌️" class="read-more" href="https://grohsfabian.com/how-to-get-an-emoji-domain-name/" aria-label="Read more about How to get an Emoji Domain Name ✌️">Read more</a></p>
<p>The post <a href="https://grohsfabian.com/how-to-get-an-emoji-domain-name/">How to get an Emoji Domain Name ✌️</a> appeared first on <a href="https://grohsfabian.com">Grohs Fabian</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Yes, emoji <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f525.png" alt="🔥" class="wp-smiley" style="height: 1em; max-height: 1em;" /> domain names are possible and they are a thing. </p>



<p>Emoji domain names are a great opportunity for marketing <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f4b0.png" alt="💰" class="wp-smiley" style="height: 1em; max-height: 1em;" /> in my opinion and shouldn&#8217;t be ignored.</p>



<p>For instance, <a href="https://xn--7bi.com/" target="_blank" rel="noreferrer noopener"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/270c.png" alt="✌" class="wp-smiley" style="height: 1em; max-height: 1em;" />.com</a> is a great emoji domain name example that is accessible and redirects to AngelList.com.</p>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="1024" height="819" src="https://grohsfabian.com/wp-content/uploads/2021/05/emoji-domain-names-1-1024x819.jpg" alt="" class="wp-image-146" srcset="https://grohsfabian.com/wp-content/uploads/2021/05/emoji-domain-names-1-1024x819.jpg 1024w, https://grohsfabian.com/wp-content/uploads/2021/05/emoji-domain-names-1-300x240.jpg 300w, https://grohsfabian.com/wp-content/uploads/2021/05/emoji-domain-names-1-768x614.jpg 768w, https://grohsfabian.com/wp-content/uploads/2021/05/emoji-domain-names-1-1536x1229.jpg 1536w, https://grohsfabian.com/wp-content/uploads/2021/05/emoji-domain-names-1-2048x1638.jpg 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption class="wp-element-caption"><a href="https://unsplash.com/@iabzd" target="_blank" rel="noreferrer noopener nofollow">Picture by iabzd, from Unsplash</a></figcaption></figure>



<span id="more-143"></span>



<p>Now, let me tell you everything you want to know about emoji domain names without the fluff:</p>



<ul class="wp-block-list">
<li>Yes, you can have one <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/270c.png" alt="✌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> or more <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/270c.png" alt="✌" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/270c.png" alt="✌" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/270c.png" alt="✌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> emoji&#8217;s in a domain name, including normal text.</li>



<li>Not all domain TLDs accept emojis. For example, you can&#8217;t register emojis with .com domains.</li>



<li>The most popular TLDs that accepts emoji domain names are <strong>.ws</strong>, <strong>.to</strong> &amp; <strong>.fm</strong>.</li>



<li>Emojis are automatically translated into Punycode by the browser, so when you access <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/270c.png" alt="✌" class="wp-smiley" style="height: 1em; max-height: 1em;" />.com, your browser will automatically translate that to xn--7bi.com</li>



<li>Yes, all modern browsers and devices already support emoji domain names.</li>
</ul>



<h2 class="wp-block-heading">How to register an Emoji Domain name</h2>



<p>Let&#8217;s get into the actual registering and let me show you the exact steps that you need to take in order to register an Emoji domain name <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/270c.png" alt="✌" class="wp-smiley" style="height: 1em; max-height: 1em;" />.</p>



<h3 class="wp-block-heading">TLDs that accept emojis in domain names</h3>



<p>As I&#8217;ve mentioned above, not all TLDs accept emojis in their domain names. Therefore, you must choose from a pretty short list of TLDs (for now).</p>



<p>Here are the most popular Top Level Domains:</p>



<ul class="wp-block-list">
<li><strong>.ws</strong> &#8211; You can register .ws domains via <a href="https://bluehost.com" target="_blank" rel="noreferrer noopener nofollow">Bluehost</a></li>



<li><strong>.to</strong> &#8211; You can register .to domains directly from their <a href="https://register.to" target="_blank" rel="noreferrer noopener nofollow">official register.to website</a></li>



<li><strong>.fm</strong> &#8211; You can register .fm domains from their<a href="https://get.fm/" target="_blank" rel="noreferrer noopener"> official get.fm website</a></li>
</ul>



<p>There are also other Top Level Domains that are supposedly accepting Emoji Domains, such as:</p>



<ul class="wp-block-list">
<li>.tk</li>



<li>.ga</li>



<li>.cf</li>



<li>.ml</li>



<li>.gq</li>
</ul>



<p>These are supposedly free ones that you can get. Unfortunately, from my own research I&#8217;ve found that whatever emoji domain you will search with these TLDs, you won&#8217;t find any available (probably bugged). Therefore, I wouldn&#8217;t recommend going with these ones.</p>



<h3 class="wp-block-heading">Pick your emoji domain name</h3>



<p>There are two things you must do repeatedly until you find an emoji domain that is right for you:</p>



<ul class="wp-block-list">
<li>Pick an emoji that you like.</li>



<li>Pick a TLD for your new domain.</li>



<li>Check the availability of the emoji domain.</li>
</ul>



<h3 class="wp-block-heading">Check the domain availability <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f440.png" alt="👀" class="wp-smiley" style="height: 1em; max-height: 1em;" /></h3>



<p>The availability checking is not that simple as your typical ASCII normal text domains for the majority of domain name registrars in case of emoji domains.</p>



<p>Let&#8217;s assume that you want to register <strong><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/270c.png" alt="✌" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f525.png" alt="🔥" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f4b0.png" alt="💰" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/26a1.png" alt="⚡" class="wp-smiley" style="height: 1em; max-height: 1em;" />.ws</strong>.</p>



<p>Here&#8217;s how you can properly check the availability of an emoji domain:</p>



<p><strong>1 &#8211; Convert your emoji domain to Punycode. </strong></p>



<p>Go to <a href="https://www.punycoder.com/" target="_blank" rel="noreferrer noopener nofollow">punycoder.com</a> and paste in your emoji domain, just like this:</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="482" src="https://grohsfabian.com/wp-content/uploads/2021/05/punycoder-1024x482.png" alt="" class="wp-image-150" srcset="https://grohsfabian.com/wp-content/uploads/2021/05/punycoder-1024x482.png 1024w, https://grohsfabian.com/wp-content/uploads/2021/05/punycoder-300x141.png 300w, https://grohsfabian.com/wp-content/uploads/2021/05/punycoder-768x362.png 768w, https://grohsfabian.com/wp-content/uploads/2021/05/punycoder.png 1440w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Now you can see that weird looking text that you just got, in this case is the following: xn--57h5np933jmna.ws.</p>



<p><strong>What is up with this weird-looking &#8220;Punycode&#8221;?</strong> Emojis are automatically translated by the browser in this format because they are not your typical ASCII standard characters.</p>



<p><strong>2 &#8211; Go to any domain registrar that supports the registration of .ws domains, such as <a href="https://l.grohsfabian.com/bluehost" target="_blank" rel="noreferrer noopener nofollow">Bluehost</a>.</strong></p>



<p>Now you can paste in the Punycode domain name that you want to register under your name.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="177" src="https://grohsfabian.com/wp-content/uploads/2021/05/bluehost-punycode-emoji-domain-1024x177.png" alt="" class="wp-image-151" srcset="https://grohsfabian.com/wp-content/uploads/2021/05/bluehost-punycode-emoji-domain-1024x177.png 1024w, https://grohsfabian.com/wp-content/uploads/2021/05/bluehost-punycode-emoji-domain-300x52.png 300w, https://grohsfabian.com/wp-content/uploads/2021/05/bluehost-punycode-emoji-domain-768x133.png 768w, https://grohsfabian.com/wp-content/uploads/2021/05/bluehost-punycode-emoji-domain-1536x266.png 1536w, https://grohsfabian.com/wp-content/uploads/2021/05/bluehost-punycode-emoji-domain-2048x354.png 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p><strong>3 &#8211; Register the domain and configure it with a web host</strong>, just as you would do with any other domain. After the completion, you will be able to access your domain just by writing those emojis in the browser.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="382" height="68" src="https://grohsfabian.com/wp-content/uploads/2021/05/emoji-domain-name.png" alt="" class="wp-image-152" srcset="https://grohsfabian.com/wp-content/uploads/2021/05/emoji-domain-name.png 382w, https://grohsfabian.com/wp-content/uploads/2021/05/emoji-domain-name-300x53.png 300w" sizes="(max-width: 382px) 100vw, 382px" /></figure>



<p>That&#8217;s it! You now have your own emoji accessible domain name <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f525.png" alt="🔥" class="wp-smiley" style="height: 1em; max-height: 1em;" />.</p>



<h2 class="wp-block-heading">Why would you want an emoji domain name?</h2>



<p>Emoji domain names can help you with your marketing if done right and staying right on trend.</p>



<p>Some pretty big websites already have got themselves such domain names:</p>



<ul class="wp-block-list">
<li>Mailchimp &#8211; <a href="http://xn--rr8h.ws/" target="_blank" rel="noreferrer noopener"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f48c.png" alt="💌" class="wp-smiley" style="height: 1em; max-height: 1em;" />.ws</a></li>



<li>AngelList &#8211; <a href="http://xn--7bi.com/" target="_blank" rel="noreferrer noopener"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/270c.png" alt="✌" class="wp-smiley" style="height: 1em; max-height: 1em;" />.com</a></li>



<li>SonyPictures &#8211; <a href="http://xn--dl8h11b.ws/" target="_blank" rel="noreferrer noopener"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f60a.png" alt="😊" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f3ac.png" alt="🎬" class="wp-smiley" style="height: 1em; max-height: 1em;" />.ws</a></li>



<li>BikeMagazine &#8211; <a href="http://xn--k78h.ws/" target="_blank" rel="noreferrer noopener"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f6b5.png" alt="🚵" class="wp-smiley" style="height: 1em; max-height: 1em;" />.ws</a> </li>



<li>BudWeiser &#8211; <a href="http://xn--qei8618m.ws/" target="_blank" rel="noreferrer noopener"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2764.png" alt="❤" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f37a.png" alt="🍺" class="wp-smiley" style="height: 1em; max-height: 1em;" />.ws</a></li>
</ul>



<p>Coca-cola ran a <a href="https://venturebeat.com/2015/02/19/coke-literally-brings-smiles-to-web-addresses-with-emoji-domain-names/" target="_blank" rel="noreferrer noopener nofollow">big and successful campaign</a> with the <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f600.png" alt="😀" class="wp-smiley" style="height: 1em; max-height: 1em;" />.ws emoji domain back in 2015.</p>



<p>But still, why would you want to have emojis in your domain?</p>



<ul class="wp-block-list">
<li>They are easily remembered if done right (single or 2-3 emojis on a domain).</li>



<li>They grow your brand power are an innovative and inexpensive marketing tool.</li>



<li>Emoji domains are cool, and yes, I did purchase one for myself and my brand <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f440.png" alt="👀" class="wp-smiley" style="height: 1em; max-height: 1em;" />.</li>



<li>You can still get single emoji domains, which are the best, in my opinion.</li>
</ul>



<p>Some single emoji domains for the .ws TLD are selling for hundreds, if not thousands of dollars in some cases, depending on the popularity of the emoji.</p>



<h2 class="wp-block-heading">Yes, you should get one.</h2>



<p>This is my conclusion and suggestion for you. If you have a brand that you want to grow, get a nice, representative emoji domain.</p>



<p>No, I would not suggest you to use an emoji domain as your main website. Simply purchase an emoji domain and redirect to your main domain <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f917.png" alt="🤗" class="wp-smiley" style="height: 1em; max-height: 1em;" />.</p>



<p>Let me know in the comments if you got yourself an emoji domain, really curious <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f44b.png" alt="👋" class="wp-smiley" style="height: 1em; max-height: 1em;" />.</p>
<p>The post <a href="https://grohsfabian.com/how-to-get-an-emoji-domain-name/">How to get an Emoji Domain Name ✌️</a> appeared first on <a href="https://grohsfabian.com">Grohs Fabian</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://grohsfabian.com/how-to-get-an-emoji-domain-name/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to use PHP Caching with MySQL Queries to improve performance</title>
		<link>https://grohsfabian.com/how-to-use-php-caching-with-mysql-queries-to-improve-performance/</link>
					<comments>https://grohsfabian.com/how-to-use-php-caching-with-mysql-queries-to-improve-performance/#comments</comments>
		
		<dc:creator><![CDATA[grohsfabian]]></dc:creator>
		<pubDate>Mon, 25 Jan 2021 23:21:42 +0000</pubDate>
				<category><![CDATA[PHP Tutorials]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php caching]]></category>
		<guid isPermaLink="false">https://grohsfabian.com/?p=120</guid>

					<description><![CDATA[<p>I&#8217;m going to show you an easy and efficient way of using PHP Caching to help reduce the database calls and improve the performance of your PHP script. Instead of writing our own caching script and wasting time, we&#8217;re going to use the phpFastCache library to help us with our caching needs. The caching method ... <a title="How to use PHP Caching with MySQL Queries to improve performance" class="read-more" href="https://grohsfabian.com/how-to-use-php-caching-with-mysql-queries-to-improve-performance/" aria-label="Read more about How to use PHP Caching with MySQL Queries to improve performance">Read more</a></p>
<p>The post <a href="https://grohsfabian.com/how-to-use-php-caching-with-mysql-queries-to-improve-performance/">How to use PHP Caching with MySQL Queries to improve performance</a> appeared first on <a href="https://grohsfabian.com">Grohs Fabian</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>I&#8217;m going to show you an easy and efficient way of using PHP Caching to help reduce the database calls and improve the performance of your PHP script.</p>



<p>Instead of writing our own caching script and wasting time, we&#8217;re going to use the <a href="https://www.phpfastcache.com/" target="_blank" rel="noreferrer noopener nofollow">phpFastCache</a> library to help us with our caching needs.</p>



<p>The caching method I&#8217;m going to present is <strong>file-based</strong> and is aimed towards <strong>MySQL query results caching</strong>.</p>



<span id="more-120"></span>



<h2 class="wp-block-heading" id="why-use-caching">Why use caching?</h2>



<p>In most cases, MySQL queries are slower than reading files from the storage drive. Now, the vast majority of web hosts offer now SSD storage (like <a href="http://l.grohsfabian.com/namecheap" target="_blank" rel="noreferrer noopener nofollow">Namecheap</a>), which makes it extremely fast.</p>



<ul class="wp-block-list">
<li>Easy to understand &amp; implement</li>



<li>Helps reduce unnecessary database calls</li>



<li>Improves performance</li>
</ul>



<h2 class="wp-block-heading" id="when-to-use-caching">When to use caching?</h2>



<p>In this case, we&#8217;re strictly talking about caching the results of MySQL queries, so I would suggest to look for caching when:</p>



<ul class="wp-block-list">
<li>You&#8217;ve already done the performance improvements directly from the database (table optimizations, proper indexing&#8230;etc) and you want even better performance.</li>



<li>You have dynamic content that doesn&#8217;t change that often.</li>



<li>You use an external MySQL database and queries are taking even longer.</li>



<li>Your server resources are taking too much of a hit.</li>



<li>You simply want to learn and use PHP Caching <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/26a1.png" alt="⚡" class="wp-smiley" style="height: 1em; max-height: 1em;" />.</li>
</ul>



<p>Of course, there are many other reasons on why you should use caching and when to use it, and I&#8217;m not going to go technical on all of them.</p>



<h2 class="wp-block-heading" id="take-a-real-world-example">Take a real world example</h2>



<p>Let&#8217;s take a real world scenario, broken down to a more basic level.</p>



<p>You&#8217;ve got a website, that website holds user profile pages for people and can be accessed like <strong>site.com/profile-name</strong>, just like Facebook, Twitter, Instagram..etc.</p>



<p>Your MySQL database is going to have a table that contains a few columns, like:</p>



<ul class="wp-block-list">
<li>profile_id</li>



<li>username</li>



<li>title</li>



<li>description</li>
</ul>



<p>When someone enters, lets say: <strong>site.com/fabian</strong>, you have a query that asks the database if the <strong>fabian</strong> username is existing and what data to get from it, such as:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="php" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;?php

$username = 'Fabian';

$profile = $database->query("SELECT * FROM `profiles` WHERE `username` = '{$username}'")->fetch_object();</pre>



<p>Now, this profile page <strong>can change</strong> when the user is actually changing his username, title, or description, but it is not often that this happens.</p>



<p>If this profile alone gets 10-100 visitors per day, and this is on an extremely small level, the PHP Script above is going to make the same SQL queries to the database 10-100 times.</p>



<p>Until now, there is nothing wrong and nothing to use caching for.</p>



<p>Now, imagine that this <strong>fabian </strong>profile is not the only one, <strong>there are 100,000 or even millions more profiles</strong>. </p>



<p>The above MySQL query is now getting &#8220;expensive&#8221; to run each time a visitor comes to  your profile.</p>



<p>Why? Because MySQL is going to have to search through thousands or millions of other profiles to find the requested profile in order to display it.</p>



<p>Again, I would first suggest you learn about how to properly optimize your queries and tables for better performance.</p>



<h2 class="wp-block-heading" id="improvements-you-re-going-to-see">Improvements you&#8217;re going to see</h2>



<p>If we introduce caching to the logic above, we&#8217;re going to get the following workflow:</p>



<ol class="wp-block-list">
<li>Visitor accesses site.com/fabian</li>



<li>Cache for the fabian profile does not yet exist</li>



<li>MySQL query is executed to search for the fabian profile</li>



<li>The cache for the fabian profile is set</li>



<li>New visitor accesses the profile</li>



<li>Cache now exists</li>



<li>The details of the profile are returned from the cache</li>
</ol>



<p>Reading the data from the file cache is most of the times, in these cases, much faster.</p>



<p><strong>Let&#8217;s take a real-world example</strong> on a $5/month <a href="https://l.grohsfabian.com/digitalocean" target="_blank" rel="noreferrer noopener nofollow">DigitalOcean</a> droplet.</p>



<p>With the same concept I&#8217;ve described above, we&#8217;re going to have:</p>



<ul class="wp-block-list">
<li>2+ million profiles</li>



<li>a basic, cheap host with SSD storage</li>



<li>Ubuntu 20, PHP 7.4, MySQL 8.0</li>
</ul>



<p>The <strong>MySQL query will take about 6-7 seconds</strong> to perform this query. Of course, with proper optimization and indexing, this will be much faster.</p>



<p><strong>Reading the cache</strong> after it is indexed is going to take about <strong>0.0006 seconds</strong>, on average.</p>



<p>Even if your query is highly optimized and is fast, caching will make it so that there is not so much strain on the MySQL server, since reading from a file is most of the times going to be the easiest and fastest way to access the needed data.</p>



<h2 class="wp-block-heading" id="implementing-caching-for-sql-queries">Implementing caching for SQL Queries</h2>



<p>Let&#8217;s get down to the actual code so that you can get started right away.</p>



<p>As mentioned at the beginning of the article, we are going to use <a href="https://github.com/PHPSocialNetwork/phpfastcache/" target="_blank" rel="noreferrer noopener nofollow">phpFastCache</a> as it is a highly respected, used, and secure caching library.</p>



<p>Make sure that you first install phpFastCache and it is ready to go. You can find all the instructions on the GitHub repo, so I won&#8217;t go over them, the easiest would be with Composer.</p>



<p>However you install phpFastCache, make sure to also require it on every page that you&#8217;re going to use, either directly or via composer:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="php" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;?php

/* Make sure to properly add your own vendor autoload path */
require_once './vendor/autoload.php';</pre>



<h3 class="wp-block-heading" id="initiating-phpfastcache">Initiating phpFastCache</h3>



<p>Before starting to use the caching library, you&#8217;re going to need some extra lines of code. These lines will set the default configuration for phpFastCache and initiate it so that you&#8217;ll be able to use it.</p>



<p>This initiation should only be done once, on every page that is going to use caching.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="php" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;?php

/* Cache adapter for phpFastCache */
$cache_config = new \Phpfastcache\Drivers\Files\Config([
    'path' => realpath(__DIR__) . '/cache', // The folder where the caching will be created
    'securityKey' => 'my-random-security-key', // Can be the name of your project, will be used to create the folder inside the caching path
    'preventCacheSlams' => true,
    'cacheSlamsTimeout' => 20,
    'secureFileManipulation' => true
]);

\Phpfastcache\CacheManager::setDefaultConfig($cache_config);

$cache = \Phpfastcache\CacheManager::getInstance('Files');</pre>



<p>Make sure that the &#8216;path&#8217; that you define for caching is having CHMOD 777, so that files and folders can be created inside of it and manipulated via the PHP code.</p>



<p>There is an easier method to use phpFastCache, as written on the phpFastCache page they have on GitHub. I wouldn&#8217;t recommend that as it doesn&#8217;t have cache slams prevention and it has limited functionality.</p>



<h3 class="wp-block-heading" id="using-phpfastcache-to-cache-a-mysql-query-result">Using phpFastCache to cache a MySQL query result</h3>



<p>As I&#8217;ve explained above, the idea is to cache the query data that you get from the result and to retrieve it on the next requests.</p>



<p>This can be done extremely easily, just by setting up one if condition, as seen below.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="php" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;?php

$profile_username = isset($_GET['username']) ? $database->escape_string(filter_var($_GET['username'], FILTER_SANITIZE_STRING)) : null;

* Try to get the cached item based on the requested profile username */
$cache_instance = $cache->getItem('profile?username=' . $profile_username);

/* Check if cache exists */
if(is_null($cache_instance->get())) {

    /* Get data from the database of the requested profile */
    $profile = $database->query("SELECT * FROM `profiles` WHERE `username` = '{$profile_username}'")->fetch_object();

    /* Save the data from the database to the cache */
    $cache->save(
        $cache_instance->set($profile)->expiresAfter(300)
    );

} else {

    /* Return cached data */
    $profile = $cache_instance->get();

}</pre>



<p>Keep in mind, this is just a sample PHP caching snippet on a very basic level.</p>



<p><strong>Here is what is happening:</strong></p>



<p><strong>$profile_username</strong> is the variable responsible for the requested username of the particular profile you want to get from the database.</p>



<p>The <strong>$cache-&gt;getItem()</strong> function requires one parameter, the key of the cache that you want to return. In this case, the key is dynamic based on the actual <strong>$profile_username</strong> variable.</p>



<p>We&#8217;re then checking to see if this particular doesn&#8217;t exist or exists but it is expired. This is the part where we need to make the actual call to the database to get the data that we want.</p>



<p>I am storing all the database details in the <strong>$profile </strong>variable and then simply saving that data into the cache and setting an expiration of 5 minutes (300 seconds) with $cache_instance-&gt;set()-&gt;expiresAfter();</p>



<p>Then, we use $cache-&gt;save() to save configured cache with the particular key that we&#8217;ve asked for in the first place, which is <strong>&#8216;profile?username=&#8217; . $profile_username</strong>.</p>



<p>In this example, I am assuming that you already have your database connection set up and is accessed via the $database variable and that you already load the phpFastCache library, as mentioned in their documentation.</p>



<p><strong>That&#8217;s it.</strong> You&#8217;ve just cached your first SQL Query result with just a few lines of code.</p>



<h3 class="wp-block-heading" id="how-to-test-it">How to test it?</h3>



<p>First of all, I would suggest developing this feature for your PHP script with all the errors enabled, so that you see if you&#8217;ve made any mistakes.</p>



<p>Secondly, you can test out the performance of what you&#8217;ve done with the simple code below:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="php" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;?php
$profile_username = isset($_GET['username']) ? $database->escape_string(filter_var($_GET['username'], FILTER_SANITIZE_STRING)) : null;

/* Set the timer before the script executes */
$time_start = microtime(true);
$method = '';

/* Try to get the cached item based on the requested profile username */
$cache_instance = $cache->getItem('profile?username=' . $profile_username);

/* Check if cache exists */
if(is_null($cache_instance->get())) {

    $method = 'Database';
    
    /* Get data from the database of the requested profile */
    $profile = $database->query("SELECT * FROM `profiles` WHERE `username` = '{$profile_username}'")->fetch_object();

    /* Save the data from the database to the cache */
    $cache->save(
        $cache_instance->set($profile)->expiresAfter(300)
    );

} else {

    $method = 'Cache';

    /* Return cached data */
    $profile = $cache_instance->get();

}

/* Set the time after the script executes */
$time_end = microtime(true);

echo 'Execution time: ' . number_format($time_end - $time_start, 10) . ' seconds via the ' . $method . ' method.';
</pre>



<p>This code is going to output the execution time, including the method used for getting the data (database or cache), so that you can test out the results properly and see the difference.</p>



<h3 class="wp-block-heading" id="things-to-be-careful-about">Things to be careful about</h3>



<p>When you start to cache your queries, you need to make sure that you understand the fact that you also should delete the already existing cache if the data from the database is changing.</p>



<p>Here&#8217;s what I mean by that:</p>



<p>If you set the caching to 5 minutes (300 seconds) and the owner of the profile page goes in the profile settings and changes his title, for example, then you will encounter a problem.</p>



<p>It will then take 5 minutes for the changes to show up, as the requested profile is already cached and showing up the cached results.</p>



<p>This might be a problem in some cases and in some other cases, it doesn&#8217;t make that much of a difference.</p>



<p>In this particular case that I have exemplified above, the change should definitely be seen instantly, even if we&#8217;re using caching.</p>



<p>On the profile settings page, after you successfully save the new details to the database, you&#8217;re simply going to have to run the following snippet of code. This will delete the already existing (if any) cache for the particular profile that was updated:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="php" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;?php

$cache->deleteItem('profile?username=' . $profile_username);</pre>



<p>Make sure that you also initiate the caching system in the pages where you want to delete the cache.</p>



<h2 class="wp-block-heading" id="conclusion">Conclusion</h2>



<p>I would highly recommend you to use caching in this kind of situation, as it will make your PHP scripts much faster and more scalable.</p>



<p>If you have any questions, simply leave a comment, I would be happy to answer and try to help <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f917.png" alt="🤗" class="wp-smiley" style="height: 1em; max-height: 1em;" />.</p>



<p>Hope you&#8217;ve enjoyed this!</p>
<p>The post <a href="https://grohsfabian.com/how-to-use-php-caching-with-mysql-queries-to-improve-performance/">How to use PHP Caching with MySQL Queries to improve performance</a> appeared first on <a href="https://grohsfabian.com">Grohs Fabian</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://grohsfabian.com/how-to-use-php-caching-with-mysql-queries-to-improve-performance/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>How much I earn on YouTube with under 2,000 subscribers</title>
		<link>https://grohsfabian.com/how-much-i-earn-on-youtube-with-under-2000-subscribers/</link>
					<comments>https://grohsfabian.com/how-much-i-earn-on-youtube-with-under-2000-subscribers/#respond</comments>
		
		<dc:creator><![CDATA[grohsfabian]]></dc:creator>
		<pubDate>Tue, 17 Nov 2020 16:57:41 +0000</pubDate>
				<category><![CDATA[YouTube]]></category>
		<category><![CDATA[youtube earnings]]></category>
		<guid isPermaLink="false">https://grohsfabian.com/?p=94</guid>

					<description><![CDATA[<p>Earnings on YouTube, everyone knows that it is different for each particular niche and it is based on how many views you get. A few years back, I was extremely curious as to how much a youtuber can earn at different levels of the &#8220;journey&#8221;, more specifically, at the beginning. Here is exactly how much ... <a title="How much I earn on YouTube with under 2,000 subscribers" class="read-more" href="https://grohsfabian.com/how-much-i-earn-on-youtube-with-under-2000-subscribers/" aria-label="Read more about How much I earn on YouTube with under 2,000 subscribers">Read more</a></p>
<p>The post <a href="https://grohsfabian.com/how-much-i-earn-on-youtube-with-under-2000-subscribers/">How much I earn on YouTube with under 2,000 subscribers</a> appeared first on <a href="https://grohsfabian.com">Grohs Fabian</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Earnings on YouTube, everyone knows that it is different for each particular niche and it is based on how many views you get.</p>



<p>A few years back, I was extremely curious as to how much a youtuber can earn at different levels of the &#8220;journey&#8221;, more specifically, at the beginning.</p>



<p>Here is <strong>exactly how much I earned</strong> on youtube from the moment I got accepted into the adsense program until now<img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f4b0.png" alt="💰" class="wp-smiley" style="height: 1em; max-height: 1em;" />.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="696" src="https://grohsfabian.com/wp-content/uploads/2020/11/youtube-late-2020-dashboard-analytics-1024x696.png" alt="" class="wp-image-95" srcset="https://grohsfabian.com/wp-content/uploads/2020/11/youtube-late-2020-dashboard-analytics-1024x696.png 1024w, https://grohsfabian.com/wp-content/uploads/2020/11/youtube-late-2020-dashboard-analytics-300x204.png 300w, https://grohsfabian.com/wp-content/uploads/2020/11/youtube-late-2020-dashboard-analytics-768x522.png 768w, https://grohsfabian.com/wp-content/uploads/2020/11/youtube-late-2020-dashboard-analytics-1536x1044.png 1536w, https://grohsfabian.com/wp-content/uploads/2020/11/youtube-late-2020-dashboard-analytics-2048x1392.png 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<span id="more-94"></span>



<h2 class="wp-block-heading">1,680 Subscribers<strong> &amp; 126K</strong> views</h2>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe title="How does YouTube pay channels with under 2K subscribers" width="920" height="518" src="https://www.youtube.com/embed/Y8t70bQipsQ?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div></figure>



<p><strong>I started my channel</strong> a while back, when I first released my <a href="https://youtu.be/4q9CNtwdawA">Web Scraping with Puppeteer</a> video back in <strong>November 2018</strong>, which is still valuable and still brings good views even now. </p>



<p>I created those initial videos that you find on my channel for the sole purpose of delivering good quality content and to help people with <a href="https://learnscraping.com">Scraping with NodeJs</a>, as I also released my first ever Udemy course around the same time to bring some extra traffic and potential sales to it.</p>



<h2 class="wp-block-heading">Beginning to now</h2>



<p>Here are the exact statistics of my &#8220;beginner&#8221; youtube account, I have under 2,000 subscribers and just got monetized a few months ago <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f389.png" alt="🎉" class="wp-smiley" style="height: 1em; max-height: 1em;" />.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="619" src="https://grohsfabian.com/wp-content/uploads/2020/11/youtube-2-years-earnings-stats-beginner-youtuber-1024x619.png" alt="" class="wp-image-97" srcset="https://grohsfabian.com/wp-content/uploads/2020/11/youtube-2-years-earnings-stats-beginner-youtuber-1024x619.png 1024w, https://grohsfabian.com/wp-content/uploads/2020/11/youtube-2-years-earnings-stats-beginner-youtuber-300x181.png 300w, https://grohsfabian.com/wp-content/uploads/2020/11/youtube-2-years-earnings-stats-beginner-youtuber-768x464.png 768w, https://grohsfabian.com/wp-content/uploads/2020/11/youtube-2-years-earnings-stats-beginner-youtuber-1536x929.png 1536w, https://grohsfabian.com/wp-content/uploads/2020/11/youtube-2-years-earnings-stats-beginner-youtuber-2048x1238.png 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Here are some quick stats that you can also see in the dashboard</p>



<ul class="wp-block-list">
<li>My first 4 videos barely got any traction on youtube.</li>
</ul>



<ul class="wp-block-list">
<li>The 5th and 6th videos got viral and were featured on Reddit and newsletters.</li>
</ul>



<ul class="wp-block-list">
<li>I took long breaks, I never was serious about being a YouTuber (though I always liked the idea).</li>
</ul>



<ul class="wp-block-list">
<li>I got monetized on the 1st of September, 2020.</li>
</ul>



<h2 class="wp-block-heading">I made $53 in 2 months and a half</h2>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="483" src="https://grohsfabian.com/wp-content/uploads/2020/11/youtube-under-2000-subscribers-earnings-1024x483.png" alt="" class="wp-image-98" srcset="https://grohsfabian.com/wp-content/uploads/2020/11/youtube-under-2000-subscribers-earnings-1024x483.png 1024w, https://grohsfabian.com/wp-content/uploads/2020/11/youtube-under-2000-subscribers-earnings-300x142.png 300w, https://grohsfabian.com/wp-content/uploads/2020/11/youtube-under-2000-subscribers-earnings-768x362.png 768w, https://grohsfabian.com/wp-content/uploads/2020/11/youtube-under-2000-subscribers-earnings-1536x725.png 1536w, https://grohsfabian.com/wp-content/uploads/2020/11/youtube-under-2000-subscribers-earnings.png 1814w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Without any extra work from my side, simply by enabling the Ads on my account, I had made $53.</p>



<p>Now, what do I make of this?</p>



<p>I am honestly impressed by how much you can earn with just a few normal videos in this niche. I can definitely see how this can be transformed into an actual money making business that allows you to live comfortably.</p>



<p>I have learned that if you put enough work and dedication into your craft, the results will come. This can be also applied to creating videos and being a youtuber.</p>



<h2 class="wp-block-heading">Top earning videos</h2>



<p>I think this is an important topic to talk about as if you are paying attention, it shows you a lot about people and how it all works.</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://grohsfabian.com/wp-content/uploads/2020/11/youtube-under-2000-subscribers-top-earning-videos-1024x604.png" alt="" class="wp-image-99" width="840" height="495" srcset="https://grohsfabian.com/wp-content/uploads/2020/11/youtube-under-2000-subscribers-top-earning-videos-1024x604.png 1024w, https://grohsfabian.com/wp-content/uploads/2020/11/youtube-under-2000-subscribers-top-earning-videos-300x177.png 300w, https://grohsfabian.com/wp-content/uploads/2020/11/youtube-under-2000-subscribers-top-earning-videos-768x453.png 768w, https://grohsfabian.com/wp-content/uploads/2020/11/youtube-under-2000-subscribers-top-earning-videos.png 1248w" sizes="(max-width: 840px) 100vw, 840px" /></figure>



<ul class="wp-block-list">
<li><strong>Web Scraping with Puppeteer in 10 minutes</strong> (42,000+ views) &#8211; has a very catchy title and it actually delivers good and quality content in a short amount of time.</li>
</ul>



<ul class="wp-block-list">
<li><strong><a href="https://youtu.be/kOaP5qI0N1M">How much I earned with my first course on Udemy</a></strong> (3,500+ views) &#8211; this is a known one, people are interested in money and how much you can make by being a YouTuber or any other niche. </li>
</ul>



<ul class="wp-block-list">
<li><strong>Building an Instagram Like Bot</strong> (32,000+ views) &#8211; this video would&#8217;ve made much more if it would&#8217;ve been monetized back when it was released as it was a trendy subject back in 2018.</li>
</ul>



<h2 class="wp-block-heading">Conclusion</h2>



<p>I hope these statistics have satisfied your curiosity on how much you can earn on youtube while having under 2,000 subscribers.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="672" src="https://grohsfabian.com/wp-content/uploads/2020/11/beginner-youtuber-money-earnings-1024x672.png" alt="" class="wp-image-101" srcset="https://grohsfabian.com/wp-content/uploads/2020/11/beginner-youtuber-money-earnings-1024x672.png 1024w, https://grohsfabian.com/wp-content/uploads/2020/11/beginner-youtuber-money-earnings-300x197.png 300w, https://grohsfabian.com/wp-content/uploads/2020/11/beginner-youtuber-money-earnings-768x504.png 768w, https://grohsfabian.com/wp-content/uploads/2020/11/beginner-youtuber-money-earnings.png 1258w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<ul class="wp-block-list">
<li>September &#8211; $25.60</li>



<li>October &#8211; $18.98</li>



<li>November &#8211; $8.5 (as of writing this article, in 17th of November)</li>
</ul>



<p>If you have any other youtube earnings-related questions, make sure to ask in the comments section or by <a href="https://twitter.com/grohsfabian">tweeting @ me</a>, I&#8217;m glad to answer <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f64c.png" alt="🙌" class="wp-smiley" style="height: 1em; max-height: 1em;" />.</p>
<p>The post <a href="https://grohsfabian.com/how-much-i-earn-on-youtube-with-under-2000-subscribers/">How much I earn on YouTube with under 2,000 subscribers</a> appeared first on <a href="https://grohsfabian.com">Grohs Fabian</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://grohsfabian.com/how-much-i-earn-on-youtube-with-under-2000-subscribers/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
