Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse error: syntax error, unexpected '}' in /container/service/phpldapadmin/assets/config.php on line 68 #23

Closed
typekpb opened this issue Jun 7, 2016 · 17 comments

Comments

@typekpb
Copy link
Contributor

typekpb commented Jun 7, 2016

running in docker-compose, relevant section is:

 phpldapadmin:
    image: osixia/phpldapadmin:0.6.8
    container_name: phpldapadmin_container
    depends_on:
    - ldap
    ports:
      - "8092:80"
    environment:
      - PHPLDAPADMIN_LDAP_HOSTS=ldap
      - PHPLDAPADMIN_HTTPS=false

docker-compose up output (filtered for specific container):

phpldapadmin_container | *** CONTAINER_LOG_LEVEL = 3 (info)
phpldapadmin_container | *** Search service in CONTAINER_SERVICE_DIR = /container/service :
phpldapadmin_container | *** link /container/service/:apache2/startup.sh to /container/run/startup/:apache2
phpldapadmin_container | *** link /container/service/:apache2/process.sh to /container/run/process/:apache2/run
phpldapadmin_container | *** link /container/service/:cfssl/startup.sh to /container/run/startup/:cfssl
phpldapadmin_container | *** link /container/service/:cron/startup.sh to /container/run/startup/:cron
phpldapadmin_container | *** link /container/service/:cron/process.sh to /container/run/process/:cron/run
phpldapadmin_container | *** link /container/service/:logrotate/startup.sh to /container/run/startup/:logrotate
phpldapadmin_container | *** link /container/service/:php5-fpm/startup.sh to /container/run/startup/:php5-fpm
phpldapadmin_container | *** link /container/service/:php5-fpm/process.sh to /container/run/process/:php5-fpm/run
phpldapadmin_container | *** link /container/service/:syslog-ng-core/startup.sh to /container/run/startup/:syslog-ng-core
phpldapadmin_container | *** link /container/service/:syslog-ng-core/process.sh to /container/run/process/:syslog-ng-core/run
phpldapadmin_container | *** link /container/service/ldap-client/startup.sh to /container/run/startup/ldap-client
phpldapadmin_container | *** link /container/service/phpldapadmin/startup.sh to /container/run/startup/phpldapadmin
phpldapadmin_container | *** Set environment for startup files
phpldapadmin_container | *** Environment files will be proccessed in this order : 
phpldapadmin_container | Caution: previously defined variables will not be overriden.
phpldapadmin_container | /container/environment/99-default/default.yaml
phpldapadmin_container | 
phpldapadmin_container | To see how this files are processed and environment variables values,
phpldapadmin_container | run this container with '--loglevel debug'
phpldapadmin_container | *** Running /container/run/startup/:apache2...
phpldapadmin_container | *** Running /container/run/startup/:cfssl...
phpldapadmin_container | *** Running /container/run/startup/:cron...
phpldapadmin_container | *** Running /container/run/startup/:logrotate...
phpldapadmin_container | *** Running /container/run/startup/:php5-fpm...
phpldapadmin_container | *** Running /container/run/startup/:syslog-ng-core...
phpldapadmin_container | *** Running /container/run/startup/ldap-client...
phpldapadmin_container | No certificate file and certificate key provided, generate:
phpldapadmin_container | /container/service/ldap-client/assets/certs/ldap-client.crt and /container/service/ldap-client/assets/certs/ldap-client.key
phpldapadmin_container | 2016/06/07 10:35:23 [INFO] generate received request
phpldapadmin_container | 2016/06/07 10:35:23 [INFO] received CSR
phpldapadmin_container | 2016/06/07 10:35:23 [INFO] generating key: ecdsa-384
phpldapadmin_container | 2016/06/07 10:35:23 [INFO] encoded CSR
phpldapadmin_container | 2016/06/07 10:35:23 [INFO] signed certificate with serial number 561322734675630577092912973942148232864250094169
phpldapadmin_container | Link /container/service/:cfssl/assets/default-ca/default-ca.pem to /container/service/ldap-client/assets/certs/ldap-ca.crt
phpldapadmin_container | *** Running /container/run/startup/phpldapadmin...
phpldapadmin_container | Set apache2 http config...
phpldapadmin_container | *** Set environment for container process
phpldapadmin_container | *** Environment files will be proccessed in this order : 
phpldapadmin_container | Caution: previously defined variables will not be overriden.
phpldapadmin_container | /container/environment/99-default/default.yaml
phpldapadmin_container | 
phpldapadmin_container | To see how this files are processed and environment variables values,
phpldapadmin_container | run this container with '--loglevel debug'
phpldapadmin_container | *** Running runit daemon...
phpldapadmin_container | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.3. Set the 'ServerName' directive globally to suppress this message
phpldapadmin_container | Jun  7 10:35:24 d14a473aa845 syslog-ng[1475]: syslog-ng starting up; version='3.5.6'

