THANKS!!! That fixed it, for some reason lwp-request for a local url doesn't work for a link that is local to the server but does if we test an external url:
1) checking link on the server using lwp-request on the server:
/usr/bin/lwp-request -d -t 40 -mHEAD https://webwork.math.montana.edu/wwtmp/S18M171//gif/6f220643-a8b4-333a-8fe7-96607065a064___3cd22e5e-bc29-3de2-a440-15f4fd36c705.pngwww.monta
500 Can't connect to webwork.math.montana.edu:443
2) checking an external link using lwp-request on the server
/usr/bin/lwp-request -d -t 40 -mHEAD www.montana.edu
3) checking the link on the server using lwp-request on another 16.04 box:
/usr/bin/lwp-request -d -t 40 -mHEAD "https://webwork.math.montana.edu/wwtmp/S18M171//gif/6f220643-a8b4-333a-8fe7-96607065a064___3cd22e5e-bc29-3de2-a440-15f4fd36c705.png"
It seems that the dynamic images are not checked for a valid url but the static ones are. If we comment out the check in PGalias and retrun 1 as Michael suggests everything seems to be back to normal.
THANKS we have had a lot of very up happy calculus students learning to be patience.
Another question: why would you want to check to see if the url is valid?