I have a .ldif file and want to import it using php script to my ldap.
So, i'm using that code:
$comm = "ldapadd -h 'localhost' -p 389 -D 'cn=admin,dc=example,dc=com' -w 'password' -f /var/www/html/test/ldap.ldif";
system($comm,$return);
echo $return;
I'm always getting error code 13 which is:
LDAP_CONFIDENTIALITY_REQUIRED: Indicates that the session is not protected by a protocol such as Transport Layer Security (TLS), which provides session confidentiality.
Looking at ldapadd sintax found these options
-W: Wallet location for one- or two-way SSL authentication
-P Wallet password
-U SSL authentication mode: 1 for no authentication; 2 for one-way authentication; 3 for two-way authentication
But I don't know how or when I have to use them.
My .ldif file contain a lot of new entrys and through php code I couldn't use the:
$info["dn"] = $test;
Always getting errors about that $info["dn"] syntax, so then I gave up and start trying with terminal command.
Would really appreciate some help about it and sorry about my english.
Thank you.
A friend of mine found the answer.
About the code 13 error was missing an option at the end of the command which allows the TLS connection, so, the correct command line is:
ldapadd -h 'localhost' -p 389 -D 'cn=admin,dc=example,dc=com' -w 'password' -f /var/www/html/test/ldap.ldif -Z
So, the option -Z or -ZZ at the end enables the TLS and the error is gone, so it's working the input on ldap with my .ldif file
Thank you all.
Related
I'm trying to use the "php artisan db" command and I'm getting this error. How can I fix it? I've already seen some similar problems, but none of them helped me.
PS C:\Users\Alisson\Documents\Programming stuff\study\first-laravel-crud> php artisan db
Symfony\Component\Process\Exception\RuntimeException
TTY mode is not supported on Windows platform.
at C:\Users\Alisson\Documents\Programming stuff\study\first-laravel-crud\vendor\symfony\process\Process.php:1059
1055▕ */
1056▕ public function setTty(bool $tty)
1057▕ {
1058▕ if ('\\' === \DIRECTORY_SEPARATOR && $tty) {
➜ 1059▕ throw new RuntimeException('TTY mode is not supported on Windows platform.');
1060▕ }
1061▕
1062▕ if ($tty && !self::isTtySupported()) {
1063▕ throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.');
1 C:\Users\Alisson\Documents\Programming stuff\study\first-laravel-crud\vendor\laravel\framework\src\Illuminate\Database\Console\DbCommand.php:41
Symfony\Component\Process\Process::setTty()
2 C:\Users\Alisson\Documents\Programming stuff\study\first-laravel-crud\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:36
Illuminate\Database\Console\DbCommand::handle()
The real answer is to use Linux for development, which is (I assume) fairly easily done using Windows' built-in facilities.
But, all php artisan db does is call the MySQL command line, which you can do yourself. Check your .env file to get values for the host, username, and password. Then fill them into this command:
mysql -h host -u username -ppassword
Note the missing space after -p is intentional.
This is not about 'localhost'. Both the command line version of 'mysql' as well as a script I wrote in Perl (using perl-DBD-MySQL) can login, get to this database and work with it. Only PHP gives the permission denied error, and that error is not reported in any of the various log files. I even went as far as creating a simple test user in the database to avoid any issues with special characters in the password:
create user 'web'#'%' identified by 'Iamnotarobot';
and again the command line can login with this credential but PHP says permission denied.
I don't know what is throwing the error so I can't address it. I'm literally lost.
Relevant info:
RHEL 8 = 4.18.0
php 7.2.11
nginx 1.14.1
And here's the actual code that's failing:
<?php
$host="core";
$user="web";
$pass="Iamnotarobot";
$db="mydb";
$conn = new mysqli($host,$user,$pass,$db);
if( $conn->connect_errno ) {
exit($conn->connect_errno);
}
?>
It turned out to be an selinux issue. Here's how I fixed it:
setsebool -P httpd_can_network_connect_db 1
Now with setenforce back to '1', the page can connect to the database.
Check with php-mysql package installation.
If perl can connect remotely and php could not...the issue is with php-mysql installation only.
I have installed php-libvirt as well as all required packages (I tried the remi rpm and compiling).
I have setup my php file as follows:
<?php
print_r ( libvirt_version() );
echo '<br>';
$uri="qemu+tcp:///system";
$credentials=array(VIR_CRED_AUTHNAME=>"fred",VIR_CRED_PASSPHRASE=>"fred");
echo ("Connecting to libvirt (URI:$uri)<BR>");
$conn=libvirt_connect($uri,false,$credentials);
if ($conn==false)
{
echo ("Libvirt last error: ".libvirt_get_last_error()."<br>");
exit;
} else {
$hostname=libvirt_get_hostname($conn);
echo ("hostname:$hostname<br>");
?>
However when I load the page I get:
Array ( [libvirt.release] => 2 [libvirt.minor] => 10 [libvirt.major] => 0 [connector.version] => 0.4.8 [connector.major] => 0 [connector.minor] => 4 [connector.release] => 8 )
Connecting to libvirt (URI:qemu+tcp:///system)
Libvirt last error: unable to connect to server at 'localhost:16509': Permission denied
It works fine from the command line when I run
# virsh -c qemu+tcp:///system list
Please enter your authentication name: fred
Please enter your password:
Id Name State
----------------------------------------------------
I have tried the command line from another server to make sure it would work remotely and it was fine.
I have tried fred#hostname and that didn't work. I have tried VIR_CRED_USERNAME and that also didn't work.
What could be the issue?
By default authentication mechanism for libvirtd TCP connection is SASL. Till now TCP connection is listening and now we have to configure SASL based authentication. Edit /etc/libvirt/libvirtd.conf, they are using auth_tcp = "none", but use auth_tcp = "sasl" if not done already. Now execute the following command.
sudo saslpasswd2 -a libvirt fred
Password: fred
Again (for verification): fred
In your case libvirtd is listening for a TCP connection, but some time we need to make some changes to make it listen on the given port. First link in the references will be useful for that.
References:
https://askubuntu.com/questions/423425/i-cant-use-libvirt-with-listen-tcp
http://libvirt.org/auth.html#ACL_server_username
https://www-01.ibm.com/support/knowledgecenter/linuxonibm/liabp/liabpkvmsecsrmsasl.htm
Using the following bits:
<?php
require('vendor/autoload.php');
$client = new Everyman\Neo4j\Client('localhost', 7474);
print_r($client->getServerInfo());
?>
If I run this as php test.php I get the expected output.
If I run this via http://server/test.php I get connection errors.
[24-Jun-2014 05:49:52] PHP Fatal error: Uncaught exception 'Everyman\Neo4j\Exception'
with message 'Can't open connection to http://localhost:7474/db/data/' in
/var/www/html/vendor/everyman/neo4jphp/lib/Everyman/Neo4j/Transport/Curl.php:91
Clearly I've monkeyed up something with either my PHP config or the installation of this library. Suggestions on where to look?
Installed per these instructions.
Running on CentOS 6.4 (x64), PHP 5.3.3
NOTE: I've made successful connections from other machines back to this server so I know the neo4j server is working. It just doesn't seem to want to let me connect locally when called via browser.
I had same issue, it was caused by SeLinux
Try disabling it by:
echo 0 >/selinux/enforce
then recheck connection.
If solved configure SeLinux permissions.
In my case httpd_can_network_connect should be on
setsebool -P httpd_can_network_connect on
echo 1 >/selinux/enforce
Helpful manual:
http://wiki.centos.org/TipsAndTricks/SelinuxBooleans
I just wanted to take a look at Mongo-DB. But i just don't get it running. I've installed it with PECL and my phpinfo() tells me that the extension is loaded, but when i try to get a connection with
$mongo = new Mongo();
I get this:
Fatal error: Uncaught exception 'MongoConnectionException' with
message ': Transport endpoint is not connected'
Anybody have the same Problem? ... Or any Idea on this?
Please don't take this the wrong way, but have you actually got the server running? Only it looks like your error relates to a failure to connect and you've made no mention of the server or where it is located (localhost on the default port for example)
any server start method, such as "/etc/init.d/mongodb start" or "service start mongodb" will fail, if a stale lock file still exists. In Ubuntu/Debian this is /var/lib/mongodb/mongod.lock. Look for this and delte it, if it exists and seems to be an old one.
check out whether server is running or not..
/etc/init.d/mongodb start
then go to
root#kannan-desktop:~# mongo
MongoDB shell version: 1.6.3
connecting to: test
>
Don't forget to change the IP in your mongod.conf if it's a new installation.
custom string looks like that
mongodb://username:password#host:port/database
First Change the Default db path by following command
$ sudo mkdir -p /data/db/
$ sudo chown id -u /data/db
and then the final command is..
$ mongod --journal
Do not close terminal until you are working with mongoDB
It works for me...
just write mongod in your terminal and will work well