however, once started and navigating to http://localhost:8092/, I see:

Parse error: syntax error, unexpected '}' in /container/service/phpldapadmin/assets/config.php on line 68

I checked the contents of the specific file:

docker exec phpldapadmin_container tail /container/service/phpldapadmin/assets/config.php 

/*********************************************
 * Define your LDAP servers in this section  *
 *********************************************/

$servers = new Datastore();

/*
 * Autogenerated servers variables will come here
 */
{{ PHPLDAPADMIN_SERVERS }}

The problematic line referred to is the last one.
How can I fix it?

@lcotonea
Copy link

lcotonea commented Jun 13, 2016

I have the same problem.

To go further, when I ran "docker exec ...", the environment variable "PHPLDAPADMIN_SERVERS" is well set.

It's maybe a problem with the startup.sh call?

Problem detected on 0.6.9, 0.6.8 versions. The 0.6.7 version is working.

@typekpb
Copy link
Contributor Author

typekpb commented Jun 13, 2016

@lcotonea thanks for the version hint!

Seems to be a regression. downgrading to 0.6.7 locally, until fix arrives.

@osixia
Copy link
Collaborator

osixia commented Jun 13, 2016

hi guys,
i tried with this docker-compose.yml :

version: '2'
services:
  ldap:
    image: osixia/openldap
    container_name: openldap_container
  phpldapadmin:
    image: osixia/phpldapadmin:0.6.9
    container_name: phpldapadmin_container
    depends_on:
    - ldap
    ports:
      - "8092:80"
    environment:
      - PHPLDAPADMIN_LDAP_HOSTS=ldap
      - PHPLDAPADMIN_HTTPS=false

everything seems ok. Could you provide your docker-compose.yml files ?
Thanks.

@lcotonea
Copy link

lcotonea commented Jun 14, 2016

Here my extract (docker-compose V1):

openldap:
  image: dinkel/openldap
  environment:
    - SLAPD_ORGANIZATION=XXX
    - SLAPD_DOMAIN=dc=xxx,dc=yyy,dc=com
    - SLAPD_RECONFIGURE=true
  volumes:
    - $PWD/openldap/data/var/lib/ldap:/var/lib/ldap
    - $PWD/openldap/data/etc/ldap:/etc/ldap

phpLDAPadmin:
  image: osixia/phpldapadmin
  environment:
    - PHPLDAPADMIN_LDAP_HOSTS=ldap
    - PHPLDAPADMIN_HTTPS=false
  links:
    - openldap:ldap
  ports:
    - "0.0.0.0:8081:80"

@osixia
Copy link
Collaborator

osixia commented Jun 14, 2016

this works for me:

openldap:
  image: dinkel/openldap
  environment:
    - SLAPD_ORGANIZATION=XXX
    - SLAPD_DOMAIN=dc=xxx,dc=yyy,dc=com
    - SLAPD_RECONFIGURE=true
    - SLAPD_PASSWORD=test
  volumes:
    - $PWD/openldap/data/var/lib/ldap:/var/lib/ldap
    - $PWD/openldap/data/etc/ldap:/etc/ldap

phpLDAPadmin:
  image: osixia/phpldapadmin:0.6.7
  environment:
    - PHPLDAPADMIN_LDAP_HOSTS=ldap
    - PHPLDAPADMIN_HTTPS=false
  links:
    - openldap:ldap
  ports:
    - "0.0.0.0:8081:80"

