I am using php-ldap to manage posix accounts on a linux machine. I am able to search the database in php. And I am able to add users via the command line "ldapadd". However, when I try to add a user via PHP ldap_add, I get an "Object class violation" error (errno 65).
I have tried everything I can think of, but the error has not changed. I have even looked to see if there is an alternative to php-ldap, but have not found one.
The problem is when I look up that error in the general LDAP guide, it says "This error is returned with the entry to be added or the entry as modified violates the object class schema rules. Normally additional information is returned the error detailing the violation." And then it lists 8 possible causes.
I need this more in depth error, but cannot find it. ldap_error was also no help. Any ideas how to dig deaper here?
I figured out how to dig deeper. I am using Ubuntu which was dumping logs to /var/log/{debug,syslog}
In order to get more info I had to increase the log level to 424 in /etc/ldap/slapd.d/cn=config.ldif
Then I was able to see the error in the logs which told me what I was doing wrong... using a dc attribute with an inetOrgPerson objectClass.
Thanks.
Object class violation always means the object you created violated the expectations of the schema.
slapd provides a metric ton of logging if you simply set the debug level to some arbitarily high number.
PosixAccount (the class that is needed for Linux users) has some mandatory attributes. You must provide in the same operation the:
uid
uidNumber
gidNumber
homeDirectory
Perhaps in one approach you are, one you are not?
A comment under ldap_error documentation says that to obtain additional info you can call this:
ldap_get_option($conn, LDAP_OPT_DIAGNOSTIC_MESSAGE, $err);
// $err now contains the additional info
We had the same problems, so we used the following bash command:
sudo tail -f syslog |grep slapd
So you will have an real time window to show you the detail reactions on your LDAP manipulations.
Related
So I'm setting up a sylius project using docker and am getting an error when I first tried to load the page. The docker set up on sylius website didn't seem to work so I made my own docker files and can successfully start the docker containers. The error is below:
An exception has been thrown during the rendering of a template ("Cannot find name for "en_UK" locale code").
During the installation, sylius asks whether you want en_US or something different so I typed en_UK, presuming that was the notation required. Upon setup completion, I tried to load root page and I get the error message above. However, strangely, on the symfony toolbar on the error page it says US web store.
If anyone could help at all it would be greatly appreciated. Thank you in advance.
Possible ways:
go to localhost/admin, enter your login/password which you entered at the install moment, open Channels section, and there add change default locale/add new to locale list;
modify a <project-root>/config/services.yaml and change locale value to another;
in the worst case try to run php bin/console sylius:install command and reinstall database with a en_US at the beginning, then edit Admin section to en_UK
en_UK means "English (Ukraine)". No wonder it was missing. What you wanted was probably en_GB.
I'm following the official docs to setup google cloud firestore to integrate with my php project
[1] https://cloud.google.com/firestore/docs/quickstart-servers
when I initialize the FirestoreClient I get the following error
Error rendering 'projects/{project=*}/databases/{database=*}': expected binding 'project' to match segment '{project=*}', instead got null\n
Provided bindings: Array\n
(\n
[project] => \n
[database] => (default)\n
)\n
First In the documentation it tells to use ENV VARIABLE though using the following command
export GOOGLE_APPLICATION_CREDENTIALS=/Users/user/Desktop/programming/workarea/.firebase.config.json
I investigated a lot and I think the problem happens when the library tries to establish a connection with the firestore server.
I couldn't find the root of the problem. but I think for some reason the php server not reading the env vars so it's not able to establish a proper connection
I struggled some time with this too, resolved it after realizing this: as said here, you first have to authenticate. For that, install the gcloud-sdk available here, then follow the steps provided.
Second, you have to set your environment variable with the path to your project's credentials file, as you were doing, in the bash (i use ~/.bashrc), exit the terminal and reenter it (necessary, as it may not apply the file edit for that terminal session). You could also type source .bashrc to apply changes without closing the terminal.
Then you should be fine, assuming you have the other required environment dependencies installed found here.
im trying to install Sylius with composer for an e commerce project however i just cant get it done..i follow the docs but i always get an other error when i fix one.
already fixed some errors eg. incl extension exception, paypal bundle renaming issues on git and memory size problem.
Now where im stuck:
When i fill the parameters with the interactive script
if i give any password for the database i get this:
Doctrine\DBAL\Driver\PDOException
Acces denied for user 'root'#localhost
if i dont give password then i get this:
Doctrine\DBAL\Driver\PDOException
SQLSTATE[HY000]Unknown database databasename_dev (it appends _dev prefix)
then in both cases it ends up with this: RunTimeException
An error occured when executing the ""cache:clear --no-warmup"" command
and the proccess is terminated with this exception..
i tried if i could continue with the $ cd acme
$ php app/console sylius:install commands but:
if i gave a password then get acces denied Doctrine\DBAL\Exception\ConnectionException
if didnt then Doctrine\DBAL\Driver\PDOException
SQLSTATE[HY000]Unknown database databasename_dev
i created the database manually which seems to solve the problem however get this: General error: 1007 cant create database databasename_dev; database exists
(i dont think this solution is the right one)
but after this it doesnt terminate yet and creates the database schema and then after some installation it terminates with this:
RuntimeException
The source file "C:\Users\user\acme\app/../web/bundles/cmfcreate/vendor/create/themes/midgard-tags/tags.css" does not exists
i checked the page if it may useable but got twig exception that currency not found and many components are missing from the page..
What's your workspace?
If you work on Windows with WAMP I'll give you some things to check :
set the database port to : 3306
create a new user for the database, juste for your sylius project
when you run create-project commande, in databaseport write : localhost
I hope it helps you.
I moved the installation to a different server. I updated the configfile in the var/ directory and the banners are served, but the admin interface is not working.
i get the error:
A fatal error occurred OpenX can't connect to the database. Because of
this it isn't possible to use the administrator interface
i cleaned the cache directory in var but then i get
PHP Fatal error: Call to undefined method MDB2_Error::quoteIdentifier() in /[path]/opx/lib/OA/Upgrade/VersionController.php on line 50
I dont know which version this is, but it looks like its at least 2 years old.
Is there any special cache in place im not aware of?
Any help on this would be much appreciated.
Mental note,.. if you have the db on a different server then openx it does not matter if you set the host to the ip of the db server and the port.. as long if you not set protocol=protocol !!!
this is by far the most stupidest thing i have ever seen, there is no need for a protocol config, as php always uses the socket if you set "localhost".
It's not easy to tell exactly what's wrong here, but one can make a good guess:
As we can see from the error message, there is an object in your code that doesn't implement the method quoteIdentifier().
There are mainly two possible reasons for this: Either we're calling an older or newer version of the same Class instance which doesn't implement the method. Maybe because it's deprecated or who knows. Or the object simply isn't of the expected type.
Lo and behold, if we look for an MDB2 related class that DOES implement this method, it's the class MDB2. Not MDB2_Error! So now we know the reason for the error, it's time to speculate about the root cause.
Connecting to a database with MDB2 works roughly like this:
$mdb2 =& MDB2::connect('pgsql://usr:pw#localhost/dbnam');
if (PEAR::isError($mdb2)) {
die($mdb2->getMessage());
}
There it is. We can see that $mdb2 can actually be of type MDB2_Error, in case connecting goes wrong for some reason. So that is the cause: Your code cannot connect to the DB for some reason. So the next obvious step should be checking if your db user has the correct rights and is using the correct password. I am 100% sure your admin backend doesn't use the right credentials.
I'm trying Sonar and i've got some issues with it for a php project.
I have to do it multi-module to get at least php and js analysis.
this is my sonar-project.properties:
sonar.projectKey=xxxx
sonar.projectName=xxxx
sonar.projectVersion=1.0
sonar.sourceEncoding=UTF-8
sonar.sources=
sonar.language=php
sonar.exclusions=htdocs/libraries/externals/**
sonar.phpCodesniffer.skip=true
sonar.modules=php-module,js-module
# PHP module
php-module.sonar.projectName=PHP Module
php-module.sonar.language=php
php-module.sonar.sources=
php-module.sonar.projectBaseDir=htdocs
php-module.sonar.exclusions=libraries/externals/**
# JavaScript module
js-module.sonar.projectName=JavaScript Module
js-module.sonar.language=js
js-module.sonar.sources=js
js-module.sonar.projectBaseDir=htdocs
But when i run sonar-runner, i get this error:
Exception in thread "main" org.sonar.runner.RunnerException: org.sonar.api.utils.SonarException: PHPMD execution failed with returned code '1'. Please check the documentation of PHPMD to know more about this failure
and the PHPMD error is
The parser has reached an invalid state near line "32" in file "/var/www/vhosts/dev3.xxxx.local/htdocs/libraries/externals/AvaTax4PHP/classes/ATConfig.class.php". Please check the following conditions: The keyword "parent" was used as type hint but the class "ATConfig" does not declare a parent.
But why is that happening if i've excluded the dir libraries in the project and the module?
Do i have to specify to PHPMD another list of exclusions?
For PHPMD (just as for PHP CodeSniffer, for example) you will have to specify a separate exclude pattern. You can use PHPMD's --excludeparameter for that.
Took me a while to figure it out, but you can set PHPMD's command line parameters with the following setting in your sonar-project.properties file:
sonar.phpPmd.argumentLine=--exclude libraries/externals
You can refer to this FAQ entry to know how to achieve your goal: http://docs.codehaus.org/display/SONAR/PHP+Plugin+FAQ#PHPPluginFAQ-HowdoIpreventexternaltoolsfromanalyzingsomesourcefiles
BTW, you should declare:
php-module.sonar.sources=.
, instead of:
php-module.sonar.sources=