最近一段時間不少discuz站點的QQ互聯插件都好好的出現了當前存在網絡問題或服務器繁忙錯誤代碼:20003問題:php
因爲QQ互聯官方接口的升級,原有舊接口(oAuth1 接口)在必定條件下已經沒法使用,凡是出現 20003 錯誤的 Dz必須開啓 QQ 互聯 的 oAuth2 模式,這須要您服務器的 PHP 能正常訪問 HTTPS 遠程頁面,請確保 PHP 擁有擴展 php_curl、php_openssl 開啓 HTTPS 的訪問功能,而且無防火牆等系統級攔截。nginx
開始opensslapache
# 下載到/var/www/php5目錄下 cd /var/www/php5 wget http://mirrors.sohu.com/php/php-5.2.14.tar.gz # 解壓 tar zxvf php-5.2.14.tar.gz # 進入PHP的openssl擴展模塊目錄 cd php-5.2.14/ext/openssl/ /var/www/php5/bin/phpize # 這裏爲你本身的phpize路徑,若是找不到,使用whereis phpize查找 # 執行後,發現錯誤 沒法找到config.m4 ,config0.m4就是config.m4。直接重命名 mv config0.m4 config.m4 /var/www/php5/bin/phpize ./configure --with-openssl --with-php-config=/var/www/php5/bin/php-config ####### #這裏提示openSSL錯誤的時候: 碰見問題 configure: error: Cannot find OpenSSL’s <evp.h> ####### 直接執行:yum install openssl openssl-devel 再 ./configure --with-openssl --with-php-config=/var/www/php5/bin/php-config make make install # 安裝完成後,會返回一個.so文件(openssl.so)的目錄。在此目錄下把openssl.so 文件拷貝到你在php.ini 中指定的 extension_dir 下(在php.ini文件中查找:extension_dir =),我這裏的目錄是 var/www/php5/lib/php/extensions # 編輯php.ini文件,在文件最後添加 extension=openssl.so #重啓php #查看php-fpm進程數: ps aux | grep -c php-fpm #查看運行內存 /usr/bin/php -i|grep mem #重啓php-fpm /etc/init.d/php-fpm restart #重啓nginx 或apache
二、新建文件 oauth_switch.inc.phpbash
#首先,打開記事本,將如下代碼複製進去:「 <?php $connect = C::t('common_setting')->fetch('connect', true); $connect['oauth2'] = 1; C::t('common_setting')->update('connect', serialize($connect)); include_once libfile('function/cache'); updatecache('setting'); showmessage('Switch oAuth to oAuth2', $_G['siteurl']); ?>
三、將 oauth_switch.inc.php 傳到QQ互聯插件目錄(source/plugin/qqconnect)服務器
四、而後訪問 URL地址。http://你的域名/plugin.php?id=qqconnect:oauth_switch 此過程爲切換到 oAuth2 模式,如您不瞭解如何開啓此功能,請聯繫服務商解決。網絡
五、運行了會提示一段英文,告訴你已經切換完畢。切換完畢後刪除剛剛上傳的 oauth_switch.inc.php 文件,接口已經升級完成了,再試試QQ互聯是否能夠正常登錄。curl