<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Blog at Baddington]]></title><description><![CDATA[Blog at Baddington]]></description><link>https://blog.baddington.com</link><generator>RSS for Node</generator><lastBuildDate>Fri, 05 Jun 2026 22:20:49 GMT</lastBuildDate><atom:link href="https://blog.baddington.com/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Working With Octane - Some Common Pit Falls]]></title><description><![CDATA[I am developing a new REST API for a client that wants to start separating his application into smaller bits. His current application has multiple bottle necks that are beginning to affect his customers. One of these bottlenecks is traffic load. Curr...]]></description><link>https://blog.baddington.com/working-with-octane-some-common-pit-falls</link><guid isPermaLink="true">https://blog.baddington.com/working-with-octane-some-common-pit-falls</guid><category><![CDATA[Laravel]]></category><category><![CDATA[PHP]]></category><dc:creator><![CDATA[Andrew Earls]]></dc:creator><pubDate>Fri, 07 Jan 2022 02:27:18 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/0b5g9_pnMqc/upload/v1641522382484/jG-5mWPuM1.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I am developing a new REST API for a client that wants to start separating his application into smaller bits. His current application has multiple bottle necks that are beginning to affect his customers. One of these bottlenecks is traffic load. Currently an excess of 5000 users may connect sanctimoniously and the servers are beginning to time out and drop the customers. Multiple solutions to this issue were suggested and the solution chosen, was using Octane with Swoole on AWS. </p>
<p>Now Octane was officially released with Laravel on May 12th 2021. So at this point it is less than a year old. Currently there are about 300 projects that use Octane including ours. Sometimes my client will ask a question and I won't know the answer. But that is okay, because the documentation for Octane is beautiful. My client doesn't like when I don't have an answer, so I will have to reevaluate how I handle those situations. But I digress. These are the unknowns that I have faced that can be easily communicated.</p>
<p>Octane loads the application into memory once through the CLI. This means that php commands like phpinfo() are run in the CLI. Certain php commands like phpinfo() when run in the CLI act differently than if called from the server. Specifically phpinfo() called from the CLI will return data that has been stripped of markup. This will look like a jumbled mess unless you parse the data. Something simple like this should work, but perhaps there is a better solution that has yet to be found.</p>
<pre><code>    phpinfo();
    <span class="hljs-keyword">return</span> response(<span class="hljs-string">''</span>)<span class="hljs-operator">-</span><span class="hljs-operator">&gt;</span>withHeaders([<span class="hljs-string">'content-type'</span> <span class="hljs-operator">=</span><span class="hljs-operator">&gt;</span> <span class="hljs-string">'text/plain'</span>]);
</code></pre><p>Next, some of the php run time variables will be affected. <code>max_input_time</code> will default to <code>max_execution_time</code> and <code>max_execution_time</code> will default to <code>-1</code> or unlimited. To set the <code>max_execution_time</code> we will need to set the <code>max_execution_time</code> in the <code>config/octane.php</code> file. It should look like this:</p>
<pre><code>    <span class="hljs-comment">/*
    |--------------------------------------------------------------------------
    | Maximum Execution Time
    |--------------------------------------------------------------------------
    |
    | The following setting configures the maximum execution time for requests
    | being handled by Octane. You may set this value to 0 to indicate that
    | there isn't a specific time limit on Octane request execution time.
    |
    */</span>

    <span class="hljs-string">'max_execution_time'</span> =&gt; <span class="hljs-number">1800</span>,
