Verification: a143cc29221c9be0

Package php mysql has no installation candidate

Package php mysql has no installation candidate

Step 1 – Install Apache and PHP

We are assuming you already have installed the MySQL server on Ubuntu system. So just install the other required packages to run and access phpMyAdmin.

sudo apt install apache2 wget unzip
sudo apt install php php-zip php-json php-mbstring php-mysql

Once the installation finished, enable and start Apache web server.

systemctl enable apache2
systemctl start apache2

Step 2 – Install phpMyAdmin on Ubuntu 20.04

phpMyAdmin is also available under the default packages repository but mostly they have older version. In this tutorial, we will download latest phpMyAdmin and configure on our system.

Your system is ready for the phpMyAdmin installation. Download the latest phpMyAdmin archive from the official download page, or use the below commands to download phpMyAdmin 5.0.3 on your system.

After downloading extract archive and move to the proper location.

wget https://files.phpmyadmin.net/phpMyAdmin/5.0.3/phpMyAdmin-5.0.3-all-languages.zip
unzip phpMyAdmin-5.0.3-all-languages.zip
mv phpMyAdmin-5.0.3-all-languages /usr/share/phpmyadmin

Next, create tmp directory and set the proper permissions.

mkdir /usr/share/phpmyadmin/tmp
chown -R www-data:www-data /usr/share/phpmyadmin
chmod 777 /usr/share/phpmyadmin/tmp

Step 3 – Configure phpMyAdmin

Now, you need to configure web server to serve phpMyAdmin on network. Create Apache configuration file for phpMyAdmin and edit in text editor:

sudo vi /etc/apache/conf-available/phpmyadmin.conf

add the below content to file.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

Alias /phpmyadmin /usr/share/phpmyadmin

Alias /phpMyAdmin /usr/share/phpmyadmin

Directory /usr/share/phpmyadmin/>

   AddDefaultCharset UTF-8

   IfModule mod_authz_core.c>

      RequireAny>

      Require all granted

     /RequireAny>

   /IfModule>

/Directory>

Directory /usr/share/phpmyadmin/setup/>

   IfModule mod_authz_core.c>

     RequireAny>

       Require all granted

     /RequireAny>

   /IfModule>

/Directory>

Save your file. Press ESC key to switch to command more. Then type : (colon) and type w after the colon and hit Enter.

After making all the changes, make sure to start the Apache service to reload all settings.

sudo a2enconf phpmyadmin
sudo systemctl restart apache2

Step 4 – Adjusting FirewallD

The systems with enabled firewalls need to allow HTTP service from the firewall. Run the below commands to open a port for the webserver in the firewall.

sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reload

Step 5 – Access phpMyAdmin

All done. You have finished the setup with the phpMyAdmin on Ubuntu Linux system. Now access phpMyAdmin with the server IP address or domain name.

http://your-server-ip-domain/phpmyadmin

Replace your-server-ip-domain with the localhost (for the local machines), or system IP address for remote machines. I have updated our DNS and pointed dbhost.tecadmin.net to the server’s IP address.

how to install phpmyadmin on ubuntu 20.04

Log in with the username and password used to access MySQL on the command line.

setup phpmyadmin ubuntu 20.04

Introduction

If you’re running your own webserver and expect it to send email via PHP mail() without issue, you are going to have a bad time.

Since I wrote this article in 2017, email providers have become very strict on who they will receive email from. Back in 2017, the massive email services such as Gmail and Office 365 would reluctantly accept emails from cloud instances such as DigitalOcean.

I have observed over the past years a tightening of spam filters, preventing PHP mail() emails from ever reaching their recipients, despite checking all the boxes my end.

So, while this guide will indeed enable your server to send emails out into the ether, the problem now is whether the receiving mail servers will accept or reject them.

Personally, I now relay all emails through a mail provider, be it Mailgun, Sendgrid, or Gmail. You can configure Postfix to send email through an SMTP provider of your choice, which is now my recommendation to guarantee mail delivery.

Please see Step 5 below if your test PHP mail()s are not being delivered to your recipient.

1. Install Postfix

Let’s update the package database first.

sudo apt-get update

Install mailutils, which will automatically install Postfix.

sudo apt install -y mailutils

On the first Postfix configuration screen, select OK by pressing TAB and ENTER

Select Internet Site and press ENTER.

System mail name should be your domain name eg. example.com, press ENTER.

Package should now be installed.

2. Configure Postfix

For security reasons, you should instruct Postfix only to process requests to send emails from the server on which it is running.

Edit the Postfix configuration file.

sudo nano /etc/postfix/main.cf

Towards the bottom of the file, find the line inet_interfaces = all. (Press CTRL + W to search)
Change it to:

/etc/postfix/main.cf

inet_interfaces = loopback-only

Save file and exit. (Press CTRL + X, press Y and then press ENTER)

Lastly, let’s restart Postfix.

sudo systemctl restart postfix

If you intend on sending email to your own domain, Postfix requires some additional configuration. For example, I want my PHP app to send emails to info@devanswers.co. This will fail if you don’t make some additional changes to your main.cf file.

  • Can’t send mail to own domain. Postfix: status=bounced (unknown user: “user”)

3. Test Postfix

We’ll now send a test email message. Make sure to replace test@example.com with your own email address.

echo "Test Email message body" | mail -s "Email test subject" test@example.com

Don’t forget to check your spam folder.

If you still haven’t received any mail after a few minutes, check the mail error log.

sudo tail /var/log/mail.log

If the mail log is empty or doesn’t give enough information, try parsing the syslog. This will return the last 50 entries for postfix.

sudo tail -f -n 50 /var/log/syslog | grep postfix

If the syslog is empty and you still haven’t received any test email, it’s possible that the test email was rejected by the recipient server. You should check to see if anything has bounced back to your mail folder.

sudo less /var/mail/$(whoami)

Press uppercase G to scroll to the bottom of the file and lowercase q to quit. The $(whoami) variable returns the currently logged in user.

Update Feb 2020: If you are sending to Gmail, Outlook or other large email providers, you may get a bounce error similar to “This message does not have authentication information or fails”. If so, please see article:

  • Postfix Gmail Bounce: This message does not have authentication information or fails to 550-5.7.26 pass authentication checks.

4. Test PHP mail()

If Postfix is working correctly, you should now be able to send mail via PHP mail().