Im having some problems with running php files on my apache server. i have installed php 7, the folder /etc/php/7.0 exists which shows it's installed. I have configured apache to run .php files, however in my /etc/apache2/mods-enabled folder there isn't a php.conf file. Any ideas about how to install it?
(im on raspbian), apache version 2.4.25
Now Apache server is ready to run PHP codes. Let's understand how to run the first PHP code on the Apache server. For this open an editor write an example PHP code and save it in Apache24 > htdocs > projectfolder > filename. php.
Apache comes bundled with PHP, so you don't need to install it manually. . NET: . NET is a popular software framework that you can use to build web applications and more.
Running:
sudo a2dismod mpm_event
sudo systemctl restart apache2
sudo a2enmod mpm_prefork
sudo systemctl restart apache2
sudo a2enmod php7.0
sudo systemctl restart apache2
worked for me.
I had this problem too. I upgraded from Ubuntu 17.04 to Ubuntu 17.10 and then php did not work and there was no php.conf file in /etc/apache2/mods-enabled
.
When I tried sudo a2enmod php7.1
I was given the same error:
Considering dependency mpm_prefork for php7.0:
Considering conflict mpm_event for mpm_prefork:
ERROR: Module mpm_event is enabled - cannot proceed due to conflicts. It needs to be disabled first!
Considering conflict mpm_worker for mpm_prefork:
ERROR: Could not enable dependency mpm_prefork for php7.0, aborting
I used sudo a2dismod mpm_event
and received no errors. I restarted apache2 and then used sudo a2enmod php7.1
and it worked just fine. Restarted apache2 again and now php is working again and I can see phpinfo()
in my browser when I couldn't before.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With