Getting SOAP working usually does not require compiling PHP from source. I would recommend trying that only as a last option.
For good measure, check to see what your phpinfo says, if anything, about SOAP extensions:
$ php -i | grep -i soap
to ensure that it is the PHP extension that is missing.
Assuming you do not see anything about SOAP in the phpinfo, see what PHP SOAP packages might be available to you.
In Ubuntu/Debian you can search with:
$ apt-cache search php | grep -i soap
or in CentOS you can search with:
$ yum search php | grep -i soap
There are usually two PHP SOAP packages available to you, usually
php-soap is typically what you get with configuring PHP with
In Ubuntu/Debian you can install with:
$ sudo apt-get install php-soap
Or in CentOS you can install with:
$ sudo yum install php-soap
After the installation, you might need to place an ini file and restart Apache.