Protocol "smb" not supported or disabled in libcurl - php

My curl version:
Array
(
[version_number] => 470785
[age] => 3
[features] => 524809
[ssl_version_number] => 0
[version] => 7.47.1
[host] => x86_64-pc-linux-gnu
[ssl_version] =>
[libz_version] => 1.2.8
[protocols] => Array
(
[0] => dict
[1] => file
[2] => ftp
[3] => gopher
[4] => http
[5] => imap
[6] => pop3
[7] => rtsp
[8] => smtp
[9] => telnet
[10] => tftp
)
)
how can I enable this protocol smb ?
curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_SMB); //not working

libcurl supports SMB since 7.40.0.
Make sure you install a libcurl version where the protocol wasn't disabled. The supported protocols list you show indicates you have a limited set. An ordinary libcurl installed from a popular Linux distro will support many more protocols, including the TLS based ones that are missing in your protocol list (HTTPS, FTPS, POP3S, IMAPS etc)
Also make sure that you build your libcurl (if you build it yourself) with a TLS library, as the SMB code needs NTLM support and the NTLM code only works using some crypto functions from one of the TLS libraries libcurl supports.
When that is done, you don't need to use CURLOPT_PROTOCOLS and CURLPROTO_SMB at all, as then libcurl will support it out of the box by default.

Fixed in 7.40.0 - January 8 2015
Changes:
http_digest: Added support for Windows SSPI based authentication
version info: Added Kerberos V5 to the supported features
Makefile: Added VC targets for WinIDN
config-win32: Introduce build targets for VS2012+
SSL: Add PEM format support for public key pinning
smtp: Added support for the conversion of Unix newlines during mail send
smb: Added initial support for the SMB/CIFS protocol
Added support for HTTP over unix domain sockets, via CURLOPT_UNIX_SOCKET_PATH and --unix-socket
sasl: Added support for GSS-API based Kerberos V5 authentication
File read not working or i dont know how to use

ok i i installed 7.43 libcurl and
Array
(
[version_number] => 469760
[age] => 3
[features] => 968605
[ssl_version_number] => 0
[version] => 7.43.0
[host] => x86_64-pc-linux-gnu
[ssl_version] => OpenSSL/1.0.2d
[libz_version] => 1.2.8
[protocols] => Array
(
[0] => dict
[1] => file
[2] => ftp
[3] => ftps
[4] => gopher
[5] => http
[6] => https
[7] => imap
[8] => imaps
[9] => ldap
[10] => ldaps
[11] => pop3
[12] => pop3s
[13] => rtmp
[14] => rtsp
[15] => smb
[16] => smbs
[17] => smtp
[18] => smtps
[19] => telnet
[20] => tftp
)
)
i can get file content from smb but how to get catalog list files ?

Related

Fatal Error Call to undefined function curl_init()

I am aware that there are other questions with a similar title, such as the following:
curl_init() function not working
However I am still not able to get curl working on my localhost and on my server.
For this case, I will focus on the server, which is a Windows Server 2019.
The version of Apache is 2.4.46.
The version of PHP is 7.4.12.
In the php.ini file, I have the following uncommented:
extension=curl
In the extension folder, I can see the following file:
php_curl.dll
On the phpinfo.php page, I don't see that curl has been enabled, which is strange. The only place I see curl is in the module.authors section, and it looks like this:
cURL | Sterling Hughes
I have already restarted the services, but I am still getting the following error:
Fatal error: Uncaught Error: Call to undefined function curl_init()
What am I doing wrong and how can I fix this?
Edit
I just added this piece of code:
echo "<pre>", print_r(get_loaded_extensions()), "</pre>";
And I get the following:
Array
(
[0] => Core
[1] => bcmath
[2] => calendar
[3] => ctype
[4] => date
[5] => filter
[6] => hash
[7] => iconv
[8] => json
[9] => SPL
[10] => pcre
[11] => readline
[12] => Reflection
[13] => session
[14] => standard
[15] => mysqlnd
[16] => tokenizer
[17] => zip
[18] => zlib
[19] => libxml
[20] => dom
[21] => PDO
[22] => openssl
[23] => SimpleXML
[24] => xml
[25] => xmlreader
[26] => xmlwriter
[27] => apache2handler
[28] => mysqli
[29] => Phar
[30] => pdo_mysql
)
1
None of which are for curl.
I was able to finally solve this issue by finding a file in my PHP root folder called libssh2.dll and copy/paste into the Apache bin folder. Once I did that, curl is now enabled, and I no longer get the error in question. I'm getting other errors, but that's for another question.

