Create user and set permissions

Unfortunately, issues in Asterisk 1.2 require us to run the web server process as the same user as asterisk. In this situation, it's easier for us to run httpd as 'asterisk', rather than asterisk as 'httpd', as there's far less configuration that needs to be done.

cd /usr/src
useradd -c "Asterisk PBX" -d /var/lib/asterisk asterisk
chown asterisk /var/lib/php/session/

Change (Copy) MOH directory:
cp -vR /var/lib/asterisk/moh /var/lib/asterisk/mohmp3
chown -vR asterisk.asterisk /var/lib/asterisk/mohmp3
chmod -v 775 /var/lib/asterisk/mohmp3
chmod -v 664 /var/lib/asterisk/mohmp3/*

You need to change User apache and Group apache to User asterisk and Group asterisk.

sed -i “s/User apache/User asterisk/” /etc/httpd/conf/httpd.conf
sed -i “s/Group apache/Group asterisk/” /etc/httpd/conf/httpd.conf

Change the default AllowOverride All to AllowOverride None to prevent .htaccess permission problems.
sed -i “s/AllowOverride All/AllowOverride None/” /etc/httpd/conf/httpd.conf