Restarting apache as www-data using perl
root should restart the webserver:
sudo /etc/init.d/apache2 restart
This will make apache run under the www-data user.
you don't need to add www-data to the sudoers file unless you want to allow the www-data user to restart the server - but typically you should not log in under the www-data account, it's a system account.