繁体   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