aws, amazon linux 2,

How to Install PHP Posix on Amazon Linux 2

Mar 03, 2023 · 1 min read · Post a comment

The Posix extension is a very useful PHP extension in terms of monitoring your PHP processes, optimizing your code, etc. The function itself returns usage information about the current PHP process, how much CPU and Memory are used, and many different metrics. Let’s install Posix on Amazon Linux 2.


  • Amazon Linux 2
  • sudo privileges
  • PHP installed

Install PHP Posix on Amazon Linux 2

Step 1. Enable the desired PHP version.

sudo amazon-linux-extras enable php{version}

For example:

sudo amazon-linux-extras enable php7.4

Step 2. Install php-posix.

sudo yum clean metadata
sudo yum install php php-posix

If the command above throws an error, you can Install Posix through the php-process package.

sudo yum install php-process

Step 3. Restart your web server service.

sudo systemctl restart nginx
sudo systemctl restart php-fpm

Step 4. Create the phpinfo file.

echo "<?php phpinfo(); ?>" > /var/www/html/info.php

Step 5. Verify the installation.



Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.