0
respostas

Your PHP installation appears to be missing the MySQL extension which is required by WordPress.

Boa Noite pessoal, após executar a atividade da aula 6.3 fui tetar o acesso ao wordpress e a mensagem que recebeo é esta:

Your PHP installation appears to be missing the MySQL extension which is required by WordPress.

Atualizei o PHP para a versão 7.4 , o wordpress está na última versão e o apache é o Apache 2.

Vou adicionar o meu código do Ansible:

---
- hosts: wordpress
  handlers:
        - name: restart apache
          service:
            name: apache2
            state: restarted
          become: yes

  tasks:
        - name: 'Download WORDPRESS'
          get_url:
            url: https://wordpress.org/latest.tar.gz
            dest: /tmp/wordpress.tar.gz

        - name: 'Descompacta o arquivo wordpress.tar.gz /var/www/'
          unarchive:
            src: '/tmp/wordpress.tar.gz'
            dest: /var/www/
            remote_src: yes
          become: yes

        - name: 'Dup e Renomeia /var/www/wordpress/wp-config-sample.php -> wp-config.php'
          copy:  
            src: /var/www/wordpress/wp-config-sample.php
            dest: /var/www/wordpress/wp-config.php
            remote_src: yes
          become: yes

        - name: 'CONFIGURANDO O ARQUIVO WP-CONFIG.PHP'
          replace:
            path: '/var/www/wordpress/wp-config.php'
            regexp: "{{item.regex}}"
            replace: "{{item.value}}"
          with_items:
                - {regex: 'database_name_here', value: 'wordpress_db'}
                - {regex: 'username_here', value: 'bob'}
                - {regex: 'password_here', value: '12345'}
                - {regex: 'localhost', value: '192.168.0.205'}
          become: yes
        - name: "Repo PHP 7.4"
          apt_repository:
            repo="ppa:ondrej/php"
          become: yes

        - name: "Updating the repo"
          apt: update_cache=yes
          become: yes

        - name: Installation PHP 7.4
          apt: name=php7.4 
            state=present
          become: yes    
        - name: 'INSTALANDO APACHE'
          apt: 
            name: "{{ item }}"
            state: latest 
          become: yes
          with_items:
            - php
            - apache2
            - php7.4-mysql
            - php7.4-curl
            - php7.4-json
            - php7.4-cgi
            - php7.4-xsl
            - php7.4-cgi
            - php7.4-gd
            - php7.4-mbstring
            - php7.4-zip
            - php7.4-xmlrpc
            - php7.4-soap
            - php7.4-intl
            - libapache2-mod-php
        - name: 'CONFIGURA APACHE -> WORDPRESS'
          copy:  
            src: /vagrant/000-default.conf
            dest:  /etc/apache2/sites-available/000-default.conf
          become: yes
          notify:
            - restart apache
- hosts: mysql
  handlers:
        - name: restart mysql
          service:
            name: mysql
            state: restarted
          become: yes
  tasks:
        - name: 'INSTALANDO MySql'
          apt: 
            name: "{{ item }}"
            state: latest 
          become: yes
          with_items:
            - mysql-server
            - python-mysqldb
            - php7.2-mysql
        - name: 'CRIANDO O BANDO WORDPRESS_DB'
          mysql_db:
            name: wordpress_db
            state: present
          become: yes

        - name: 'CRIANDO USUARIO NO BANCO WORDPRESS_DB'
          mysql_user:
            name: bob
            password: 12345
            priv: 'wordpress_db.*:ALL'
            state: present
            host: "{{ item }}"
          with_items:
            - 'localhost'
            - '127.0.0.1'
            - '192.168.0.204'
          become: yes
        - name: 'COPIA /vagrant/mysqld.cnf -> /etc/mysql/mysql.conf.d'
          copy:  
            src: /vagrant/mysqld.cnf
            dest:  /etc/mysql/mysql.conf.d/mysqld.cnf
          become: yes
          notify:
            - restart mysql

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software