php-fpm not loading same extensions php-cli is

Using php-5.4. I'm trying to load 'oci8.so' to access the function oci_connect. When in command line, I can access said function fine. But (after reloading, restarting, and reloading) php-fpm REFUSES to load the extension.
php -r 'print_r(get_loaded_extensions()); lists oci8.
Array
(
[0] => Core
[1] => date
[2] => ereg
[3] => libxml
[4] => openssl
[5] => pcre
[6] => zlib
[7] => bz2
[8] => calendar
[9] => ctype
[10] => hash
[11] => filter
[12] => ftp
[13] => gettext
[14] => gmp
[15] => SPL
[16] => iconv
[17] => pcntl
[18] => readline
[19] => Reflection
[20] => session
[21] => standard
[22] => shmop
[23] => SimpleXML
[24] => sockets
[25] => exif
[26] => tokenizer
[27] => xml
[28] => curl
[29] => fileinfo
[30] => json
[31] => oci8
[32] => Phar
[33] => zip
[34] => mhash
)
However curl localhost/extensions.php reads
Array
(
[0] => Core
[1] => date
[2] => ereg
[3] => libxml
[4] => openssl
[5] => pcre
[6] => zlib
[7] => bz2
[8] => calendar
[9] => ctype
[10] => hash
[11] => filter
[12] => ftp
[13] => gettext
[14] => gmp
[15] => SPL
[16] => iconv
[17] => Reflection
[18] => session
[19] => standard
[20] => shmop
[21] => SimpleXML
[22] => sockets
[23] => exif
[24] => tokenizer
[25] => xml
[26] => cgi-fcgi
[27] => curl
[28] => fileinfo
[29] => json
[30] => Phar
[31] => zip
[32] => mhash
// missing oci8
// and also missing 'pcntl'??
)
Both the fpm and cli are reading the exact same php.ini. I have check and tested.
Nothing at all in any error logs.
Well not sure it is related but this happened to me on "Amazon Linux 2 AMI" so I guess could apply to "CentOS" too.
Long story short I installed composer and other php stuff.
[zzzz#stageOpenID /etc/httpd/sites-enabled]$ php -i
phpinfo()
PHP Version => 7.2.30
System => Linux stageOpenID 4.14.177-139.254.amzn2.x86_64 #1 SMP Thu May 7 18:48:23 UTC 2020 x86_64
Build Date => May 5 2020 18:04:39
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /etc/php.ini
Scan this dir for additional .ini files => /etc/php.d
Additional .ini files parsed =>
So far so good.
And now to the web.
From phpinfo.php:
PHP Version: 7.2.30
System: Linux stageOpenID 4.14.177-139.254.amzn2.x86_64 #1 SMP Thu May 7 18:48:23 UTC 2020 x86_64
Build Date: May 5 2020 18:06:20
Server API: FPM/FastCGI
Virtual Directory Support: disabled
Configuration File (php.ini) Path: /etc
Loaded Configuration File: /etc/php.ini
Scan this dir for additional .ini files /etc/php.d
Additional .ini files parsed
But the lists are different.
Why? Simply because after the yum installation I restarted httpd but I forgot to restart php-fpm, so php-cli got the new modules and php-fpm didn't.
So, don't forget to:
sudo systemctl restart php-fpm
Depending how you have installed PHP FPM but, On Debian CLI and FPM use different ini files try:
php -i | grep php.ini
Mines is /etc/php/7.0/cli/php.ini
and
<?php phpinfo(); ?>
Mine is /etc/php/7.0/fpm/php.ini
Hope this helps.

Google app engine for PHP does not load mysql

i am completely new to Google app engine. Im trying to host my wordpress blog using app engine. I tried some simple PHP scripts with app engine and everything goes well. But when i tried to load wordpress using app engine in my windows system, It is showing the error as,
"Your PHP installation appears to be missing the MySQL extension which is required by WordPress."
So i printed the loaded extensions in PHP using the get_loaded_extensions() php function, which outputs as follows,
Array
(
[0] => Core
[1] => bcmath
[2] => calendar
[3] => ctype
[4] => date
[5] => ereg
[6] => filter
[7] => ftp
[8] => hash
[9] => iconv
[10] => json
[11] => mcrypt
[12] => SPL
[13] => odbc
[14] => pcre
[15] => Reflection
[16] => session
[17] => standard
[18] => mysqlnd
[19] => tokenizer
[20] => zip
[21] => zlib
[22] => libxml
[23] => dom
[24] => PDO
[25] => Phar
[26] => SimpleXML
[27] => wddx
[28] => xml
[29] => xmlreader
[30] => xmlwriter
[31] => cgi-fcgi
[32] => mhash
)
which shows that mysql is not loaded and i couldn't find any way to install it seperately since app engine does not allows it. But in app engine's documentation here, it is given that they are enabling mysql in app engine. So why the app engine not loading some extensions which is enabled by Google or is there any way to enable it manually? I don't know how to proceed further. Please help..
Note: I'm using Windows 7
That looks like the output from php installed on your machine, not the php in the app engine production environment.
You should be able to configure mysql to run locally following the instructions here: -> http://php.net/manual/en/mysql.installation.php
To see what extensions are available in production, run get_loaded_extensions() in the php shell here -> http://php-minishell.appspot.com/

SSL issue with cURL after moving to a new server

I'm using cURL to send some data using CURLOPT_POST. Same code was working fine before but after moving to a new server cURL is not working anymore via https. The guys from the other site (domain.com) sent me the log files and nothing was received by them. Then I tried to get an error with curl_error() and I was faced with a SSL problem but don't know how to fix it.
Code:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'https://track.domain.com/api.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $param);
curl_exec($ch);
$error = curl_error($ch);
curl_close($ch);
The error is:
SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
I searched for this on Google but couldn't understand what the problem is.
Do I need SSL certificate for our domain? I'm not sure if there was SSL in the old server. Is you can see from the code, I don't need return. So, should I have SSL, too, in this case?
Do I need domain.com's certificate?
Do I need contacting the hosting company for recompiling cURL with SSL support?
Any ideas?
Note: I don't want a workaround by setting CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST to false.
curl_version():
Array
(
[version_number] => 464896
[age] => 3
[features] => 34333
[ssl_version_number] => 0
[version] => 7.24.0
[host] => i686-pc-linux-gnu
[ssl_version] => OpenSSL/0.9.8b
[libz_version] => 1.2.3
[protocols] => Array
(
[0] => dict
[1] => file
[2] => ftp
[3] => ftps
[4] => gopher
[5] => http
[6] => https
[7] => imap
[8] => imaps
[9] => pop3
[10] => pop3s
[11] => rtsp
[12] => smtp
[13] => smtps
[14] => telnet
[15] => tftp
)
)
downloaded Mozilla's bundle file, named it mozilla.pem
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,true);
curl_setopt($ch,CURLOPT_CAINFO,'mozilla.pem');
The issue is your CA (Certificate Authority) list doesn't have the issuer of the remote site certificate. This method will not fix if your trying to connect to a server who has a self singed certificate.