</code></pre><p>Because Octane loads the application all at once, file changes in development may not be recognized. Luckily Laravel has some great  <a target="_blank" href="https://laravel.com/docs/8.x/octane#watching-for-file-changes">documentation</a>  on that and how to restart Octane when files change.  </p>
<p>Swoole comes with Sail, so if you are developing with Sail you will have Swoole. However the documentation suggest launching Octane with Swoole by editing the <code>supervisord.conf</code> file to include the <code>--server=swoole</code> command rather than changing the <code>'server' =&gt; env('OCTANE_SERVER', 'roadrunner'),</code> variable in the <code>config/octane.php</code> file. Not sure why, seems a bit messy. I have yet to mess around with this.</p>
<p>As this project continues I know I will be facing memory leaks and dependency injection, but I have not gotten there yet. I look forward to figuring out how to configure proxy pass throughs with a load balancer to the Swoole server. Managing concurrent php scripts was not something many php developers thought they would ever do but here I am, figuring it out. Like... Comment... Hire me!</p>
]]></content:encoded></item><item><title><![CDATA[Team Development With Laravel]]></title><description><![CDATA[September 8, 2020 Laravel 8 was released.
October 23, 2020 Taylor Otwell  asked the Windows Laravel community on Twitter,   what virtual environment they were using to develop in. Wampp/Xampp was the winning option with 39.1% of people using it.
Dece...]]></description><link>https://blog.baddington.com/team-development-with-laravel</link><guid isPermaLink="true">https://blog.baddington.com/team-development-with-laravel</guid><category><![CDATA[Laravel]]></category><category><![CDATA[Windows]]></category><category><![CDATA[Docker]]></category><dc:creator><![CDATA[Andrew Earls]]></dc:creator><pubDate>Fri, 17 Dec 2021 20:13:43 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1639771868797/Q5QYvGuAx.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>September 8, 2020 Laravel 8 was released.</p>
<p>October 23, 2020 Taylor Otwell  <a target="_blank" href="https://twitter.com/taylorotwell/status/1319699926796959746">asked the Windows Laravel community on Twitter,</a>   what virtual environment they were using to develop in. Wampp/Xampp was the winning option with 39.1% of people using it.</p>
<p>December 8, 2020 Taylor Otwell <a target="_blank" href="https://twitter.com/taylorotwell/status/1336357588791947264?ref_src=twsrc%5Etfw%7Ctwcamp%5Etweetembed%7Ctwterm%5E1336357588791947264%7Ctwgr%5E%7Ctwcon%5Es1_&amp;ref_url=https%3A%2F%2Ftech.osteel.me%2Fposts%2Fyou-dont-need-laravel-sail"> announced the launch of Laravel Sail.</a>  Now it is officially the recommended way to develop in Laravel.</p>
<p>There is  <a target="_blank" href="https://laravel.com/docs/8.x/sail#installing-sail-into-existing-applications">documentation</a>  on how to install Laravel Sail into existing applications. For those who are creating new applications Sail is included in Laravel 8.*.</p>
<p>I have had no issues with Laravel Sail development in Linux, but recently I have had issues when a teammate is developing in Windows. So I will be outlining the procedure I used to overcome these issues.</p>
<p>The issue we kept running into was when launching the sail application. We would get the following error.</p>
<pre><code>./usr<span class="hljs-operator">/</span>bin<span class="hljs-operator">/</span>env: <span class="hljs-string">'bash\r'</span>: No such file or directory
</code></pre><p>Fixing this was a bit confusing because there was not a lot of people who had resolved the issue. However there was a suggestion in the  <a target="_blank" href="https://laravel.com/docs/8.x/installation#getting-started-on-windows">Laravel documentation</a>  that helped me figure it out.</p>
<p>To start off, I downloaded  <a target="_blank" href="https://hub.docker.com/editions/community/docker-ce-desktop-windows">Docker Desktop for Windows.</a> When installing there was a checkbox for WSL2 installation. WSL2 is a Windows subsystem for Linux. So I made sure this was checked.</p>
<p>Then, I opened the terminal and entered the <code>wsl</code> command. From here I navigated to the user root directory with the <code>cd ~</code> command. </p>
<p>After this I was ready to clone the repository with git. </p>
<pre><code>git clone https://<span class="hljs-type">path</span>-<span class="hljs-keyword">to</span>-directory
</code></pre><p>My local repository was missing dependencies, so I installed them with  <a target="_blank" href="https://laravel.com/docs/8.x/sail#installing-composer-dependencies-for-existing-projects">this command</a>  from the Laravel documentation.</p>
<pre><code>docker run <span class="hljs-operator">-</span><span class="hljs-operator">-</span>rm \
    <span class="hljs-operator">-</span>u <span class="hljs-string">"$(id -u):$(id -g)"</span> \
    <span class="hljs-operator">-</span>v $(pwd):<span class="hljs-operator">/</span><span class="hljs-keyword">var</span><span class="hljs-operator">/</span>www<span class="hljs-operator">/</span>html \
    <span class="hljs-operator">-</span>w <span class="hljs-operator">/</span><span class="hljs-keyword">var</span><span class="hljs-operator">/</span>www<span class="hljs-operator">/</span>html \
    laravelsail<span class="hljs-operator">/</span>php81<span class="hljs-operator">-</span>composer:latest \
    composer install <span class="hljs-operator">-</span><span class="hljs-operator">-</span>ignore<span class="hljs-operator">-</span>platform<span class="hljs-operator">-</span>reqs
</code></pre><p>From here all I needed to do was create an .env file by copying the .env.example file, launch the application <code>sail up</code>, and set the application key in a new wsl tab <code>sail artisan key:generate</code>.</p>
<p> <a target="_blank" href="https://unsplash.com/photos/Hcfwew744z4?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditShareLink"><em>Image by Christin Hume on Unsplash</em></a> </p>
]]></content:encoded></item></channel></rss>