When i try to install php7.4-fpm using apt install php7.4-fpm on my xenial machine, it will show this error:

Setting up php7.4-fpm (7.4.2-3+ubuntu16.04.1+deb.sury.org+1) ...
touch: cannot touch '/run/php/php7.4-fpm.sock': No such file or directory

when i create this folder:

mkdir /run/php and chmodit to 777 then shows this error:

Setting up php7.4-fpm (7.4.2-3+ubuntu16.04.1+deb.sury.org+1) ...
/var/lib/dpkg/info/php7.4-fpm.postinst: 32: /var/lib/dpkg/info/php7.4-fpm.postinst: /run/php/php7.4-fpm.sock: Permission denied
dpkg: error processing package php7.4-fpm (--configure):
 subprocess installed post-installation script returned error exit status 126
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

I did purge php* but no difference. Also there's this behavior with another versions like 7.3, 7.2 too.

  • I just wanna know who is that stupid which decreased the point and made it off-topic?! It was not off-topic till main developers didn't accept it is a bug! Feb 2, 2020 at 8:30

3 Answers 3


I got same error. Sury is working on a fix: https://github.com/oerdnj/deb.sury.org/issues/1327


You can try this:

  1. Make sure /var/run/php directory exist, create if folder is not there. Sometimes this caused problem as postinst script not create this folder.

  2. Make sure /var/run/php/php7.4-fpm.pid exist, and permission just make it 744

Re-run php7.4-fpm install, then it must be finishing the rest of installation process.


It is fixed by last fix: https://launchpad.net/~ondrej/+archive/ubuntu/php/+builds?build_text=&build_state=building about a minute ago.

Not the answer you're looking for? Browse other questions tagged or ask your own question.