4 Replies - 283 Views - Last Post: 07 April 2020 - 04:57 AM

#1 Atharron   User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 202
  • Joined: 23-April 14

How do you run PHP on Ubuntu 18.04?

Posted 06 April 2020 - 12:40 AM

I've looked around online, but every site tells me to do something, and then assumes there's no errors. I've searched the errors that come up, but nothing's proved useful. I have no idea what any of the following means, and I don't know how to determine what dependencies are unmet.

As a side note, I tend to run into errors such as this every time I try to install something. Where can I learn what such errors mean, and how to fix them without asking for help?

[email protected]:~$ sudo apt install apache2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies.
 apache2 : Depends: apache2-bin (= 2.4.29-1ubuntu4.13) but it is not going to be installed
           Depends: apache2-utils (= 2.4.29-1ubuntu4.13)
           Depends: apache2-data (= 2.4.29-1ubuntu4.13) but it is not going to be installed
 atom : Depends: libgconf-2-4 (>= 3.2.5) but it is not installable or
                 libgconf2-4 but it is not installable
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
[email protected]:~$ apt --fix-broken install
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
[email protected]:~$ sudo apt-get update
[Deleted for brevity]
[email protected]:~$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies.
 atom : Depends: libgconf-2-4 (>= 3.2.5) but it is not installable or
                 libgconf2-4 but it is not installable
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
[email protected]:~$ sudo apt-get install apache2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies.
 apache2 : Depends: apache2-bin (= 2.4.29-1ubuntu4.13) but it is not going to be installed
           Depends: apache2-utils (= 2.4.29-1ubuntu4.13)
           Depends: apache2-data (= 2.4.29-1ubuntu4.13) but it is not going to be installed
 atom : Depends: libgconf-2-4 (>= 3.2.5) but it is not installable or
                 libgconf2-4 but it is not installable
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
[email protected]:~$ sudo apt install php
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies.
 atom : Depends: libgconf-2-4 (>= 3.2.5) but it is not installable or
                 libgconf2-4 but it is not installable
 php : Depends: php7.2 but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
[email protected]:~$ sudo apt-get install mysql-server mysql-client
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies.
 atom : Depends: libgconf-2-4 (>= 3.2.5) but it is not installable or
                 libgconf2-4 but it is not installable
 mysql-client : Depends: mysql-client-5.7 but it is not going to be installed
 mysql-server : Depends: mysql-server-5.7 but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
[email protected]:~$ sudo mysql_secure_installation
sudo: mysql_secure_installation: command not found
[email protected]:~$ apt --fix-broken install
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?



Is This A Good Question/Topic? 0
  • +

Replies To: How do you run PHP on Ubuntu 18.04?

#2 CTphpnwb   User is offline

  • D.I.C Lover
  • member icon

Reputation: 3837
  • View blog
  • Posts: 13,979
  • Joined: 08-August 08

Re: How do you run PHP on Ubuntu 18.04?

Posted 06 April 2020 - 05:02 AM

Are you root? Type:
whoami
Was This Post Helpful? 0
  • +
  • -

#3 Atharron   User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 202
  • Joined: 23-April 14

Re: How do you run PHP on Ubuntu 18.04?

Posted 06 April 2020 - 03:50 PM

[email protected]:~$ whoami
jrcs



I don't think so.

Is it important? I thought that was what sudo was supposed to do.

This post has been edited by Atharron: 06 April 2020 - 03:52 PM

Was This Post Helpful? 0
  • +
  • -

#4 Atharron   User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 202
  • Joined: 23-April 14

Re: How do you run PHP on Ubuntu 18.04?

Posted 07 April 2020 - 01:49 AM

Not sure what happened, but while I was messing about with things, my computer popped up asking to update. I did, and now it works.

I then followed this guide which went into a bit more depth than any I have used before. Apparently I should be able to access my server by visiting http://xx.xx.xx.xx using my IP address. Previously when I've used PHP, I've only been able to access it through localhost (which I can still do here, so this isn't a major issue at the moment). Anyway, so I find my IP address, and visit the site in my browser, but it says this connection is not private, and asks me for username and password. Which username and password is this? And is there any way to get around it?
Was This Post Helpful? 0
  • +
  • -

#5 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6865
  • View blog
  • Posts: 31,644
  • Joined: 10-May 07

Re: How do you run PHP on Ubuntu 18.04?

Posted 07 April 2020 - 04:57 AM

** Moved to WebServers & Hosting **

This isn't a PHP code question, moved to the correct sub forum.

You need to be an account with install privileges. Generally this is root. You can either authenticate as the root account, or use "sudo" to use those privileges just for the single command entered. After you install the OS, you most likely have to manually enter your user to the sudo'ers file to grant them sudo ability. it is uncommon for a standard user to be able to install services that bind ports, like http/php.

Generally you can tell when a guide is telling you to use escalated privileges (root), when the instruction starts with "#" rather than "$".

From your provided text, you need to issue sudo here :

Quote

$ apt --fix-broken install

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1