رتبه موضوع:
  • 0 رای - 0 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
خطای CURLOPT_FOLLOWLOCATION cannot be activated هنگام فراخوانی curl
#1
Question 
سلام
من وقتی یک آدرس https رو با curl فراخوانی میکنم

curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set

در صورتی که همین کد های من توو لوکال به خوبی عمل کردن :

public function myCurlPost($url, $postfields)
   {
       $ch = curl_init();
       curl_setopt($ch, CURLOPT_URL, $url);
       curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
       curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
       curl_setopt($ch, CURLOPT_POST, 1);
       // Edit: prior variable $postFields should be $postfields;
       curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
       curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // On dev server only!

       if(curl_exec($ch) === false)
       {
           curl_close($ch);
           return false;
       }
       else
       {
           curl_close($ch);
           return true;
       }

       // Close handle
       
   }


توو اینترنت سرچ زدم انواع جواب ها برای خاموش کردن safe_mode توو php.ini رو هم انجام دادم اما بازم مشکل حل نشد 

php.ini داخل لوکال رو با php.ini سرور رو با هم مقایسه کردم توو php.ini سرور ای چند خط وجود نداشت اضافه کردم :

; Safe Mode
; http://php.net/safe-mode
safe_mode=Off

; By default, Safe Mode does a UID compare check when
; opening files. If you want to relax this to a GID compare,
; then turn on safe_mode_gid.
; http://php.net/safe-mode-gid
safe_mode_gid=Off

; When safe_mode is on, UID/GID checks are bypassed when
; including files from this directory and its subdirectories.
; (directory must also be in include_path or full path must
; be used when including)
; http://php.net/safe-mode-include-dir
safe_mode_include_dir=

; When safe_mode is on, only executables located in the safe_mode_exec_dir
; will be allowed to be executed via the exec family of functions.
; http://php.net/safe-mode-exec-dir
safe_mode_exec_dir=

اما بازم حل نشد :(
پاسخ
تشکر شده توسط:
#2
سلام
مشکل از هاست هست، اگر اشتراکی هست کاری نمیتونی بکنی، ولی اگه vps هست open_basedir رو غیرفعال کن.
http://wiki.vps.net/controlpanels/ispman...e-website/

یه تعداد تابع جایگزین واسه FOLLOWLOCATION نوشته شدن ولی من قبلا تست کردم هیچکدوم جواب نداد!
پاسخ
تشکر شده توسط: saman-arsenal
#3
(12-11-1394، 12:21 ق.ظ)محسن نوری نوشته: سلام
مشکل از هاست هست، اگر اشتراکی هست کاری نمیتونی بکنی، ولی اگه vps هست open_basedir رو غیرفعال کن.
http://wiki.vps.net/controlpanels/ispman...e-website/

یه تعداد تابع جایگزین واسه FOLLOWLOCATION نوشته شدن ولی من قبلا تست کردم هیچکدوم جواب نداد!

مرسی محسن جان ، مشکل از ارسال پارمتری با کارکتر خاص مثل @ بود که followlocation اون مشکل و حل میکرد اما خودش توو سرور با این مشکل مواجه میشد ، با استفاده از تابع http_build_query و استفاده نکردن از followlocation حل شد.
پاسخ
تشکر شده توسط:




کاربران در حال بازدید این موضوع: 1 مهمان