i added SLAPD_PASSWORD=test to get it working otherwise a got Cannot link to a non running container

The following phpLDAPadmin configuration is created :

<?php
/** NOTE **
 ** Make sure that <?php is the FIRST line of this file!
 ** IE: There should NOT be any blank lines or spaces BEFORE <?php
 **/

 /*********************************************
  * Useful important configuration overrides  *
  *********************************************/

 /* If you are asked to put PLA in debug mode, this is how you do it: */
 $config->custom->debug['level'] = 0;
 $config->custom->debug['syslog'] = true;
 #  $config->custom->debug['file'] = '/tmp/pla_debug.log';

/**
 * The phpLDAPadmin config file
 * See: http://phpldapadmin.sourceforge.net/wiki/index.php/Config.php
 */

/* The temporary storage directory where we will put jpegPhoto data
   This directory must be readable and writable by your web server. */
 $config->custom->jpeg['tmpdir'] = '/var/www/tmp';

 /* phpLDAPadmin can encrypt the content of sensitive cookies if you set this
   to a big random string. */

/*
 * Autogenerated value will be automatically added by phpldapadmin/startup.sh
 */
 $config->custom->session['blowfish'] = 'YHjZd/=qvO!UY_ssP#ObXjuaP{.k]Vuy]z^aiFDt$?Ppw?L%%X[jh$f[*_:J/>Ew';


/*********************************************
 * Appearance                                *
 *********************************************/
/* Hide the warnings for invalid objectClasses/attributes in templates. */
$config->custom->appearance['hide_template_warning'] = true;



/*********************************************
 * User-friendly attribute translation       *
 *********************************************/

/* Use this array to map attribute names to user friendly names. For example, if
   you don't want to see "facsimileTelephoneNumber" but rather "Fax". */
// $config->custom->appearance['friendly_attrs'] = array();
$config->custom->appearance['friendly_attrs'] = array(
    'facsimileTelephoneNumber' => 'Fax',
    'gid'                      => 'Group',
    'mail'                     => 'Email',
    'telephoneNumber'          => 'Telephone',
    'uid'                      => 'User Name',
    'userPassword'             => 'Password'
);


/*********************************************
 * Define your LDAP servers in this section  *
 *********************************************/

$servers = new Datastore();

/*
 * Autogenerated servers variables will come here
 */
$servers->newServer('ldap_pla');
$servers->setValue('server','name','ldap');
$servers->setValue('server','host','ldap');

in /var/www/phpldapadmin/config/config.php

@lcotonea
Copy link

The version of osixia/phpldapadmin is 0.6.7 in your test (my fault, because of a wrong copy&paste).
Can you test with the latest version please ?

@osixia
Copy link
Collaborator

osixia commented Jun 14, 2016

Just tried with 0.6.8 and 0.6.9 with the same result eveything seems ok.
can you tried running this and show the outputs ?

openldap:
  image: dinkel/openldap
  environment:
    - SLAPD_ORGANIZATION=XXX
    - SLAPD_DOMAIN=dc=xxx,dc=yyy,dc=com
    - SLAPD_RECONFIGURE=true
    - SLAPD_PASSWORD=test
  volumes:
    - $PWD/openldap/data/var/lib/ldap:/var/lib/ldap
    - $PWD/openldap/data/etc/ldap:/etc/ldap

phpLDAPadmin:
  image: osixia/phpldapadmin:0.6.9
  environment:
    - PHPLDAPADMIN_LDAP_HOSTS=ldap
    - PHPLDAPADMIN_HTTPS=false
  command: -l debug
  links:
    - openldap:ldap
  ports:
    - "0.0.0.0:8081:80"

(command: -l debug was added)

@osixia
Copy link
Collaborator

osixia commented Jun 14, 2016

if there is nothing special with -l debug run with -l trace please :)

@lcotonea
Copy link

Ok, I think I've identified the problem.... When I sent you the sample docker compose file, I've replaced my SLAPD_ORGANIZATION variable by XXX. But in my file, there is some spaces into the variable value.

Try with that and the problem will occur:

