geerlingguy / ansible-role-phpmyadmin

DEPRECATED Ansible Role - phpMyAdmin
https://galaxy.ansible.com/geerlingguy/phpmyadmin/
MIT License
42 stars 41 forks source link

PhpMyAdmin showing error after clean installation #19

Closed choutman closed 3 years ago

choutman commented 3 years ago

Hi,

Today I ran into an error after installing phpmyadmin using this ansible role. The error:

Error during session start; please check your PHP and/or webserver log file and configure your PHP installation properly. Also ensure that cookies are enabled in your browser.

session_start(): open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/php/php-php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/:/usr/share/doc/phpmyadmin/:/usr/share/php/phpseclib/:/usr/share/php/PhpMyAdmin/:/usr/share/php/Symfony/:/usr/share/php/Twig/:/usr/share/php/Twig-Extensions/:/usr/share/php/ReCaptcha/:/usr/share/php/Psr/Container/:/usr/share/php/Psr/Cache/:/usr/share/php/Psr/Log/:/usr/share/php/Psr/SimpleCache/)

session_start(): Failed to initialize storage module: files (path: )

Used versions: OS: Ubuntu 20.04 Ansible: 2.10.2

I also used the following roles: roles:

I was able to fix the issue with the following tasks:

- name: check phpmyadmin is fixed
      command:
        cmd: "grep -e 'php_admin_value open_basedir .*:/tmp/' /etc/phpmyadmin/apache.conf"
      register: isPhpMyAdminFixed
      ignore_errors: true
    - name: fix phpmyadmin installation
      lineinfile:
        path: "/etc/phpmyadmin/apache.conf"
        state: present
        regexp: 'php_admin_value open_basedir (.*)'
        line: '\tphp_admin_value open_basedir \1:/tmp/'
        backrefs: yes
      when: isPhpMyAdminFixed.failed

It has been a while since I used Ansible, so I don't know if this is the proper way to fix this issue. But at least it fixed my issue.

stale[bot] commented 3 years ago

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

stale[bot] commented 3 years ago

This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.