I
I
Igor Vasiliev2018-08-07 21:49:10
Yii
Igor Vasiliev, 2018-08-07 21:49:10

How to solve Use of undefined constant php - assumed 'php' error?

Hello.
--
Faced with a mysterious phenomenon:
Prehistory.
We decided to transfer the site from virtual hosting to VDS, Linux, Apache / 2.4.18 (Ubuntu) is installed there.
The site fits on the php 7.0.3 version
. So, in the controller, from all designs by type:

return $this->render($this->module->getCustomView('login'), [
            'model' => $model,
        ]);

the error was tied to the code above, namely to quotes, which are exactly the same as in other actions.
Of course, I hid all the errors through php.ini , and copied the quotes ''one to one, where the error did not come out on the pages, and I want to figure out what it really was?
The solution, of course, is very simple:
ISPmanager -> web server settings -> PHP -> settings -> basic -> Display all errors (uncheck) SAVE
There were suggestions that these were "magic quotes", but this also did not help - disabling nothing have not changed.
QUESTION: what was it, why did the error come out in a specific place, and not everywhere where there are exactly the same quotes ??

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Mykola, 2018-08-08
@iSensetivity

Look in the code for "php" and look there already.

A
andrejovdienko, 2019-08-03
@andrejovdienko

Make sure that the opening <?php tag on the specified line is separated from the following code by a space.

I
Igor Vasiliev, 2020-07-23
@Isolution666

For the future, to all those who code in the browser in the code editor.
If you use code editors on hosting, or use ISP Manager
After the first save, it will seem that you have saved the code, the next time after opening, you can find out that the code editor decided to stick everything in one line.
Moreover, ISP Manager has a bug of losing closing brackets, curly braces and other things like that. Again, the syntax error is revealed after closing the page with the code, and when you open it again, the syntax highlighting can move out.
Therefore, if you do not want such problems, try not to program in the browser, in the code editor. As I understand it, this is a bug of the same library, which is used everywhere where there are code editors and syntax highlighting. Use special programs or IDE to avoid code deformation after reupload.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question