Not sure how far you got, anyway, wpa_supplicant tells you, that its default driver (nl80211) is not supporting auth, apart from not being the proper driver anyway. As 8192cu is not supporting wpa_supplicant directly either, you need to specify Wireless Extensions (wext) when starting wpa_supplicant.
Instead of
$this->bbcode_second_pass_code('', 'sudo wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/example.conf')
use
$this->bbcode_second_pass_code('', 'sudo wpa_supplicant -i wlan0 -D wext -c /etc/wpa_supplicant/example.conf')
for background operation use -B in addition.