openldap:
  image: dinkel/openldap
  environment:
    - SLAPD_ORGANIZATION=My Organisation Com
    - SLAPD_DOMAIN=dc=my,dc=organisation,dc=com
    - SLAPD_RECONFIGURE=true
    - SLAPD_PASSWORD=test
  volumes:
    - $PWD/openldap/data/var/lib/ldap:/var/lib/ldap
    - $PWD/openldap/data/etc/ldap:/etc/ldap

phpLDAPadmin:
  image: osixia/phpldapadmin:0.6.9
  environment:
    - PHPLDAPADMIN_LDAP_HOSTS=ldap
    - PHPLDAPADMIN_HTTPS=false
  command: -l debug
  links:
    - openldap:ldap
  ports:
    - "0.0.0.0:8081:80"

@typekpb
Copy link
Contributor Author

typekpb commented Jun 24, 2016

@osixia Any updates here? Don't want to rush, rather just curious.
On Jun 14, 2016 12:30, "Loïc Cotonéa" notifications@github.com wrote:

Ok, I think I've identified the problem.... When I sent you the sample
docker compose file, I've replaced my SLAPD_ORGANIZATION variable by XXX.
But in my file, there is some spaces into the variable value.

Try with that and the problem will occur:

openldap:
image: dinkel/openldap
environment:
- SLAPD_ORGANIZATION=My Organisation Com
- SLAPD_DOMAIN=dc=my,dc=organisation,dc=com
- SLAPD_RECONFIGURE=true
- SLAPD_PASSWORD=test
volumes:
- $PWD/openldap/data/var/lib/ldap:/var/lib/ldap
- $PWD/openldap/data/etc/ldap:/etc/ldap
phpLDAPadmin:
image: osixia/phpldapadmin:0.6.9
environment:
- PHPLDAPADMIN_LDAP_HOSTS=ldap
- PHPLDAPADMIN_HTTPS=false
command: -l debug
links:
- openldap:ldap
ports:
- "0.0.0.0:8081:80"


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#23 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAegbFq2tru-33T1hvAXpHqK6WJxW6HXks5qLoLTgaJpZM4Ivyc6
.

@cfairweather
Copy link

cfairweather commented Jun 28, 2016

I'm fairly certain that the problem is the blowfish value that's autogenerated. Sometimes, a character is in the string that isn't properly escaped and PHP has a parsing error. This is why the problem is intermittent.

Unfortunately, since it's intermittent, I'm having an issue reproducing it to be absolutely certain. 😆

@osixia
Copy link
Collaborator

osixia commented Jun 30, 2016

@cfairweather yes me too 😄

@taylorludwig
Copy link

For me it looked to be caused by the {{ PHPLDAPADMIN_SERVERS }} line in config.php not being replaced (line 68)

It seemed to happen when the ldap-admin container would start before the ldap container - causing it to appear intermittent.

Using docker-compose depends_on fixed it for me

ldap-admin:
    image: osixia/phpldapadmin
    depends_on:
      - ldap
    environment:
      - PHPLDAPADMIN_LDAP_HOSTS=ldap
...

@cfairweather
Copy link

Agreed, I actual saw this issue happen today where the "templating" wasn't applied to the configuration file.


Cristoffer

On Jul 6, 2016, at 16:25, Taylor Ludwig notifications@github.com wrote:

For me it looked to be caused by the {{ PHPLDAPADMIN_SERVERS }} line in config.php not being replaced (line 68)

It seemed to happen when the ldap-admin container would start before the ldap container - causing it to appear intermittent.

Using docker-compose depends_on fixed it for me

ldap-admin:
image: osixia/phpldapadmin
depends_on:
- ldap
environment:
- PHPLDAPADMIN_LDAP_HOSTS=ldap
...

You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@thearrow
Copy link

thearrow commented Oct 7, 2016

Still getting the same error here, with 0.6.11 and depends_on set:

compose.yml:

