簡體   English   中英

litespeed-致命錯誤:調用未定義函數curl_init()

[英]litespeed - Fatal error: Call to undefined function curl_init()

我在Centos 6.8 VPS(PHP 5.6.29)上運行litespeed 5.1.11 我在PHP代碼中使用cUrl 當我通過瀏覽網頁來運行代碼時,一切正常,但是當我使用命令運行時,它給了我錯誤:
Fatal error: Call to undefined function curl_init()
我該如何解決?

我用以下配置參數編譯我的PHP:

'./configure''--prefix = / usr / local / lsws / lsphp5''--disable-fileinfo''--with-bz2''--enable-zip''--with-curl''- with-mysql''--with-mysql-sock''--with-sqlite''--with-tidy''--with-xpm-dir''--enable-pdo''--with-pdo- sqlite''--with-pdo-mysql''--enable-bcmath''--enable-calendar''--enable-ftp''--enable-gd-native-ttf''--enable-libxml' '--enable-soap''--with-gettext''--with-jpeg-dir = / usr''--with-kerberos''--with-mcrypt''--with-mysqli''- with-openssl''--with-pic''--with-png-dir''--with-zlib''--with-pcre-regex''--with-gd''--enable-shmop' '--enable-track-vars''--enable-sockets''--enable-sysvsem''--enable-sysvshm''--enable-magic-quotes''--enable-mbstring''- -iconv''--enable-json''--with-litespeed'

phpinfo中的cUrl部分: phpinfo

編譯PHP之后,您應該同時獲得lsphp和php二進制文件。 如果前綴為/ usr / local / lsws / lsphp5,則已編譯的二進制文件應位於/ usr / local / lsws / lsphp5 / bin /中,然后對於CLI,請嘗試將php與代碼一起使用。

/ usr / local / lsws / lsphp5 / bin / php /my/code.php

/ usr / local / bin / lsphp或/ usr / local / bin / php看起來不像您編譯的那樣,因為它們不在前綴文件夾下。

另外,我不知道您是否有任何特殊理由自己編譯PHP,因為大多數人只會使用LiteSpeed存儲庫或Remi存儲庫中的RPM軟件包。 安裝要容易得多,它應該使您正確。

https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:php:rpm

我解決了我的問題。 我應該將其添加到Configure Parameters

'--exec-prefix = / usr''--with-exec-dir = / usr / bin'

現在,我使用以下配置參數來編譯我的PHP:

--disable-fileinfo --with-bz2 --enable-zip --with-curl --with-mysql --with-mysql-sock --with-sqlite --with-tidy --with-xpm-dir- -enable-pdo --with-pdo-sqlite --with-pdo-mysql --enable-bcmath --enable-calendar --enable-ftp --enable-gd-native-ttf --enable-libxml --enable -soap --with-gettext --with-jpeg-dir = / usr --with-kerberos --with-mcrypt --with-mysqli --with-openssl --with-pic --with-png-dir- -with-zlib --with-pcre-regex --with-gd --enable-shmop --enable-track-vars --enable-sockets --enable-sysvsem --enable-sysvshm --enable-magic-quotes --enable-mbstring --with-iconv --enable-exif --enable-ucd-snmp-hack --enable-xml --enable-json --libdir = / usr / lib64 --with-libdir = lib64- -exec-prefix = / usr --with-exec-dir = / usr / bin --with-freetype-dir = / usr --with-pcre-regex = / usr --with-gmp --with-layout = GNU --with-system-tzdata --with-apxs2 = / usr / sbin / apxs --with-libxml-dir = / usr

現在,我使用/usr/bin/lsphp /my/code.phpphp /my/code.php通過命令行運行我的代碼。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM