PHP 7 connect mariadb with pam_auth cause unknown authentication method - php

I'm running mariadb 10.2 in ubuntu 16.04. The mariadb will perform external authentication using freeipa (ldap+kerberos). I can connect mariadb server with mariadb client, using freeipa credential. Everything work as usual. The /etc/pam.d/mariadb as below:
auth required pam_unix.so
account required pam_unix.so
auth required pam_user_map.so
However, when I'm connect using php7 mysqli (command line or web), it return:
(
[affected_rows] =>
[client_info] =>
[client_version] => 50012
[connect_errno] => 2054
[connect_error] => The server requested authentication method unknown to the client
[errno] =>
[error] =>
[error_list] =>
[field_count] =>
[host_info] =>
[info] =>
[insert_id] =>
[server_info] =>
[server_version] =>
[stat] =>
[sqlstate] =>
[protocol_version] =>
[thread_id] =>
[warning_count] =>
)
From lot of research I'm notice that php mysql driver doesn't support PAM authentication well. There is online resources http://www.sheeri.org/ldap-with-auth_pam-and-php/ tell me that there is a way to overcome it, but it too rough. Can somebody tell me how to rebuild for ubuntu with libmariadbclient? I can't find /usr/bin/mysql_config anyway.
Thanks

I'd greatly simplified the solution, I'd create basic bash script for ubuntu. It will use default apache2/php/percona server/client by only override mysqli.so, pdo_mysql.so.
https://gist.github.com/kstan79/367ef928e44523904fb36b67a92decdd

Related

Protocol "smb" not supported or disabled in libcurl

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 ?

oci_connect() only works on cli

Ive installed httpd and httpd-devel packages and installed php and php-devel on a server. I downloaded and installed the basic client and sdk for oracle and then proceeded to use PECL to install OCI8 extension.
When I try running the oci_connect function page on CLI, It works fine. But when I try to load the same php page over http, i get the following error:
Fatal error: Call to undefined function oci_connect() in /var/www/html/index.php on line 10
I have compared the php ini from both and notice that /etc/php.d/oci8.ini file is loaded in the cli and the http version
however, the module details are only available on the cli version:
oci8
OCI8 Support => enabled
OCI8 DTrace Support => disabled
OCI8 Version => 2.0.8
Revision => $Id: f04114d4d67cffea4cdc2ed3b7f0229c2caa5016 $
Oracle Run-time Client Library Version => 12.1.0.2.0
Oracle Compile-time Instant Client Version => 12.1
Directive => Local Value => Master Value
oci8.connection_class => no value => no value
oci8.default_prefetch => 100 => 100
oci8.events => Off => Off
oci8.max_persistent => -1 => -1
oci8.old_oci_close_semantics => Off => Off
oci8.persistent_timeout => -1 => -1
oci8.ping_interval => 60 => 60
oci8.privileged_connect => Off => Off
oci8.statement_cache_size => 20 => 20
I cant for the life of me figure out why only one loads the extension properly when they both have the same configuration file.
Thanks for any help!
I managed to fix this by disabling SELINUX

Install OwnCloud with PostgreSQL - Not Authenticating on Ubuntu 12.04LTS

Okay all I have tried to follow the instructions online for getting Postgresql to work with OwnCloud install but it still gives me the dreaded "PostgreSQL username and/or password not valid You need to enter either an existing account or the administrator."
I have installed:
Ubuntu 12.04LTS
Apache 2.2
PHP 5.3
PostgreSql 9.3
OwnCloud 6.0.3
My web server is hosted on an internal server at 192.168.1.11 and I have Postgresql running on port 3145.
Any tips on getting this to work with Postgresql... Here is my config.php file:
$CONFIG = array (
'instanceid' => 'oc57c67b8ac3',
'passwordsalt' => '07b04cab4ff3d074dc59fc3ef82650',
'trusted_domains' =>
array (
0 => 'www.example.com',
),
'datadirectory' => '/Cloud/owncloud/data',
'dbtype' => 'pgsql',
'version' => '6.0.3.1',
'dbname' => 'owncloud',
'dbuser' => 'cloudadm',
'dbpassword' => 'mypassword',
'dbhost' => '192.168.1.11:3145',
'dbtableprefix' => 'oc_',
);
Per #RandolphCarter -- when I upgraded to OwnCloud7.0 I was able to use the wizard, select the PostgreSQL option and enter [serverip]:[Postgresql port number] - e.g. -- 192.1.1.1:1118 and it worked with no problems. This is closed.
For some reason setup wizard searching localhost and found no IPv6 record in my pg_hba.conf After add this record it works.
host all all ::1/128 md5
or remove ::1 from /etc/hosts should be the same.
::1 localhost

SQLSRV driver installed but shows error while connecting to MSSQL 2008 R2 db using PHP

I have a laptop running with windows 7 Professional, MSSQL 2008 R2 and IIS 7.5. The system has all my applications in c# and php running successfully.
Now I wanted to transfer all my files and apps on a 2nd laptop with windows 7 Ultimate.
But for some reason I just cannot get a successful connection to my db even though phpinfo() shows sqlsrv installed and I am using the exact same code just changing the connection string of the DB.
I have MSSQL management Studio v 10.50.2500
IIS v 7.5.7600.16385
PHP v 5.5.3
SQLSRV Driver for php 5.5 (its not an official MS release , but its quite popular and works on my previous laptop )
I am getting an error like :
Array (
[0] => Array (
[0] => IMSSP [SQLSTATE] => IMSSP
[1] => -49 [code] => -49
[2] => This extension requires the Microsoft SQL Server 2012 Native Client. Access the following URL to download the Microsoft SQL Server 2012 Native Client ODBC driver for x86: http://go.microsoft.com/fwlink/?LinkId=163712
[message] => This extension requires the Microsoft SQL Server 2012 Native Client. Access the following URL to download the Microsoft SQL Server 2012 Native Client ODBC driver for x86: http://go.microsoft.com/fwlink/?LinkId=163712
)
[1] => Array (
[0] => IM002 [SQLSTATE] => IM002
[1] => 0 [code] => 0
[2] => [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
[message] => [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
)
)
my PHP code is as follows (which i know for a fact it works on the first laptop) :
`$serverName = "DELL-PC"; //serverName\instanceName`
``
`$connectionInfo = array( "Database"=>"amlTest");`
`$conn = sqlsrv_connect( $serverName, $connectionInfo);`
I just cannot figure out what is the problem or where am I missing out?
I really need this working!! and have spent far too much time re-installing all my softwares and trying out all php versions.
I hope its not because of the difference in windows version
Also, Sorry if I have made any mistake formatting my question, as this is my first post.
Have you installed the feature pack?
http://microsoft.com/en-us/download/details.aspx?id=29065
A hint from the error tells us that you need the 2012 version of the MS SQL Server for this to work. Also make sure your Server permissions are set correctly.

How to connect SQL server 2008 R2 in php 5.4 with xampp

I am using Xampp with Php 5.4 (Zend studio) and download sqlserver driver download V3.0 for php 5.4
I followed this URL.
I Configured all steps above URL but still I cannot connection open and error came..
Connection could not be established.
Array ( [0] => Array ( [0] => 08001 [SQLSTATE] => 08001 [1] => 53 [code] => 53 [2] => [Microsoft][SQL Server Native Client 11.0]Named Pipes Provider: Could not open a connection to SQL Server [53]. [message] => [Microsoft][SQL Server Native Client 11.0]Named Pipes Provider: Could not open a connection to SQL Server [53]. ) [1] => Array ( [0] => HYT00 [SQLSTATE] => HYT00 [1] => 0 [code] => 0 [2] => [Microsoft][SQL Server Native Client 11.0]Login timeout expired [message] => [Microsoft][SQL Server Native Client 11.0]Login timeout expired ) [2] => Array ( [0] => 08001 [SQLSTATE] => 08001 [1] => 53 [code] => 53 [2] => [Microsoft][SQL Server Native Client 11.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. [message] => [Microsoft][SQL Server Native Client 11.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct enter code here and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. ))
Please give solution for above issue.
Go to Start \ Microsoft SQL Server 2008 \ Configuration Tools \ SQL Server Configuration Manager,then SQL Native Client Configuration, Client Protocols and check that shared memory, tcp/ip and named pipes are enabled.
I`m writing this as an answer because I cant comment yet.
(Don't mean to resurrect an old post, but just in case others are looking for the answer, and because this post came up during my search...)
A short step-by-step guide to connect to SQL_server from PHP on XAMPP using native driver:
First of all download PHP for SQL_server Microsoft native driver from http://www.microsoft.com/en-us/download/details.aspx?id=20098 Take care to choose the one that fits your setup.
Install it to the PHP extension directory (typically in c:\xampp\php\ext).
Configure the new extension in PHP.ini (typically in C:\xampp\php) by uncommenting or appending the line (depending on the choosen driver version). I.e.:
extension = php_sqlsrv_55_ts.dll
Restart Apache from XAMPP control panel (stop + start).
Now your PHP setup is able to connect to SQL_server databases. Adapt following code to test it with your own database:
<?php
$server = "SERVER\SQLEXPRESS";
$database = "test_database";
$user = "test_user";
$pwd = "test_password";
$options = array( "UID" => $user, "PWD" => $pwd, "Database" => $database);
$conn = sqlsrv_connect($server, $options);
if ($conn === false) {
die("<pre>".print_r(sqlsrv_errors(), true));
}
echo "Successfully connected!";
$sql = "SELECT TOP 50 * FROM dbo.table_name";
$query = sqlsrv_query($conn, $sql);
if ($query === false) {
exit("<pre>".print_r(sqlsrv_errors(), true));
}
while ($row = sqlsrv_fetch_array($query)) {
echo "<p>$row[field1] $row[field2]</p>";
}
sqlsrv_free_stmt($query);
sqlsrv_close($conn);
Tested from XAMPP 3.2.1 and XAMPP 5.6.14 on SQL_server 2008 R2 and SQL_server 2014 express.

Categories