Localhost extensions check

I have to install big CMS on my localhost, but it requires mcrypt, and pdo_mysql. Before I've tried to install them, I've tried to access site, but I only got blank page.
I'm running apache on windows, so I heard that I have to keep dll's in php extension folder. I've downloaded from dlldll.com (it's not ad) files php_pdo_mysql.dll, and php_mcrypt.php.
In php.ini I've uncommented lines "extension=php_mcrypt.dll", and "extension=php_pdo_mysql.dll". I've restarted apache... Blank again. And what now?
This is my get_loaded_extensions:
Array
(
[0] => bcmath
[1] => calendar
[2] => com_dotnet
[3] => ctype
[4] => session
[5] => filter
[6] => ftp
[7] => hash
[8] => iconv
[9] => json
[10] => odbc
[11] => pcre
[12] => Reflection
[13] => date
[14] => libxml
[15] => standard
[16] => tokenizer
[17] => zlib
[18] => SimpleXML
[19] => dom
[20] => SPL
[21] => wddx
[22] => xml
[23] => xmlreader
[24] => xmlwriter
[25] => apache2handler
[26] => curl
[27] => gd
[28] => mbstring
[29] => mysql
[30] => mysqli
[31] => rar
[32] => zip
[33] => eAccelerator
)
What I did wrong?
Update:
Some progress - now I have PHP startup warning on apache restart. "Unble to load php_mcrypt.dll/php_pdo_mysql.dll" - but I have those files in this directory. Is it possible that corrupted are for PHP same as non existing?
make sure you have following two options set in php.ini
By default error reporting is Off and you get blank page.
error_reporting = E_ALL & ~E_DEPRECATED
display_errors = On

Categories