Q695 Posted March 4, 2015 Share Posted March 4, 2015 How do I process PHP that I'm storing in a database (think eventually functions, and pages)? example of stored code: echo "it works here"; I'm working on designing an open source development community for nonprofits to work with volunteer developers. Link to comment https://forums.phpfreaks.com/topic/295063-processing-php-from-server-storage/ Share on other sites More sharing options...
Ch0cu3r Posted March 4, 2015 Share Posted March 4, 2015 Why are you needing to store PHP code in the database? This is not a very good idea. Link to comment https://forums.phpfreaks.com/topic/295063-processing-php-from-server-storage/#findComment-1507498 Share on other sites More sharing options...
maxxd Posted March 4, 2015 Share Posted March 4, 2015 You technically can store the php statements and functions in a database and run it using eval(), but, as Ch0cu3r pointed out (with massive understatement, btw), it's really not a good idea. You'd be far better off either creating or using an existing CMS or framework (think WordPress, Yii, Laravel, Drupal, etc.) that includes the functionality you need to run, but in a safer and more controlled manner. Link to comment https://forums.phpfreaks.com/topic/295063-processing-php-from-server-storage/#findComment-1507502 Share on other sites More sharing options...
Q695 Posted March 4, 2015 Author Share Posted March 4, 2015 got it:use "eval()" Link to comment https://forums.phpfreaks.com/topic/295063-processing-php-from-server-storage/#findComment-1507535 Share on other sites More sharing options...
Q695 Posted March 4, 2015 Author Share Posted March 4, 2015 On 3/4/2015 at 4:27 PM, Ch0cu3r said: Why are you needing to store PHP code in the database? This is not a very good idea. for developers also using the stored functions. Link to comment https://forums.phpfreaks.com/topic/295063-processing-php-from-server-storage/#findComment-1507536 Share on other sites More sharing options...
cyberRobot Posted March 4, 2015 Share Posted March 4, 2015 Have you considered saving the functions into include files and then import them as needed? You could still utilize a database to keep track of which include to use where. Link to comment https://forums.phpfreaks.com/topic/295063-processing-php-from-server-storage/#findComment-1507538 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.