<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:media="http://search.yahoo.com/mrss/">
  <channel>
    <title>Laravel Issue｜林鼎淵 Dean Lin</title>
    <link>https://deanlin.net/tags/laravel-issue/</link>
    <image><url>https://deanlin.net/images/author_hu_aa256fc934e9a932.jpg</url><title>Laravel Issue｜林鼎淵 Dean Lin</title><link>https://deanlin.net/tags/laravel-issue/</link><width>144</width><height>144</height></image>
    <description>林鼎淵（Dean Lin）的部落格：生成式 AI 企業內訓講師、外商資安公司軟體專家、7 本書作者。400 多篇文章用白話分享生成式 AI 實戰、Claude Code 與 Vibe Coding 教學、團隊合作與職場成長。</description>
    <generator>Hugo</generator>
    <language>zh-tw</language>
    <copyright>© 2020–2026 林鼎淵 Dean Lin</copyright>
    <lastBuildDate>Wed, 17 Jun 2020 17:01:07 +0800</lastBuildDate>
    <atom:link href="https://deanlin.net/tags/laravel-issue/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Laravel經驗</title>
      <link>https://deanlin.net/blog/202006/laravel-experience-notes/</link>
      <pubDate>Wed, 17 Jun 2020 17:01:07 +0800</pubDate>
      <guid>https://deanlin.net/blog/202006/laravel-experience-notes/</guid>
      <dc:creator>林鼎淵</dc:creator>
      <category>技術教學</category>
      <description>希望這篇文章可以幫助你快速通過我在開發Laravel時所遇到的各種坑(如果有遇到新的我會持續更新)</description>
      <media:content url="https://deanlin.net/blog/202006/laravel-experience-notes/images/laravel-experience-notes-og_hu_c471f62bca98d1ce.jpg" medium="image" type="image/jpeg" width="1200" height="675" />
      <content:encoded><![CDATA[<p><img src="https://deanlin.net/blog/202006/laravel-experience-notes/images/laravel-experience-notes-01.webp" width="500" height="320" alt="Laravel經驗（圖 1）" fetchpriority="high" decoding="async"></p>
<h3 id="為什麼總是要-composer-dump-autoload-">為什麼總是要 composer dump-autoload ?<a class="h-anchor" href="#%e7%82%ba%e4%bb%80%e9%ba%bc%e7%b8%bd%e6%98%af%e8%a6%81-composer-dump-autoload-" aria-label="這個段落的連結"></a></h3>
<p>剛開始接觸用 composer 的時候一直被這個問題蠱惑。很不理解為什麼總是要打這句命令才能不報錯，現在終於知道根結了。</p>
<p>因為 database 文件夾使用 classmap 來做加載的。所以只有在打了 composer dumpautoload 之後 composer 才會更新 autoload_classmap 的內容。</p>
<h3 id="遇到無法composer可用這個">遇到無法composer可用這個<a class="h-anchor" href="#%e9%81%87%e5%88%b0%e7%84%a1%e6%b3%95composer%e5%8f%af%e7%94%a8%e9%80%99%e5%80%8b" aria-label="這個段落的連結"></a></h3>
<div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>sudo apt-get install php-mbstring
</span></span><span style="display:flex;"><span>sudo apt-get install php-xml
</span></span></code></pre></div><h3 id="如果遇到log讀寫權限不足">如果遇到log讀寫權限不足<a class="h-anchor" href="#%e5%a6%82%e6%9e%9c%e9%81%87%e5%88%b0log%e8%ae%80%e5%af%ab%e6%ac%8a%e9%99%90%e4%b8%8d%e8%b6%b3" aria-label="這個段落的連結"></a></h3>
<pre tabindex="0"><code>vim /etc/nginx/nginx.conf
</code></pre><p>去看nginx的權限user www-data;</p>
<p>Laravel的資料夾權限需要跟nginx一樣</p>
<div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>chown -R www-data.www-data device-api
</span></span><span style="display:flex;"><span>sudo chgrp -R www-data storage bootstrap/cache
</span></span><span style="display:flex;"><span>sudo chmod -R ug+rwx storage bootstrap/cache
</span></span></code></pre></div><h3 id="php-fpm錯誤-warning-pool-www-server-reached-pmmax_children-setting-5-consider-raising-it">php-fpm錯誤: WARNING: [pool www] server reached pm.max_children setting (5), consider raising it<a class="h-anchor" href="#php-fpm%e9%8c%af%e8%aa%a4-warning-pool-www-server-reached-pmmax_children-setting-5-consider-raising-it" aria-label="這個段落的連結"></a></h3>
<p><a href="https://blog.csdn.net/encircles/article/details/80503756">https://blog.csdn.net/encircles/article/details/80503756</a></p>
<h3 id="timeout相關包含nginx-php-fpm">timeout相關(包含nginx, php-fpm)<a class="h-anchor" href="#timeout%e7%9b%b8%e9%97%9c%e5%8c%85%e5%90%abnginx-php-fpm" aria-label="這個段落的連結"></a></h3>
<p><a href="https://blog.goodjack.tw/2018/08/increase-php-fpm-script-execution-time-with-nginx.html">https://blog.goodjack.tw/2018/08/increase-php-fpm-script-execution-time-with-nginx.html</a></p>
<h3 id="composer-版本太舊無法更新問題">composer 版本太舊無法更新問題<a class="h-anchor" href="#composer-%e7%89%88%e6%9c%ac%e5%a4%aa%e8%88%8a%e7%84%a1%e6%b3%95%e6%9b%b4%e6%96%b0%e5%95%8f%e9%a1%8c" aria-label="這個段落的連結"></a></h3>
<p>https://lequ7.com/2019/06/19/richang/composer-fu-wu-qi-an-zhuang-kuo-zhan-shi-bai-ban-ben-guo-di-de-sheng-ji-guo-cheng/</p>
<h3 id="nginx-出现504-gateway-time-out的解决方法">nginx 出现504 Gateway Time-out的解决方法<a class="h-anchor" href="#nginx-%e5%87%ba%e7%8e%b0504-gateway-time-out%e7%9a%84%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95" aria-label="這個段落的連結"></a></h3>
<div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>sudo vi /etc/nginx/nginx.conf
</span></span></code></pre></div><p>系統有超過 300~500mb的影片，这了，超時時<a href="https://blog.csdn.net/fdipzone/article/details/79355576">間調整為30分鐘；這裡有更詳細的說明</a></p>
<pre tabindex="0"><code>proxy_connect_timeout 1800s;#nginx跟後端服務器連接超時時間(代理連接超時)
proxy_send_timeout 1800s;#後端服務器數據回傳時間(代理發送超時)
proxy_read_timeout 1800s;#連接成功後，後端服務器響應時間(代理接收超時)
fastcgi_connect_timeout 1800s;#指定nginx與後端fastcgi server連接超時時間
fastcgi_send_timeout 1800s;#指定nginx向後端傳送請求超時時間（指已完成兩次握手後向fastcgi傳送請求超時時間）
fastcgi_read_timeout 1800s;#指定nginx向後端傳送響應超時時間（指已完成兩次握手後向fastcgi傳送請求超時時間）
</code></pre><h3 id="laravel-同時間大量update會有數據對不上的問題transaction-issue">Laravel 同時間大量update會有數據對不上的問題(transaction issue)<a class="h-anchor" href="#laravel-%e5%90%8c%e6%99%82%e9%96%93%e5%a4%a7%e9%87%8fupdate%e6%9c%83%e6%9c%89%e6%95%b8%e6%93%9a%e5%b0%8d%e4%b8%8d%e4%b8%8a%e7%9a%84%e5%95%8f%e9%a1%8ctransaction-issue" aria-label="這個段落的連結"></a></h3>
<p><a href="https://blog.scottchayaa.com/post/2019/01/09/how-to-handle-the-high-concurrency-on-laravel/">https://blog.scottchayaa.com/post/2019/01/09/how-to-handle-the-high-concurrency-on-laravel/</a></p>
<h3 id="php的mysql沒有安裝完整的錯誤">Php的mysql沒有安裝完整的錯誤<a class="h-anchor" href="#php%e7%9a%84mysql%e6%b2%92%e6%9c%89%e5%ae%89%e8%a3%9d%e5%ae%8c%e6%95%b4%e7%9a%84%e9%8c%af%e8%aa%a4" aria-label="這個段落的連結"></a></h3>
<p>PHP Warning: PHP Startup: Unable to load dynamic library ‘pdo_mysql’ (tried: /usr/lib/php/20170718/pdo_mysql (/usr/lib/php/20170718/pdo_mysql: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/pdo_mysql.so (/usr/lib/php/20170718/pdo_mysql.so: undefined symbol: pdo_parse_params)) in Unknown on line 0</p>
<div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>sudo apt-get install php-common php-mysql php-cli
</span></span></code></pre></div><h3 id="如果出現php版本跑掉的狀況不要擔心">如果出現php版本跑掉的狀況，不要擔心<a class="h-anchor" href="#%e5%a6%82%e6%9e%9c%e5%87%ba%e7%8f%bephp%e7%89%88%e6%9c%ac%e8%b7%91%e6%8e%89%e7%9a%84%e7%8b%80%e6%b3%81%e4%b8%8d%e8%a6%81%e6%93%94%e5%bf%83" aria-label="這個段落的連結"></a></h3>
<div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>sudo update-alternatives — config php
</span></span></code></pre></div><h3 id="確認現在php支援databsae的相容性">確認現在php支援databsae的相容性<a class="h-anchor" href="#%e7%a2%ba%e8%aa%8d%e7%8f%be%e5%9c%a8php%e6%94%af%e6%8f%b4databsae%e7%9a%84%e7%9b%b8%e5%ae%b9%e6%80%a7" aria-label="這個段落的連結"></a></h3>
<p>php artisan tinker</p>
<p>DB::availableDrivers()</p>
<h3 id="只想要讓某個-function-可以執行長時間的任務ex上傳檔案">只想要讓某個 function 可以執行長時間的任務（ex：上傳檔案）<a class="h-anchor" href="#%e5%8f%aa%e6%83%b3%e8%a6%81%e8%ae%93%e6%9f%90%e5%80%8b-function-%e5%8f%af%e4%bb%a5%e5%9f%b7%e8%a1%8c%e9%95%b7%e6%99%82%e9%96%93%e7%9a%84%e4%bb%bb%e5%8b%99ex%e4%b8%8a%e5%82%b3%e6%aa%94%e6%a1%88" aria-label="這個段落的連結"></a></h3>
<p>在 function 裡面加上 <code>ini_set(&lsquo;mac_excution_time&rsquo;,&lsquo;600&rsquo;)</code> ，其中「600」的單位是秒數。</p>
<div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-php" data-lang="php"><span style="display:flex;"><span><span style="color:#ff7b72">public</span> <span style="color:#ff7b72">function</span> <span style="color:#d2a8ff;font-weight:bold">long_excution_function</span>(Request <span style="color:#79c0ff">$request</span>) {
</span></span><span style="display:flex;"><span>  ini_set(<span style="color:#a5d6ff">&#39;max_execution_time&#39;</span>, <span style="color:#a5d6ff">&#39;600&#39;</span>);
</span></span><span style="display:flex;"><span>  <span style="color:#8b949e;font-style:italic">// your code
</span></span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><p class="code-source">原始碼：<a href="https://gist.github.com/dean9703111/966cd5c90443b8d5a2308df9968d5cf8" rel="noopener">long_excution_function.php</a>（GitHub Gist）</p>
]]></content:encoded>
    </item>
  </channel>
</rss>
