Search code examples
phpyii2yii2-basic-app

How to run the yii framework?


I have set up my project, in which I had created the Yii framework in a separate folder & I linked it with index.php. So that if I run my index.php I could access my framework.

Folder Structure,
README.md
node_modules/
package.json
public/ [FE Public Folder]
src/ [React Code]
protected/ [YII BE code]
sql/ [SQL Scripts]
framework/ [YII Code]
js/ [JS Assets]
css/ [CSS Assets]
.env[*]
yarn.lock

I also have the .htaccess file. The issue I'm facing now is when I run my inde.php it just shows the #!/usr/local/bin/env php message.

screenshot

I don't know why this message shows up.


Solution

  • Firstly, a script containing #!/usr/local/bin/env php is usually a script that would be run from the terminal, and not one served up by Apache or NginX.

    Secondly, that top line would instantly be classed as output, and so yes would be the first thing to display on your page. And if your display_errors is set to off (I recommend that btw, tail your log instead) then if anything goes wrong you won't see anything other than this message.

    Try to run that script from the command line, if indeed it is one. If it is a file you yourself created, just remove that line and start with <?php.

    Not exactly an answer, but I hope it helps, and if it does I will update it.