Well, it's not just php code that's going to be stored in the database, but basically the entire website.
The reasoning behind this is as follows:
I work in an institution where security of information is very important. The server I work with is a Solaris box running the Oracle IAS, and as such there is a lot more potential for really nasty things to happen were someone to exploit any potential security holes.
To allow PHP to write files directly to the webserver PHP runs as the user 'oracle', and with the IAS this user has access to MANY areas outside of the website and PHP.
The new site I'm building is going to be driven by a CMS, and due to the limitations of what I can and cannot do directly on the server, I have elected to run the CMS with a database back-end (PostgreSQL) instead of live files. For this reason I need to be able to store the code in the database and have it execute.
I did get a solution on another forum. It seems that you have to prepend a '?>' to the value you're trying to eval().
For example, if you have a variable, $foo, which you want to eval(), then you'd use the following:
eval ('?>' . $foo);
THoughts?
P.