For recent versions of Debian/Ubuntu (Debian 9+ or Ubuntu 16.04+) install the php-dev
dependency package, which will automatically install the correct version of php{x}-dev
for your distribution:
sudo apt install php-dev
Older versions of Debian/Ubuntu:
For PHP 5, it’s in the php5-dev package.
sudo apt-get install php5-dev
For PHP 7.x (from rahilwazir comment):
sudo apt-get install php7.x-dev
RHEL/CentOS/yum
yum install php-devel # see comments