How to enable PHP7 in Apache?

So I recently created a new Laravel installation and have entered the wonderful world of Laravel 5.3 (no more app/Http/routes.php) . Unfortunately, the standard chmod and chown commands weren’t helping. I went to the IRC chat on freenode and received condescending remarks but just a  little bit of help. It was only after I went to /r/laravel that I received some insight that the issue was probably that I had two different versions of PHP running. PHP7 on CLI and PHP 5 on Apache.

I tried to reinstall PHP 7 using the directions from Digital Ocean. No such luck. Still just in CLI not on Apache. I had to Google a few different things before I stumbled upon this Stack Exchange question.

First, disable the php5 module:

a2dismod php5
then, enable the php7 module:

a2enmod php7.0
Next, reload/restart the Apache service:

service apache2 restart

So that’s how I was able to resolve the issue and now I can start work on my new project: postmortem messaging.

 

Leave a Reply

Your email address will not be published. Required fields are marked *