|
 |
|
มีปัญหาเรื่อง การติดตั้ง extension ระหว่าง PHP 5.6 กับ PHP 7.0 |
|
 |
|
|
 |
 |
|
สิ่งที่ต้องการให้แสดงผลคือ
1. Upload File ผ่านฟอร์มอัพโหลด ได้
2. เชื่อมต่อฐานข้อมูล SQL Server ได้
3. ใน phpinfo(); แสดงผล pdo_sqlsrv และ sqlsrv
ปัญกาเกิดเมื่อ
เคสที่ 1
- ติดตั้ง PHP 5.6 แบบ Thread Safe และจัดการด้วย IIS Manager หลังจากนั้นนำ Extension php_sqlsrv_56_ts.dll, php_pdo_sqlsrv_56_ts.dll ไปวางไว้ใน Folder ext ใน php ที่เราเรียกติดตั้ง หลังจากนั้น เข้าไปจัดการไฟล์ php.ini โดยใส่
extension=php_sqlsrv_56_ts.dll
extension=php_pdo_sqlsrv_56_ts.dll
กด Save หลังจากนั้น รีสาตร์ท Web service แล้วเช็คดังนี้
- เช็ค phpinfo(); ไม่แสดงผลของ pdo_sqlsrv และ sqlsrv ตรง PDO ตาราง enable เป็นค่าว่าง ตามรูป
- เช็คการอัพโหลดไฟล์ ผ่านฟอร์ม php สามารถอัพโหลดได้
- เช็คการเชื่อมต่อฐานข้อมูล SQL Server เป็นค่าว่างๆ




เคสที่ 2
- ติดตั้ง PHP 7.0 แบบ Thread Safe และจัดการด้วย IIS Manager หลังจากนั้นนำ Extension php_sqlsrv_7_ts.dll, php_pdo_sqlsrv_7_ts.dll ไปวางไว้ใน Folder ext ใน php ที่เราเรียกติดตั้ง หลังจากนั้น เข้าไปจัดการไฟล์ php.ini โดยใส่
extension=php_sqlsrv_7_ts.dll
extension=php_pdo_sqlsrv_7_ts.dll
กด Save หลังจากนั้น รีสาตร์ท Web service แล้วเช็คดังนี้
- เช็ค phpinfo(); แสดงผลของ pdo_sqlsrv และ sqlsrv ตรง PDO ตาราง enable แสดงคำว่า sqlsrv
- เช็คการอัพโหลดไฟล์ ผ่านฟอร์ม php ไม่สามารถอัพโหลดไฟล์อะไรได้เลย ขึ้น Error Upload
- เช็คการเชื่อมต่อฐานข้อมูล SQL Server สามารถ Connect ฐานข้อมูลได้







ส่วน Code php ก็ง่ายๆแค่นี้เองครับ
Code
<!DOCTYPE html>
<html>
<body>
<form action="demo_upload.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="func" value="Upload">
Select image to upload:
<input type="file" name="filUpload" id="fileToUpload">
<input type="submit" value="Upload File" name="submit">
</form>
</body>
</html>
<?php
if($_POST["func"]=="Upload")
{
if(move_uploaded_file($_FILES["filUpload"]["tmp_name"],"uploads/".$_FILES["filUpload"]["name"]))
{
echo "Copy/Upload Complete";
}
else
{
echo "Error Upload";
}
}
?>
มีใครพอจะมีแนวทางดีๆที่จะแนะนำผมบ้างครับ งมมา 5 วันแล้ว ยังไม่จอทางออกเลยครับ ลองเปลี่ยนจาก PHP 7.0 เป็นเวอร์ชั่น 7.1 ,7.2,7.3 ก็มีปัญหา เหมือน 7.0 เลยครับ
ช่วยระดมความคิดช่วยผมด้วยครับ
Tag : PHP, MySQL, Ms SQL Server 2014, HTML, Web Services, IIS

|
|
 |
 |
 |
 |
Date :
2018-12-15 15:48:58 |
By :
kantarasukan |
View :
2512 |
Reply :
4 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
ini_set('display_errors', 1);
error_reporting(~0);
ดู error
|
 |
 |
 |
 |
Date :
2018-12-16 06:02:50 |
By :
ผ่านมา |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
https://rundiz.com/?p=171
ปรับ php.ini ให้แสดงรายละเอียดข้อผิดพลาดให้มากที่สุดไปเลยครับ
|
ประวัติการแก้ไข 2018-12-16 11:54:06
 |
 |
 |
 |
Date :
2018-12-16 11:53:52 |
By :
mr.v |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แก้ไขปัญหาได้แล้วนะครับ
เผื่อใครเจอปัญหาแบบผม เอาข้อมูลนี้ไปใช้ได้นะครับ IIS+PHP+SQL Server
ผมลอง PHP หลายเวอร์ชันเลยครับ จนมาถึง เวอร์ชันนี้ Bingo ได้ครับ ครบจบทุกปัญหา ที่เจอเลย
ตามภาพเลยนะครับ ดาวน์โหลดเวอร์ชั่นนี้ เวอร์ชั่นอื่นหรือตัวอื่นๆ ลองทดสอบแล้วแก้ปัญหาไม่ได้
ขอบคุณหลายๆ ท่านที่เข้ามาระดมความคิดครับ

|
 |
 |
 |
 |
Date :
2018-12-21 10:40:52 |
By :
kantarasukan |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลง phpmanager จบเลย
|
 |
 |
 |
 |
Date :
2018-12-21 10:55:56 |
By :
Pong Thep |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 04
|