Site icon บริษัท โค๊ดบี จำกัด

PHP Codeigniter เน้นใช้งาน : การติดตั้ง codeigniter บนโฮสจริง

php-codeigniter-framework

php-codeigniter-framework

<h3>PHP Codeigniter เน้นใช้งาน &colon; การติดตั้ง codeigniter บนโฮสจริง<&sol;h3>&NewLine;<p>เวอร์ชั่นที่ใช้ในบทความนี้ PHP Codeigniter 3&period;0&period;5<&sol;p>&NewLine;<p>1&period; <strong>เปลี่ยน CI ENVIRONMENT จาก development เป็น production<&sol;strong><br &sol;>&NewLine; เปิดไฟล์ index&period;php ที่ root ของ codeigniter ประมาณบรรทัดที่ 56<br &sol;>&NewLine; <&excl;--more--> <&sol;p>&NewLine;<pre class&equals;"lang&colon;php decode&colon;true " >define&lpar;'ENVIRONMENT'&comma; isset&lpar;&dollar;&lowbar;SERVER&lbrack;'CI&lowbar;ENV'&rsqb;&rpar; &quest; &dollar;&lowbar;SERVER&lbrack;'CI&lowbar;ENV'&rsqb; &colon; 'production'&rpar;&semi;<&sol;pre>&NewLine;<p>2&period; <strong>ตั้งค่า base&lowbar;url ให้เป็น domain จริง <&sol;strong><br &sol;>&NewLine; เปิดไฟล์ application&sol;config&sol;config&period;php ประมาณบรรทัด 38<&sol;p>&NewLine;<pre class&equals;"lang&colon;php decode&colon;true " >&dollar;config&lbrack;'base&lowbar;url'&rsqb; &equals; 'http&colon;&sol;&sol;www&period;yourdomain&period;com'&semi; <&sol;pre>&NewLine;<p>3&period; <strong>หากมีการใช้งาน session ให้ไปตั้งค่า sess&lowbar;save&lowbar;path <&sol;strong><br &sol;>&NewLine; เปิดไฟล์ application&sol;config&sol;config&period;php ประมาณบรรทัด 374<&sol;p>&NewLine;<pre class&equals;"lang&colon;php decode&colon;true " >&dollar;config&lbrack;'sess&lowbar;save&lowbar;path'&rsqb; &equals; '&sol;home&sol;yourdomainname&sol;public&lowbar;html&sol;tmp'&semi;<&sol;pre>&NewLine;<p> &&num;8211&semi; yourdomainname ให้ใส่ชื่อโดเมนไปนะครับ<br &sol;>&NewLine; &&num;8211&semi; สร้างโฟลเด้อตั้งชื่อว่า tmp และ chmod เป็น 777 ไว้สำหรับเก็บข้อมูลชั่วคราวแบบ session<&sol;p>&NewLine;<p>3&period;1 <strong>หากมีการใช้งาน session ให้ไปตั้งค่า cookie&lowbar;domain ด้วย<&sol;strong><br &sol;>&NewLine; เปิดไฟล์ application&sol;config&sol;config&period;php ประมาณบรรทัด 395<&sol;p>&NewLine;<pre class&equals;"lang&colon;php decode&colon;true " >&dollar;config&lbrack;'cookie&lowbar;domain'&rsqb;&Tab;&equals; 'yourdomain&period;com'&semi;<&sol;pre>&NewLine;<p> yourdomain&period;com ให้เปลี่ยนเป็นชื่อโดเมนที่ใช้งานจริง ไม่ต้องมี http&colon;&sol;&sol; และ www นำหน้า<&sol;p>&NewLine;<p><strong>ข้อมูลเพิ่มเติม<&sol;strong><br &sol;>&NewLine; หากโฮสติ้งที่ท่านหรือลูกค้าใช้บริการติดตั้ง php version สู่งกว่า 5&period;3<br &sol;>&NewLine; ตัว CI จะแสดง error เกี่ยวกับ init&lowbar;set&lpar;&rpar; ฟังก์ชั่น<br &sol;>&NewLine; ให้เปิดไฟล์ index&period;php ของ CI ที่ root ประมาณบรรทัดที่ 75 &&num;8211&semi; 83<br &sol;>&NewLine; และ comment error&lowbar;reporting ทิ้งไป<br &sol;>&NewLine; หรือปรับ php version ตรง version&lowbar;compare ให้ตรงกับเวอร์ชั่นบนโฮสเรา<&sol;p>&NewLine;

Exit mobile version