简体   繁体   English

litespeed-致命错误:调用未定义函数curl_init()

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

I running litespeed 5.1.11 on my Centos 6.8 VPS (PHP 5.6.29). 我在Centos 6.8 VPS(PHP 5.6.29)上运行litespeed 5.1.11 I use cUrl in my php code. 我在PHP代码中使用cUrl When I run my code with browsing as a web page every thing work fine, but when I run with command it gave me error: 当我通过浏览网页来运行代码时,一切正常,但是当我使用命令运行时,它给了我错误:
Fatal error: Call to undefined function curl_init()
How can I fix it? 我该如何解决?

I Compile my php with this configure parameters: 我用以下配置参数编译我的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' '--with-iconv' '--enable-json' '--with-litespeed' './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'

And cUrl section in phpinfo: phpinfo中的cUrl部分: phpinfo

After you compiled your PHP, you should get both lsphp and php binaries. 编译PHP之后,您应该同时获得lsphp和php二进制文件。 If the prefix was /usr/local/lsws/lsphp5, Your compiled binaries should be in /usr/local/lsws/lsphp5/bin/, then for CLI, try php with your code. 如果前缀为/ usr / local / lsws / lsphp5,则已编译的二进制文件应位于/ usr / local / lsws / lsphp5 / bin /中,然后对于CLI,请尝试将php与代码一起使用。

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

/usr/local/bin/lsphp or /usr/local/bin/php does not look like the one your compiled since they are not under prefix folder. / usr / local / bin / lsphp或/ usr / local / bin / php看起来不像您编译的那样,因为它们不在前缀文件夹下。

Also, I don't know if you have any particular reason to compile PHP by yourself since most of the people would just use RPM packages either from LiteSpeed repository or Remi repository. 另外,我不知道您是否有任何特殊理由自己编译PHP,因为大多数人只会使用LiteSpeed存储库或Remi存储库中的RPM软件包。 Installation is much easier and it should get your right. 安装要容易得多,它应该使您正确。

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

I solve my problem. 我解决了我的问题。 I should just add this to Configure Parameters . 我应该将其添加到Configure Parameters

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

Now I compile my php with this Configure Parameters: 现在,我使用以下配置参数来编译我的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 --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

Now, I use /usr/bin/lsphp /my/code.php or php /my/code.php to run my code with command line. 现在,我使用/usr/bin/lsphp /my/code.phpphp /my/code.php通过命令行运行我的代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM