I have installed magento 2 in my ubuntu and I tried to run magento setup, it print the index.php code.

Help me.


There are 3 possibilities:

1. You don't have PHP installed. In that case run:

sudo apt-get install php php-mysql

2. You have PHP installed but not enabled. You can try running:

sudo a2enmod php7  
sudo service apache2 restart  

3. You have PHP installed and enabled but you haven't restarted apache.

sudo service apache2 restart
  • Thanks for response, I will check and let you know. – Sakthivel May 20 '19 at 7:15
  • Hi, I tried your instructions Everything is well. But I tried to run the page again, shown localhost is currently unable to handle this request. (HTTP ERROR 500). – Sakthivel May 20 '19 at 7:33
  • try to sudo chmod -R 777 /"your files location" – Savan Patel May 20 '19 at 8:36

if you have above answer, depending on which magento 2 version you are trying to install.

for e.g. if you are going with > 2.3 you must be needing php

~7.1.3 ~7.2.0.

if that's not the case with you, then coming towards your 500 error. which usually means something is not right with the code. the possible url might not exist.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.