1

I'm playing up with installing new environments on my server, Nginx webserver in conjunction with HHVM.

I installed both, then came to MariaDB and installed it as well. I can confirm server's working by hitting IP address: Welcome to nginx!

I then needed to install a web-based client for managing databases. I know phpMyAdmin works with Apache and Litespeed very well but as I followed many articles regarding to installing phpMyAdmin beside Nginx, steps were almost the same.

But the problem is doing apt-get install phpmyadmin will install Apache too:

The following extra packages will be installed:
  apache2 apache2-bin apache2-data dbconfig-common libapache2-mod-php5 libapr1
  libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libjs-codemirror
  libjs-jquery libjs-jquery-cookie libjs-jquery-event-drag
  libjs-jquery-metadata libjs-jquery-mousewheel libjs-jquery-tablesorter
  libjs-jquery-ui libjs-underscore php-gettext php5 php5-common php5-json
  php5-mcrypt php5-mysql

By confirming installation it will install and enable Apache modules:

[...]
Enabling module mpm_event.
Enabling module authz_core.
Enabling module authz_host.
Enabling module authn_core.
Enabling module auth_basic.
Enabling module access_compat.
Enabling module authn_file.
Enabling module authz_user.
Enabling module alias.
Enabling module dir.
Enabling module autoindex.
Enabling module env.
Enabling module mime.
Enabling module negotiation.
Enabling module setenvif.
Enabling module filter.
Enabling module deflate.
Enabling module status.
[...]

and then throwing an error that Apache couldn't get started:

* Starting web server apache2                                                              AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using vultr.guest. Set the 'ServerName' directive globally to suppress this message
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Action 'start' failed.
The Apache error log may have more information.
 *
 * The apache2 instance did not start within 20 seconds. Please read the log files to discover problems
invoke-rc.d: initscript apache2, action "start" failed.
Setting up dbconfig-common (1.8.47+nmu1) ...

I'm migrating from Apache to Nginx that means I don't want Apache anymore! Is it a default behavior of phpMyAdmin? Anyway to run phpMyAdmin with the latest versions of Nginx and HHVM?

rev
  • 121
  • 2
  • 11

2 Answers2

4

The reason for this behavior are the dependencies of phpmyadmin (at least in Debian, and I think it's quite similar in Ubuntu):

# apt-cache show phpmyadmin | grep Depends:
libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm | php5, php5-mysql | php5-mysqli | php5-mysqlnd, php5-mcrypt, php5-json, perl, debconf (>= 0.5) | debconf-2.0, libjs-sphinxdoc (>= 1.0), dbconfig-common, php-gettext, ucf (>= 0.28)

# apt-cache show libapache2-mod-php5 | grep Depends:
libbz2-1.0, libc6 (>= 2.15), libcomerr2 (>= 1.01), libdb5.3, libgssapi-krb5-2 (>= 1.6.dfsg.2), libk5crypto3 (>= 1.6.dfsg.2), libkrb5-3 (>= 1.6.dfsg.2), libonig2 (>= 5.9.5), libpcre3 (>= 1:8.35), libqdbm14 (>= 1.8.74), libssl1.0.0 (>= 1.0.1), libstdc++6 (>= 4.1.1), libxml2 (>= 2.9.0), zlib1g (>= 1:1.1.4), apache2-api-20120211, apache2 (>= 2.4), mime-support, php5-common (= 5.6.14+dfsg-0+deb8u1), php5-cli, php5-json, libmagic1, ucf, tzdata

Inside the second listing of required packages you'll find apache2, which will install this package. So, not that much magic involved.

If you install phpmyadmin like you did, you can't purge apache2 afterwards. Doing so, will remove phpmyadmin as well, because the dependencies aren't satisfied anymore.

So...what to do, if you want to install phpmyadmin, but at the same time don't want to install apache2? Not that hard as well:

phpmyadmin depends on several packages providing the php5 interpreter / libraries / modules. As there are several options, it's up to you to choose. You don't need all these packages, it's more like an "this package OR this package OR that one". (Note the | in the required package listing of phpmyadmin.)

So, you've to first install the needed php5 packages which aren't connected to apache2, and afterwards install phpmyadmin:

# apt-get install php5-fpm
[...]
The following NEW packages will be installed:
   libonig2 libqdbm14 php5-common php5-fpm

# apt-get install phpmyadmin
[...]
The following NEW packages will be installed:
   dbconfig-common libltdl7 libmcrypt4 libmysqlclient18 mysql-common php5-mcrypt php5-mysql phpmyadmin

If you've additional question or are in need of further help, please let me know.

Edit: Regarding your comment about other web based database management systems: You could have a look at Adminer. Quoting the project website (can't judge this for myself):

Replace phpMyAdmin with Adminer and you will get a tidier user interface, better support for MySQL features, higher performance and more security.

There are Ubuntu packages available as well.

gxx
  • 5,591
  • 2
  • 22
  • 42
  • Thank you for all explanations. Is Adminer Nginx friendly? I didn't find related things about it. – rev Dec 12 '15 at 17:54
  • @rev Glad that it helped. Not sure what you mean by "Nginx friendly". In the end it's just php, so yeah, nginx will serve you well. (Note: I'm not really into the php world, and especially I've never used or worked with `HHVM`. So if you want to use `HHVM`, and can't provide any insight into this topic.) – gxx Dec 12 '15 at 20:40
  • Or just install phpmyadmin from tarball. – symcbean Dec 12 '15 at 21:59
2

I'm kinda using your same stack (so no apache involve). What i like to use is

apt-get --no-install-recommends install phpmyadmin

And this will only install phpmyadmin withou apache

x86fantini
  • 302
  • 1
  • 3
  • 9