If there is a problem only with php, there is no need to recompile apache. You can simply recompire PHP, in shell, with the included modules.
If php is already compiled with the needed modules, and Apache is simply not recognizing them, THEN you would need to recompile apache.