phpMyAdmin and phpPgAdmin

    This sections describes how to access your phpMyAdmin and phpPgAdmin installation.

    phpMyAdmin is an easy to use management tool for MySQL that allows you to create and drop databases, create, drop and modify tables, delete, edit and add fields, execute SQL statements, manage keys on fields, manage privileges and export data in various formats through a web-based interface.

    phpPgAdmin is a web-based administration tool for PostgreSQL. It is perfect for PostgreSQL DBAs, newbies and hosting services.

    How to enable phpMyAdmin or phpPgAdmin to be accessed remotely?

    For security reasons, these applications are accessible only when using 127.0.0.1 as the hostname. To access them from a remote system, you must create an SSH tunnel that routes requests to the Apache Web server from 127.0.0.1. This implies that you must have an SSH private key and be able to connect to your server over SSH in order to access these applications remotely.
     

    IMPORTANT: Before following the steps below, ensure that your Apache and MySQL/PostgreSQL servers are running.

     

    NOTE: The steps below suggest using port 8888 for the SSH tunnel. If this port is already in use by another application on your local machine, replace it with any other port number greater than 1024 and modify the steps below accordingly. Similarly, if you have enabled Varnish, your stack's Apache Web server might be running on port 81. In this case, modify the steps below to use port 81 instead of port 80 for the tunnel endpoint.

     

    Follow the steps below for your platform.

    Bitnami Cloud Hosting

    On Windows:

    • Make sure you can log in to the server using PuTTY. Refer to these instructions for more information.
    • Open a new SSH session to the server and in the PuTTY settings for the new session, click "Connection → SSH → Tunnels" section and create a secure tunnel for the phpMyAdmin application by forwarding source port "8888" to destination port "localhost:80".
    • Click the "Add" button to add the secure tunnel configuration to the session.

    • Go back to the "Session" section and save your changes by clicking the "Save" button.
    • Click the "Open" button to open a new SSH session to the server.

    On Linux and Mac OS X:

    $ ssh -N -L 8888:127.0.0.1:80 -i bitnami-hosting.pem bitnami@xyz.bitnamiapp.com
    

    Remember to replace 'bitnami-hosting.pem' in the previous commands with the path to your private key file, and 'xyz.bitnamiapp.com' with the public IP address or hostname of your server. Note that if successful, this command will create an SSH tunnel but will not display any output on the server console.

    While the tunnel is active, you should be able to access phpMyAdmin and phpPgAdmin through the secure SSH tunnel you created, by browsing to http://127.0.0.1:8888/phpmyadmin and http://127.0.0.1:8888/phppgadmin respectively.

    To log in, use username 'root' for phpMyAdmin or 'postgres' for phpPgAdmin. For the application password, refer to the "Servers -> Manage Server" page of your Bitnami Cloud Hosting dashboard, under the "Application Password" section.

    Refer to this page for more information on obtaining application credentials.

    Microsoft Azure

    On Windows:

    • Make sure you can log in to the server using PuTTY. Refer to these instructions for more information.
    • Open a new SSH session to the server and in the PuTTY settings for the new session, click "Connection → SSH → Tunnels" section and create a secure tunnel for the phpMyAdmin application by forwarding source port "8888" to destination port "localhost:80".
    • Click the "Add" button to add the secure tunnel configuration to the session.

    • Go back to the "Session" section and save your changes by clicking the "Save" button.
    • Click the "Open" button to open a new SSH session to the server.

    On Linux and Mac OS X:

    $ ssh -N -L 8888:127.0.0.1:80 bitnami1@xyz.cloudapp.net
    

    Remember to replace 'bitnami1' with the SSH username from your credentials pair and 'xyz.cloudapp.net' with the public IP address or hostname of your server. Note that if successful, this command will create an SSH tunnel but will not display any output on the server console.

    While the tunnel is active, you should be able to access phpMyAdmin and phpPgAdmin through the secure SSH tunnel you created, by browsing to http://127.0.0.1:8888/phpmyadmin and http://127.0.0.1:8888/phppgadmin respectively.

    To log in, use username 'root' for phpMyAdmin or 'postgres' for phpPgAdmin and password 'bitnami'.

    Google Cloud Platform

    On Windows:

    • Make sure you can log in to the server using PuTTY. Refer to these instructions for more information.
    • Open a new SSH session to the server and in the PuTTY settings for the new session, click "Connection → SSH → Tunnels" section and create a secure tunnel for the phpMyAdmin application by forwarding source port "8888" to destination port "localhost:80".
    • Click the "Add" button to add the secure tunnel configuration to the session.

    • Go back to the "Session" section and save your changes by clicking the "Save" button.
    • Click the "Open" button to open a new SSH session to the server.

    On Linux and Mac OS X:

    $ ssh -N -L 8888:127.0.0.1:80 -i bitnami-gce-project-name.pem bitnami@100.101.102.103

    Remember to replace 'bitnami-gce-project-name.pem' in the previous commands with the path to your private key file, and '100.101.102.103' with the public IP address or hostname of your server. Note that if successful, this command will create an SSH tunnel but will not display any output on the server console.

    While the tunnel is active, you should be able to access phpMyAdmin and phpPgAdmin through the secure SSH tunnel you created, by browsing to http://127.0.0.1:8888/phpmyadmin and http://127.0.0.1:8888/phppgadmin respectively.

    To log in, use username 'root' for phpMyAdmin or 'postgres' for phpPgAdmin. For the application password, follow the steps below:

    • Browse to the Bitnami Launchpad for Google Cloud Platform dashboard and sign in if required using your Bitnami account.
    • Select the "Virtual Machines" menu item.
    • Select your Bitnami AMP Stack server from the resulting list.
    • Obtain credentials by selecting "Show" under "Credentials".

    Refer to this page for more information on obtaining application credentials.

    Virtual Machine

    On Windows:

    • Make sure you can log in to the server using PuTTY. Refer to these instructions for more information.
    • Open a new SSH session to the server and in the PuTTY settings for the new session, click "Connection → SSH → Tunnels" section and create a secure tunnel for the phpMyAdmin application by forwarding source port "8888" to destination port "localhost:80".
    • Click the "Add" button to add the secure tunnel configuration to the session.

    • Go back to the "Session" section and save your changes by clicking the "Save" button.
    • Click the "Open" button to open a new SSH session to the server.

    On Linux and Mac OS X:

    $ ssh -N -L 8888:127.0.0.1:80 bitnami@192.168.1.1
    

    Remember to replace '192.168.1.1' with the network IP address or hostname of your virtual server. Note that if successful, this command will create an SSH tunnel but will not display any output on the server console.

    While the tunnel is active, you should be able to access phpMyAdmin and phpPgAdmin through the secure SSH tunnel you created, by browsing to http://127.0.0.1:8888/phpmyadmin and http://127.0.0.1:8888/phppgadmin respectively.

    Alternative Approach: Allow Access from All Hosts

    Alternatively, if you are running the virtual machine in a secure environment, you can enable access to phpMyAdmin and phpPgAdmin from hosts other than 127.0.0.1 by editing the /opt/bitnami/apps/phpmyadmin/conf/httpd-app.conf file and modifying the Allow and Require directives as below:

      Default directive Modified directive
    Apache 2.2 Allow from 127.0.0.1 Allow from all
    Apache 2.4+ Require local Require all granted

    You can also use the example configuration file below if you wish:

     <IfDefine USE_PHP_FPM>
        <Proxy "unix:/opt/bitnami/php/var/run/phpmyadmin.sock|fcgi://phpmyadmin-fpm" timeout=300>
        </Proxy>
    </IfDefine>
    <Directory "/opt/bitnami/apps/phpmyadmin/htdocs">
    
    # AuthType Basic                                                                                                                                          
    # AuthName phpMyAdmin                                                                                                                                     
    # AuthUserFile "/opt/bitnami/apache2/users"                                                                                           
    # Require valid-user                                                                                                                                      
    AllowOverride None
    
    <IfModule php5_module>
            php_value upload_max_filesize 80M
    php_value post_max_size 80M
    </IfModule>
    
    <IfVersion < 2.3 >
    Order allow,deny
    Allow from all
    Satisfy all
    </IfVersion>
    <IfVersion >= 2.3>
    Require all granted
    </IfVersion>
    ErrorDocument 403 "For security reasons, this URL is only accesible using localhost (127.0.0.1) as the hostname"
    
    
        <IfDefine USE_PHP_FPM>
           <FilesMatch \.php$>
             SetHandler "proxy:fcgi://phpmyadmin-fpm/"
           </FilesMatch>
        </IfDefine>
    
    </Directory>
    

    Restart Apache to have the changes take effect:

    $ cd /opt/bitnami
    $ sudo ./ctlscript.sh restart apache
    

    You should now be able to access phpMyAdmin and phpPgAdmin by browsing to http://[virtual-machine-IP-address]/phpmyadmin and http://[virtual-machine-IP-address]/phppgadmin respectively.

    To log in, use username 'root' for phpMyAdmin or 'postgres' for phpPgAdmin. The default password is 'bitnami'.

    Native Installer

    You should be able to access phpMyAdmin directly, by browsing to http://127.0.0.1:8080/phpmyadmin or http://127.0.0.1/phpmyadmin.

    You should be able to access phpPgAdmin by browsing to http://127.0.0.1:8080/phppgadmin or http://127.0.0.1/phppgadmin.

    The username is 'root' for phpMyAdmin and 'postgres' for phpPgAdmin, and the password is the one specified by you during the installation process.

    Tabs end

    Increasing the security of phpMyAdmin and phpPgAdmin's login pages.

     
    If you would like, you can add an additional layer of security by enabling Apache's authentication when accessing PHPMyAdmin or phpPgAdmin. To do this for PHPMyAdmin, open /installdir/apps/phpmyadmin/conf/httpd-app.conf and add the following lines outside the Directory directive.
    <Location /phpmyadmin>
     AuthType Basic
     AuthName phpMyAdmin
     AuthUserFile "/opt/bitnami/apache2/users"
     Require valid-user
    </Location>
    
     
    For phpPgAdmin, the steps are the same but replacing "phpmyadmin" for "phppgadmin". Open /installdir/apps/phppgadmin/conf/httpd-app.conf and uncomment the following lines by removing the # symbol: 
    # AuthType Basic
    # AuthName phpPgAdmin
    # AuthUserFile "install_directory/apache2/users"
    # Require valid-user
    
     
    Now, when accessing phpMyAdmin or phpPgAdmin you will have to log in twice: First, with the username administrator and second, with the username root. Password will be the one you specified at install time or in the case of the Amazon Machine Images and Virtual Appliances, "bitnami". If you would like to change this password, you just have to follow these instructions.

    How to modify the allowed size for uploaded files?

    You can modify the following option in the httpd-app.conf file to increase the allowed size for uploads:

    <IfModule php5_module>                                                                    
        php_value upload_max_filesize 80M                                                 
        php_value post_max_size 80M                                                               
    </IfModule>

    This file is located inside  install_directory/apps/phppgadmin/conf for phpPgAdmin and  install_directory/apps/phpmyadmin/conf for phpMyAdmin. 

    If you are using PHP-FPM, enabled by default in Cloud Images and Virtual Machines, you should modify the settings into the "install_directory/apps/phpmyadmin/con/php-fpm/php-settings.conf"

    php_value[upload_max_filesize]=80M
    php_value[post_max_size]=80M

    How to modify the execution time?

    This paremeter sets the timeout for Apache to run a script. You can modify the following option in the php.ini file.

    max_execution_time = 120     ; Maximum execution time of each script, in seconds 
    

    Also, you must modify the ExecTimeLimit value in /opt/bitnami/apps/phpmyadmin/htdocs/config.inc.php :

    $cfg['ExecTimeLimit'] = 120;
    

    If you want phpMyAdmin to increate the Execution limit, you will also need to modify PHP with the same timeout value. If you want it to be unlimited (apply this value only if really necessary), you can configure it to 0.

    How to change the phpMyAdmin or phpPgAdmin password?

    The phpMyAdmin and phpPgAdmin credentials are the same that the MySQL and PostgreSQL database respectively. If you want to modify the password, check how to change the MySQL root password or how to change the PostgreSQL password

    Add new user for Apache Basic Authentication

    The phpMyAdmin application can be protected by an Apache directory password for security reasons. You can change the phpMyAdmin access password using the following command:

    $ sudo /opt/bitnami/apache2/bin/htpasswd -cb /opt/bitnami/apache2/users administrator <new_phpmyadmin_password>
    

    Note: For native installers you need to replace /opt/bitnami with your current installation directory.

    Comments

    You must login to post a comment.