Pure PHP is not suitable for this task.
Let the user upload the file via PHP. Then direct PHP (via the exec() function) an external program like ffmpeg or gstreamer to convert the file. After the conversion you can make the mp3 available for downloading via PHP.
This is in my opinion the only suitable approach to this kind of problem, because programs like ffmpeg use much less resources than a PHP Script would need.