-1

I have written a text through the editor and put a php code in the editor to be displayed in the post.

But the php code does not run on the site! And I get this message:

The code does not run on the site!

What should be done to solve the problem and how should the code be executed?

This system is not WordPress and is a proprietary CMS

I published the code through the database, but it still shows inside <!——>

enter image description here

  • PHP code will only execute from a few extensions such as .php. If its an .html file, then PHP does not execute. – Rohit Gupta Jan 22 '23 at 03:20
  • Do you want to execute that PHP code? or do you want to display the code as it is? – Pisumathu Jan 22 '23 at 03:20
  • Code that you store in the DB will likely be treated as text by the application and not executed. The only way for it to be executed in that situation would be if the php code thsy reads it from the DB called `eval()` on it, but that represents a big security risk for the application (because it would be executing arbitrary, unknown user-generated code on the fly) - even the makers of that function recommend that it isn't used except as a last resort. – ADyson Jan 22 '23 at 07:53
  • Please show your code, not the final output – Rohit Gupta Jan 22 '23 at 14:22
  • @RohitGupta actually in this case the final output is very helpful, as it points to the root of the problem. – ADyson Jan 22 '23 at 18:35

1 Answers1

0

what you are trying to do is illegal, PHP code cannot be inserted through the browser editor, PHP code is usually code hidden from the eyes of the surfers, whether it is a function or not.

The only way to insert PHP code is to go into the site's files in the area you want to insert and simply edit it from the file, usually its ending will be .php if it is a CRM system then its code is built in the form of JS or Python and if it is built on PHP then just go into the system and insert the code

<?php echo 'Hello world'; ?>
  • I published the code through the database, but it still shows inside <!——> https://i.stack.imgur.com/gBjzL.png – Sina Parse Jan 22 '23 at 03:02