I running litespeed 5.1.11
on my Centos 6.8
VPS (PHP 5.6.29). I use cUrl
in my php code. 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:
'./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'
After you compiled your PHP, you should get both lsphp and php binaries. 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/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.
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. Installation is much easier and it should get your right.
https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:php:rpm
I solve my problem. I should just add this to Configure Parameters
.
'--exec-prefix=/usr' '--with-exec-dir=/usr/bin'
Now I compile my php with this Configure Parameters:
--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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.