<?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" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Likit Neeranatpuree on Medium]]></title>
        <description><![CDATA[Stories by Likit Neeranatpuree on Medium]]></description>
        <link>https://medium.com/@n-likit2530?source=rss-8418f0ec3384------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*AwnojGzYyfExEHKq</url>
            <title>Stories by Likit Neeranatpuree on Medium</title>
            <link>https://medium.com/@n-likit2530?source=rss-8418f0ec3384------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 12:37:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@n-likit2530/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[PHPMailer กับ Gmail แบบ OAuth 2.0]]></title>
            <link>https://n-likit2530.medium.com/phpmailer-%E0%B8%81%E0%B8%B1%E0%B8%9A-gmail-%E0%B9%81%E0%B8%9A%E0%B8%9A-oauth-2-0-87d89bb96a64?source=rss-8418f0ec3384------2</link>
            <guid isPermaLink="false">https://medium.com/p/87d89bb96a64</guid>
            <category><![CDATA[phpmailer]]></category>
            <category><![CDATA[gmail-oauth2]]></category>
            <category><![CDATA[php]]></category>
            <dc:creator><![CDATA[Likit Neeranatpuree]]></dc:creator>
            <pubDate>Wed, 24 Nov 2021 07:08:47 GMT</pubDate>
            <atom:updated>2021-11-24T07:08:47.794Z</atom:updated>
            <content:encoded><![CDATA[<ol><li>PHP ver. ที่ใช้แล้วได้ผลตอนนี้คือ PHP 7.2.10 ยังไม่ได้ลอง 5.6.39 ใช้ได้ไหม</li><li>ติดตั้ง PHP Mailer ผ่าน Composer</li></ol><pre>composer require phpmailer/phpmailer</pre><p>ณ วันที่เขียน ได้ PHPMailer ver. 6.5.1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DkmUd6KLYprSPsORrTqE4Q.jpeg" /></figure><p>3. ติดตั้ง league/oauth2-google และ league/oauth2-client</p><pre>composer require league/oauth2-google<br>composer require league/oauth2-client</pre><p>*ไม่แน่ใจว่าเฉพาะ oauth2-google เลยจะได้ไหม</p><p>4. สร้าง Project ใน Google Dev Console <a href="https://console.cloud.google.com/">https://console.cloud.google.com/</a></p><p>เพื่อเอา Client ID และ Secret</p><p>4.1 New Project</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/1*-eXAELHqxPUwFIe6ee-UYw.jpeg" /></figure><p>4.2 Add Gmail API ใน APIs &amp; Services</p><p>ค้นหา Gmail API แล้ว Enable ซะ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*brPw094LHGSl0fYjILSFcg.jpeg" /></figure><p>4.3 กรอกข้อมูลใน OAuth Consent Screen</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*ojs-FMNL3sLvFAouTll3VA.jpeg" /></figure><p>เลือก External จากนั้นกรอกข้อมูล APP Information ไม่ต้องกรอกเยอะ</p><p>4.4 สร้าง Credentials &gt;&gt; OAuth 2.0 Client IDs</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*uTuwwDSwWcm5l5mHX2pVUQ.jpeg" /></figure><p>กรอกข้อมูล application type และ name กำหนด Authorized redirect URLs</p><blockquote>http://localhost/get_auth_token.php</blockquote><p>*กำหนด path ตามความเหมาะสม<br>**sub domain localhost ใช้งานไม่ได้ ระบบไม่ยอม</p><p>สร้างสำเร็จจะได้ Client ID และ Client Secret</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/263/1*hwZDuJmmArAxlrn7KuoPgg.jpeg" /></figure><p>5. ทำการหา และCopy file “get_auth_token.php” ในโฟลเดอร์ vender/phpmailer มาไว้ตาม path ที่เรียกใช้งานได้ตามที่กำหนดใน Authorized redirect URLs ไว้</p><p>5.1 เปลี่ยน Client ID Client Secret Redirect Url ให้ตรงกันกับข้อมูลที่มี</p><p>5.2 เรียก Url ดังกล่าว เลือก Google ทำการ Login ให้เรียบร้อย จะได้ Refresh Token</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*ipw6vmdkxH1IDRgk7wsbOw.jpeg" /></figure><p>ระบบจะให้ Trust App ที่สร้างด้วย</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/507/1*7xfRlm9Muv8865fc01RKww.jpeg" /></figure><p>จะได้ Refresh Token ให้ Copy เก็บไว้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*6nEnX38OyUbWr_YSvFnJYA.jpeg" /></figure><p>6. หาไฟล์ตัวอย่าง การส่งเมลแบบ XOAuth ของPHPMailer</p><p><a href="https://github.com/PHPMailer/PHPMailer/blob/master/examples/gmail_xoauth.phps">PHPMailer/gmail_xoauth.phps at master · PHPMailer/PHPMailer</a></p><p>Copy Code มา แก้ไข Client ID, Client Secret, Refresh Token, <br>Email ผู้ส่ง, Email ผู้รับ, ข้อความที่ส่ง</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/412/1*t0PHtX86pYA0ESbCGkDWAQ.jpeg" /></figure><p>แล้วลองใช้งานเลย ถ้าไม่ผิดพลาด ก็ส่งสำเร็จ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/547/1*I1cgeJsuOeBYb0YbpHJYqw.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=87d89bb96a64" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ติดตั้ง Xampp (PHP)8.0.6 ซ้อนทับ Xampp (PHP)5.6.39]]></title>
            <link>https://n-likit2530.medium.com/%E0%B8%95%E0%B8%B4%E0%B8%94%E0%B8%95%E0%B8%B1%E0%B9%89%E0%B8%87-xampp-php-8-0-6-%E0%B8%8B%E0%B9%89%E0%B8%AD%E0%B8%99%E0%B8%97%E0%B8%B1%E0%B8%9A-xampp-php-5-6-39-35c47c133df5?source=rss-8418f0ec3384------2</link>
            <guid isPermaLink="false">https://medium.com/p/35c47c133df5</guid>
            <category><![CDATA[installation]]></category>
            <category><![CDATA[xampp]]></category>
            <category><![CDATA[php]]></category>
            <dc:creator><![CDATA[Likit Neeranatpuree]]></dc:creator>
            <pubDate>Tue, 01 Jun 2021 15:31:26 GMT</pubDate>
            <atom:updated>2021-06-01T15:31:26.035Z</atom:updated>
            <content:encoded><![CDATA[<p>เนื่องจากปัจจุบันใช้งาน PHP ver. 5.6.39 เป็นหลัก เพราะว่ายังมีโปรเจ็คที่ยังต้องใช้ PHP ver. ดังกล่าว แต่เกิดเหตุอยากเรียนรู้ Laravel 8 ซึ่งความต้องการในการใช้ต้องมีการติดตั้ง PHP 7.3 ขึ้นไป เลยจำเป็นต้องหาทางติดตั้งและใช้งาน PHP 2 ver. พร้อมกันในเครื่องเดียว</p><p>จากการพยายามติดตั้ง PHP เพิ่มเติม เพราะไม่อยากไปยุ่งกับ PHP 5.6.39 เนื่องจากกลัวโปรเจ็คเก่า ๆ จะมีปัญหา เลยได้ลองติดตั้ง PHP 8.0.6 แบบเปล่า ๆ เพิ่มเติมโดยการดาวน์โหลดจาก php.net แต่ก็เจอปัญหาตอนใช้งาน Composer ติดตั้ง Laravel เพราะอาจจะเป็นเรื่องของการ config PHP ตัวที่ติดตั้งเพิ่มเติม จึงไม่สามารถติดตั้ง Laravel ผ่าน Composer ได้</p><p>วิธีการแก้ไขที่เลือกใช้คือ การติดตั้ง Xampp 8.0.6 แล้วจึงทำการ copy โฟลเดอร์ php (ซึ่งคือ PHP 8.0.6) และทำการปรับแก้ไข config เล็กน้อย เพื่อให้ใช้ php ver 8.0.6 ควบคู่ไปได้ แต่จะ run ผ่าน port 8080 ซึ่ง php 5.6.39 ยังใช้งานบน port 80 เหมือนเดิม</p><p>โดยมีขั้นตอนดังต่อไปนี้</p><ol><li>หาดาวน์โหลด Xampp 8.0.6 มาติดตั้ง</li><li>ในขั้นตอนการติดตั้ง Xampp 8.0.6 มีการเปลี่ยน path สำหรับติดตั้ง (C:\xampp806) เพื่อไม่ให้ชนกับ Xampp 5.6.39 ที่ติดตั้งไว้ก่อนหน้าแล้ว (C:\xampp)</li><li>เลือกติดตั้งเฉพาะ PHP เท่านั้น พวก mysql, phpMyAdmin ก็ไม่เอา</li><li>เมื่อติดตั้ง Xampp 8.0.6 สำเร็จ ทำการ Copy เปลี่ยนชื่อโฟลเดอร์ php ใน C:\xampp806 ไปไว้ใน C:\xampp\php806</li><li>สรุปในขั้นตอนปัจจุบัน ในโฟลเดอร์ C:\xampp จะมี โฟลเดอร์ php และ php806<br>ซึ่ง โฟลเดอร์ php คือ php ver. 5.6.39<br>และ โฟลเดอร์ php806 คือ php ver. 8.0.6</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*Iswq5ybXSujRXAgMCYSobA.png" /></figure><p>6. เข้าไปในโฟลเดอร์ php806 ค้นหาไฟล์ php.ini และทำการค้นหาและแก้ไขดังนี้</p><p>extension_dir = “ext”</p><p>ค้นหาและแก้ไข path โฟลเดอร์ php ให้เป็น php806 ทั้งหมด ตัวอย่างดังรูป (จริงๆแล้วมีหลายจุดแก้ไข พยายามค้นหาทั้งหมด)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*ORCr0xaKRrrgpKTD9fq1iA.png" /><figcaption>ตัวอย่างจุดที่ต้องแก้ไข มีจุดอื่น ๆ อีกหลายจุด</figcaption></figure><p>7. ไปที่โฟลเดอร์ C:\xampp\apache\conf\extra เปิดไฟล์ httpd-xampp.conf และทำการเพิ่ม code ข้างล่างนี้ไว้ล่างสุด (อาจมีการแก้ไข path ถ้าติดตั้งไม่เหมือนตามที่กล่าวไว้ข้างบน)</p><p>ScriptAlias /php806 “C:/xampp/php806”<br>&lt;Directory “C:/xampp/php806”&gt;<br> AllowOverride None<br> Options None<br> Require all denied<br> &lt;Files “php-cgi.exe”&gt;<br> Require all granted<br> &lt;/Files&gt;<br>&lt;/Directory&gt;</p><p>Listen 8080<br>&lt;VirtualHost *:8080&gt;<br> UnsetEnv PHPRC<br> &lt;FilesMatch “\.php$”&gt;<br> php_flag engine off<br> SetHandler application/x-httpd-php806<br> Action application/x-httpd-php806 “/php806/php-cgi.exe”<br> &lt;/FilesMatch&gt;<br>&lt;/VirtualHost&gt;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/1*QkHjd_nuyZWATYY12AADKQ.png" /><figcaption>เพิ่มไว้ล่าสุดเลย</figcaption></figure><p>8. จากนั้น Stop และ Start Apache ใหม่ จะเห็นว่า มี port 8080 เพิ่มมาอีก 1 อัน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*OqyGqlJxG6S4Qpcxo0w2rw.png" /></figure><p>9. ติดตั้ง Composer และเลือก path ของ php เป็น C:\xampp\php806\php.exe</p><p>10. ลองสร้าง โฟลเดอร์ test_php8 ใน C:\xampp\htdocs และสร้างไฟล์ index.php</p><p>11. ในไฟล์ index.php พิมพ์ code &lt;?php echo phpinfo(); ?&gt;</p><p>12. ลองรันผ่าน url ดังนี้ <a href="http://localhost:8080/test_php8">http://localhost:8080/test_php8</a> ถ้าสำเร็จจะเห็นว่า PHP ver 8.0.6 แล้ว</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yyNDHISTRAmI4jpfqkrkIg.png" /></figure><p>13. ลองคิดตั้ง laravel ล่าสุดผ่าน cmd ในโฟลเดอร์ xampp\htdocs ด้วยคำสั่ง</p><p>composer create-project laravel/laravel test_laravel</p><p>โดย test_laravel คือชื่อโปรเจ็คที่จะถูกสร้างขึ้นในโฟลเดอร์ htdocs</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*ybtqD8TPGjiz1u3ODoFbsA.png" /></figure><p>ติดตั้งสำเร็จ ไม่มี Error</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*YqE-oQFI9o12wEtb0FUn3A.png" /></figure><p>14. ติดตั้งสำเร็จลองเรียกใช้งานผ่าน url ดังนี้ <a href="http://localhost:8080/test_laravel/public">http://localhost:8080/test_laravel/public</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mOohEWvIcThHJ0DVCBKzJQ.png" /></figure><p>สำเร็จใช้งานได้แล้ว เย้!!~~</p><p>References</p><p>Shrestha, M. (2018, June 4). Run multiple version of PHP in XAMPP Windows (Without installing multiple XAMPP). Retrieved from <a href="https://themanish.com/run-multiple-version-of-php-in-xampp-windows-without-installing-multiple-xampp/">https://themanish.com/run-multiple-version-of-php-in-xampp-windows-without-installing-multiple-xampp</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=35c47c133df5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>