Are you using cPanel? If yes, use the "Build Matching PHP" feature in WHM plugin.
If you have to use the "compile PHP" feature from web console, you can set "Install Path Prefix" to "/usr/local", the default open_basedir should work.
If you need to install PHP to /usr/local/lsws/lsphp5, you...