#One liner
sudo chown $(whoami) $(pecl config-get php_dir)
#Find out where the php_dir is
pecl config-get php_dir
#You can either change ownership
sudo chown <username> <php_dir>
#or Set the php_dir to a different folder
pecl config-set php_dir /path/to/new/dir