Installing Drupal 7 on Ubuntu 16.04

It’s been a while since I’ve used Drupal and since the last time php has undergone a major upgrade from 5.5 to 7.0.

To have apache look for files with a .php extension open the dir.conf file. On Ubuntu, it’s found here.

sudo vi /etc/apache2/mods-enabled/dir.conf

An issue I’ve been having when restarting Apache is that the address is already in use. To find out what could be using the address use:

netstat -plant

To find out if it’s being used and:

sudo lsof -i tcp:80

To see what it using it and the corresponding PID.
In my case it was nginx

I’ve also changed the default port Apache listens to using the

/etc/apache2/ports.conf file

from:

Listen 80

to:
Listen 8080

However this didn’t completely solve my problem. I had an issue with the browser downloading php files instead of running them. Basically it was due to the VirtualHost file needing an AddHandler config. I ended up following this tutorial and installing php-fpm:

https://www.howtoforge.com/tutorial/apache-with-php-fpm-on-ubuntu-16-04/

There was also an issue installing phpmyadmin – an ‘Empty value for port’ error.
To fix this the

/etc//dbconfig-common/phpmyadmin.conf

file needs changing. Find the line:

dbc_dbport = ” and change it to dbc_dbport=’0′

And finally there was an issue with password validation for phpmyadmin. I had set a password with length of 6 characters instead of 8. Changing the length of the password:
mysql -u root -p
SET GLOBAL validate_password_length=4;

had no effect so I disable the password validation plugin using:
uninstall plugin validate_password;

and it worked.

Maybe not so finally. I had also misconfigured apache / phpmyadmin leading to my not being able to see phpmyadmin at: localhost/phpmyadmin. Turns out I needed to add a couple of symbolic links; I grabbed the solution here:
https://askubuntu.com/questions/668734/the-requested-url-phpmyadmin-was-not-found-on-this-server

sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf

sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin

sudo service apache2 restart

Leave a Reply

Your email address will not be published. Required fields are marked *