1

Error . The opening PHP tag must be the first content in the file

My file code

FOUND 1 ERROR AFFECTING 1 LINE

enter image description here

code here

<?php
$installer = $this;
/* @var $installer Mage_Core_Model_Resource_Setup */

$installer->startSetup();

$installer->run("");
Qaisar Satti
  • 2,742
  • 2
  • 18
  • 36
  • Post code instead of image or with image. – Prafulla Kumar Sahu Jul 10 '17 at 06:52
  • @PrafullaKumarSahu added the code – Qaisar Satti Jul 10 '17 at 06:52
  • 3
    It looks like you're already doing what the message says. Maybe you have an invisible character before it, like BOM? – Barmar Jul 10 '17 at 06:54
  • What IDE are you using that's showing this warning? – Barmar Jul 10 '17 at 06:55
  • @Barmar but when i do this `startSetup(); $installer->run("");` error not showing – Qaisar Satti Jul 10 '17 at 06:55
  • @Barmar i showing in code sniffer i don't think it related to IDE. – Qaisar Satti Jul 10 '17 at 06:56
  • Didn't know about codesniffer, you showed a screenshot from an IDE, so I assumed that was where the message was coming from. – Barmar Jul 10 '17 at 06:59
  • When I copy/paste your code into a `temp.php` file and run the sniff over it, I don't get any errors. The command I used is `phpcs temp.php --standard=Generic --sniffs=Generic.PHP.CharacterBeforePHPOpeningTag`. I would suggest running `phpcs -vv /path/to/mysql4-install-0.1.0.php --standard=Generic --sniffs=Generic.PHP.CharacterBeforePHPOpeningTag` so you can see the tokens that come out when checking the file. Make sure the first one looks like this: `Process token [0]: T_OPEN_TAG => – Greg Sherwood Jul 10 '17 at 08:22
  • 1
    @GregSherwood it is some weird issue i have to create new file with same name the error is gone. – Qaisar Satti Jul 10 '17 at 09:02
  • 1
    @QaisarSatti It would have been interesting to see the verbose output, but I'm still glad you've managed to work around it with a new file. – Greg Sherwood Jul 10 '17 at 22:42

0 Answers0