How can I fix a website which dosen't work with ubuntu?
I want to make a website in a local environment, but I have a issue. I don’t know why, but when I launch the website, I have the php code of the index.php file instead of having a view.
Here is what I did about the configuration:
I created a VirtualHost:
<VirtualHost *:80> ServerName dev.mywebsite.com ServerAlias www.dev.mywebsite.com DocumentRoot "/mnt/d/Websites/mywebsite" <Directory "/mnt/d/Websites/mywebsite"> Options +FollowSymLinks AllowOverride all Require all granted Options Indexes </Directory> ErrorLog /var/log/apache2/error.dev.mywebsite.com.log CustomLog /var/log/apache2/access.dev.mywebsite.com.log combined </VirtualHost>
I modified the ‘hosts’ file with this two lines:
127.0.0.1 dev.mywebsite.com ::1 dev.mywebsite.com
Then I reloaded the service apache2.
But I still have a problem. Indeed, when I go to ‘dev.mywebsite.com’, I have a page with the code of the index.php, and I don’t know why. I thought it was because php, but I have the version php 7.4.3.
Can you help me?
Thanks by advance!
Make sure you have the PHP Apache mod installed and enabled by:
sudo apt install libapache2-mod-php sudo a2enmod php7.4
Otherwise your web server knows nothing about php files and just shows them to the client.