1

I am new to Magento and PHP, and I am using Magento 2.1.2. I tried to create a new module as explained in http://magentoexplorer.com/how-to-build-hello-world-magento-2-module-from-scratch. After creating the folders and files under app/code, and running php magento setup:upgrade, the first thing that is prompted, before the list of modules, is the code of my registration.php file. I don't know why this is happening; this is the first step before being able to see my module enabled. I have Magento 2.1.2 installed over WAMP server, with sample data. Sample and admin page are working fine.

2 Answers 2

3

Make sure your registration.php file starts with <?php.
In the tutorial you linked the opening php tag is missing from the registration file, so php interprets this as an html file and just outputs the content.

1

Use this code below: use \Magento\Framework\Component\ComponentRegistrar;

 ComponentRegistrar::register(ComponentRegistrar::THEME,'<area>/<vendor>/<theme name>', __DIR__);

Where <area> is the functional area of the module (frontend, controller, and so on.), <vendor> is the name of the company providing the theme, and <theme name> is the name of the theme.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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