ldap:
    container_name: ldap
    image: 'osixia/openldap:1.1.6'
    environment:
      LDAP_ORGANISATION: 'xx'
      LDAP_DOMAIN: 'xx.com'
      LDAP_ADMIN_PASSWORD: 'admin'
    volumes:
      - /usr/local/ldapdata:/var/lib/ldap
      - /usr/local/ldapcfg:/etc/ldap/slapd.d

  ldap_admin:
    container_name: ldap_admin
    image: 'osixia/phpldapadmin:0.6.11'
    links:
      - ldap
    depends_on:
      - ldap
    environment:
      PHPLDAPADMIN_HTTPS: 'false'
      PHPLDAPADMIN_LDAP_HOSTS: 'ldap'
    ports:
      - '6080:80'
    command: '-l debug'

last bit of log:

ldap_admin        | *** Set environment for container process
ldap_admin        | *** Environment files will be proccessed in this order :
ldap_admin        | Caution: previously defined variables will not be overriden.
ldap_admin        | /container/environment/99-default/default.yaml
ldap_admin        |
ldap_admin        | *** --- process file : /container/environment/99-default/default.yaml ---
ldap_admin        | *** ignore : PHPLDAPADMIN_HTTPS = True (keep PHPLDAPADMIN_HTTPS = false )
ldap_admin        | *** Run commands before process...
ldap_admin        | *** ------------ Environment dump ------------
ldap_admin        | *** PHPLDAPADMIN_HTTPS = false
ldap_admin        | *** LC_CTYPE = C.UTF-8
ldap_admin        | *** PHPLDAPADMIN_SSL_HELPER_PREFIX = phpldapadmin
ldap_admin        | *** PHPLDAPADMIN_VERSION = 1.2.3
ldap_admin        | *** INITRD = no
ldap_admin        | *** HOME = /root
ldap_admin        | *** PATH = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ldap_admin        | *** PHPLDAPADMIN_HTTPS_KEY_FILENAME = phpldapadmin.key
ldap_admin        | *** LANG = C.UTF-8
ldap_admin        | *** affinity:container = =64ecd3c116d91d415007c1a5f5662d221dedb783e3a12d6548a9322d886d8e71
ldap_admin        | *** PHPLDAPADMIN_SERVER_ADMIN = webmaster@example.org
ldap_admin        | *** CONTAINER_SERVICE_DIR = /container/service
ldap_admin        | *** PHPLDAPADMIN_HTTPS_CA_CRT_FILENAME = ca.crt
ldap_admin        | *** LANGUAGE = C.UTF-8
ldap_admin        | *** PHPLDAPADMIN_HTTPS_CRT_FILENAME = phpldapadmin.crt
ldap_admin        | *** PHPLDAPADMIN_TRUST_PROXY_SSL = False
ldap_admin        | *** PHPLDAPADMIN_LDAP_HOSTS = ldap
ldap_admin        | *** PHPLDAPADMIN_SHA1 = 669fca66c75e24137e106fdd02e3832f81146e23
ldap_admin        | *** CONTAINER_LOG_LEVEL = 4
ldap_admin        | *** HOSTNAME = 12bcc2afbc95
ldap_admin        | *** CONTAINER_STATE_DIR = /container/run/state
ldap_admin        | *** PHPLDAPADMIN_SERVER_PATH = /phpldapadmin
ldap_admin        | *** ------------------------------------------
ldap_admin        | *** Running runit daemon...
ldap_admin        | *** runit daemon started as PID 1431
ldap_admin        | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.6. Set the 'ServerName' directive globally to suppress this message

inside container the last bit of config.php still has templating intact:

/*********************************************
 * Define your LDAP servers in this section  *
 *********************************************/

$servers = new Datastore();

/*
 * Autogenerated servers variables will come here
 */
{{ PHPLDAPADMIN_SERVERS }}

Any ideas?

Any way I can add a startup delay to the admin container to make sure the ldap container has time to start up properly?

@sirrapa
Copy link

sirrapa commented Nov 4, 2016

I'm also having this issue. Tried it with 0.6.9, -10 and 11.
Stripped out the space in my organisation name.

PHPLDAPADMIN_SERVERS is not replaced in the config.

@thearrow did you find a solution?

@thearrow
Copy link

thearrow commented Nov 4, 2016

@sirrapa I ended up just using this docker image instead: https://hub.docker.com/r/dinkel/phpldapadmin/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants