PHP 7.2 Installation

314 views
Skip to first unread message

Scott Breeden

unread,
Nov 11, 2021, 2:55:47 AM11/11/21
to AtoM Users
Hello,

After I followed the recommended procedure for installing AtoM 2.6 on Ubuntu 18.04, AtoM did not work.  I found out that the problem was in PHP installation, which began with this step:

scott@ubuntu1804:~$ sudo apt install php7.2-cli php7.2-curl php7.2-json php7.2-ldap php7.2-mysql php7.2-opcache php7.2-readline php7.2-xml php7.2-fpm php7.2-mbstring php7.2-xsl php7.2-zip php-apcu
Reading package lists... Done
Building dependency tree       .
.
.
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for ureadahead (0.100.0-21) ...
scott@ubuntu1804:~$


Among other things, this created the /run/php directory, containing two files:

scott@ubuntu1804:~$ ls -lF /run | grep php
drwxr-xr-x  2 www-data      www-data        80 Nov 10 13:53 php/
scott@ubuntu1804:~$ ls -lF /run/php
total 4
-rw-r--r-- 1 root     root     5 Nov 10 13:53 php7.2-fpm.pid
srw-rw---- 1 www-data www-data 0 Nov 10 13:53 php7.2-fpm.sock=
scott@ubuntu1804:~$


/run/php/php7.2-fpm.sock is a unix socket, but it is not in the location specified elsewhere in the instructions:

(1) Put the following contents in /etc/nginx/sites-available/atom.
upstream atom {
   server unix:/run/php7.2-fpm.atom.sock;
}
(2) ; Use UNIX sockets if Nginx and PHP-FPM are running in the same machine
listen = /run/php7.2-fpm.atom.sock

After I changed "/run" to "/run/php" in  /etc/nginx/sites-available/atom and /etc/php/7.2/fpm/pool.d/atom.conf above, AtoM worked.

Questions:

(1) Is AtoM 2.7 - Ubuntu 20.04 - php7.4 going to have the same problem?  So far, the installation instructions do not mention a /run/php directory.
(2) Does this have anything to do with the following error message that seems to appear in the AtoM worker log every time AtoM is started?

symfony [crit] {PropelException} Unable to open PDO connection  [wrapped: SQLSTATE[HY000] [2002] No such file or directory]

Not critical issues for me at the moment, but it would be nice to have explanations eventually.

-Scott

Jim Adamson

unread,
Nov 11, 2021, 8:44:26 AM11/11/21
to AtoM Users
Hi Scott, 

For me, php7.2-fpm.atom.sock is always created in /run, not in /run/php. I have checked and this is consistent across our servers, and in a clean, up-to-date Vagrant bionic64 box. I think there's something peculiar about your Ubuntu 18.04 installation, given that's not the case for you. I wonder if you have a diversion set up? (dpkg-divert --list php would reveal this). 

If you're still seeing the PDO connection error logged after you've adjusted the Nginx config to account for the different location of php7.2-fpm.atom.sock, and everything else looks normal, then that suggests it's caused by something else. But my hunch is it relates to the location difference.

Thanks, Jim

Scott Breeden

unread,
Nov 19, 2021, 2:59:38 AM11/19/21
to AtoM Users
Update:

Thanks for the diversion idea, Jim, but that wasn't the problem:  dpkg-divert --list php didn't generate any output.

The problem was that /run/php7.2-fpm.atom.sock did not exist at the time that the AtoM web installer was run.  But, by adding one more step to the installation instructions, it could be made to exist:  Just before the "Run the web installer" step, I rebooted the machine.  After that, /run/php7.2-fpm.atom.sock appeared, and I could run the web installer and use AtoM normally.

I also tried running "sudo systemctl restart mysql" and "sudo systemctl reload nginx" instead of rebooting, but that didn't work:  Although it made /run/php7.2-fpm.atom.sock visible so the web installer no longer choked on "502 Bad gateway error" right off the bat, the installer generated a "500 Internal error" later on instead.

I wish that the instructions had noted that something like a reboot might be necessary before running the web installer.  If anyone knows of a less drastic alternative, that would be great.

Since AtoM 2.7 installation is different (no web installer, for one thing), I do not know if it has a similar problem.

In my first post, I think I confused /run/php7.2-fpm.atom.sock with /run/php7.2-fpm.sock, so I apologize for that, but I think that it turned out to not matter as far as the real problem was concerned.

-Scott

Jim Adamson

unread,
Nov 19, 2021, 10:05:20 AM11/19/21
to ica-ato...@googlegroups.com
From what you've said I'd guess that restarting php7.2-fpm would have fixed it.

As to your wish that the instructions included something about remediating it, I'd have thought if this were a widespread problem then the docs would be corrected. Looking at the docs there are steps to reload nginx and start php-fpm before the step of visiting the web installer, so I expect that if you had the correct nginx/php configuration blocks in place before reloading/starting nginx/php-fpm, the web installer would load without error.

Thanks, Jim

--
You received this message because you are subscribed to a topic in the Google Groups "AtoM Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ica-atom-users/0kgrC687owQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ica-atom-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ica-atom-users/d3c8fb99-c0b0-409b-b246-0ca88000a2a7n%40googlegroups.com.


--
Jim Adamson
Systems Administrator/Developer
Facilities Management Systems
IT Services
LFA/023 | Harry Fairhurst building | University of York | Heslington | York | YO10 5DD

Scott Breeden

unread,
Nov 19, 2021, 10:29:38 PM11/19/21
to AtoM Users
I guessed the same thing.

That's why I was surprised that the nginx reload and php-fpm restart commands that I copied and pasted from the docs failed to solve the problem.

I also tried to clear Symfony's cache via the command line:  "php symfony cache:clear".  But that just generated an error message about no cache present.  I still think that this smells like some sort of stale cache problem, but since I couldn't figure out how to unstick whatever was stuck, I settled for the reboot option.

The problem is easily reproducible:
Start by booting the Ubuntu ISO image (I used ubuntu-18.04.5-desktop-amd64.iso).
sudo apt update, and sudo apt install build-essential dkms linux-headers-$(uname -r).
After that, follow the AtoM 2.6 Ubuntu 18.04 LTS  installation instructions.
In the MySQL wget step, replace "mysql-apt-config_0.8.15-1_all.deb" with the name of the latest MySQLversion.
Skip the optional "sudo mysql_secure_installation" step.
Skip the optional " If you are not planning to use the default PHP pool (www), feel free to remove it" step.
For AtoM, choose "Option 1: Download the tarball".
Perform all other recommended steps.

By the way, even after the reboot "fix", the following message still appears in qubit_worker.log.  I don't know if it's related to the installation problem, but in any case, I'm ignoring it for now:

symfony [crit] {PropelException} Unable to open PDO connection  [wrapped: SQLSTATE[HY000] [2002] No such file or directory]

Are there any logging or debugging options that could be helpful in tracing execution of the installation steps?

-Scott

Dan Gillean

unread,
Nov 22, 2021, 9:58:16 AM11/22/21
to ICA-AtoM Users
Hi Scott, 

I've been letting Jim respond since I think his answers have been pointing you in the right direction. I'll add just a few small points: 

symfony [crit] {PropelException} Unable to open PDO connection  [wrapped: SQLSTATE[HY000] [2002] No such file or directory]

This error can sometimes occur when the atom-worker is started before the web installer has been run. So long as you restart the worker after completing the web installer, this shouldn't be an issue going forward. 

Regarding 2.7 - as you've noted, we have replaced the web installer with a CLI based installer, which should remove the need to switch unnecessarily to the web interface for the final installation steps, and avoid the timeout issues often experienced during installation. Additionally, we have reordered some of the installation steps to avoid errors like the one described above. 

Cheers, 

Dan Gillean, MAS, MLIS
AtoM Program Manager
Artefactual Systems, Inc.
604-527-2056
@accesstomemory
he / him


You received this message because you are subscribed to the Google Groups "AtoM Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ica-atom-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ica-atom-users/fb026a7b-0800-4867-a00e-f725572314aen%40googlegroups.com.

Jim Adamson

unread,
Nov 22, 2021, 12:51:04 PM11/22/21
to AtoM Users
Hi Scott,

I just tried to reproduce this but couldn't. I used ubuntu-18.04.6-live-server-amd64.iso in a VirtualBox guest. I noted you used the desktop edition. I wouldn't expect that to make a difference, but it's possible it did. I didn't install build-essentials etc, as you did, as this was not an included step in the installation instructions. I didn't reboot at any point, and made it through the web installer to my working site. Here are the commands I ran, taken from my bash history.

Despite being unable to reproduce this this time, this has been an issue that I've encountered in the past. I'd totally forgotten about my posts on the matter, though unsurprising given their age. Hopefully with 2.7's CLI based installer, these types of issues will be a thing of the past.

Thanks, Jim

Scott Breeden

unread,
Nov 22, 2021, 3:21:06 PM11/22/21
to AtoM Users
Jim,

Thank you very much for trying to reproduce the problem.  I noticed the following differences between your bash commands and mine:

mysql-apt-config_0.8.15-1_all.deb  (I used a later MySQL release)
apt install php-memcache  (I did not do this)
systemctl status php7.2-fpm (I did not do this, but I'd be surprised if it made any difference)
systemctl status nginx  (I did not do this, but I'd be surprised if it  made any difference )
rm /etc/php/7.2/fpm/pool.d/www.conf   (I did not do this)
systemctl restart php7.2-fpm   (I did not do this)
chmod o= /usr/share/nginx/atom   (I did not do this)

I could try installing again, following your commands more closely (especially about php-memcache) to see if that makes any difference, but that might have to wait for a few days (Thanksgiving holiday here, among other reasons).

And, as you noted, I am using a desktop version of Ubuntu.  I plan on running AtoM on a server eventually, but for now, I am just using my laptop.  Is it possible to install a server version of Ubuntu on a laptop?  How would you run the AtoM web installer, if there is no graphical interface?

Dan,

I think that the CLI installer is a wonderful idea!  Currently, though, I don't see any evidence of timeouts on my system, and I've never had to restart the atom-worker.  Running background jobs like CSV exports works just fine.  The only time that the mysterious "Unable to open PDO connection" error appears is when AtoM starts up after a reboot:  every single time, and at no other time.

-Scott

Jim Adamson

unread,
Nov 23, 2021, 6:57:33 AM11/23/21
to ica-ato...@googlegroups.com
Hi Scott,

You're welcome! I think the only commands that I ran that differed from the instructions were the systemctl status commands; I entered these just to check nginx and php7.2-fpm services were running.

Yes it is possible to install the server version on a laptop, in a virtual machine as I did. Lots of RAM and an SSD will make the experience much more pleasant. It is very easy to install the server version; from my memory of the desktop installer, far fewer questions are posed by the server edition installer.

In Oracle VirtualBox, you can set the guest box up with port forwarding so that you can browse to the AtoM web installer in a web browser running on the host, i.e. as you would normally browse web pages. Here's a screenshot from VirtualBox:

image.png

So, once you've run all the commands, you would then browse to http://127.0.0.1:7000 and the web installer will load. I also set up a port forwarding rule for ssh (port 22) so that I can use PuTTY to get access to the box. This makes copying and pasting the commands easier, which speeds things up immensely. In PuTTY you would enter 127.0.0.1 as the IP address to connect to.

Hope that helps.

Thanks, Jim

You received this message because you are subscribed to the Google Groups "AtoM Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ica-atom-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ica-atom-users/ac22a8d6-19ac-4dff-a346-3fb5aae997ffn%40googlegroups.com.

Scott Breeden

unread,
Nov 24, 2021, 2:23:18 AM11/24/21
to AtoM Users
Jim,

Thank you for that illustrated guide to using a server version on a laptop.  I use Virtual Box as well.  I also have PuTTY somewhere, but I wonder if Microsoft's ssh client for WIndows 10 would also work.  Maybe I'll try both.

-Scott
Reply all
Reply to author
Forward
0 new messages