Q695 Posted March 4, 2015 Share Posted March 4, 2015 (edited) 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. Edited March 4, 2015 by Q695 Quote 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. Quote 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. 1 Quote Link to comment https://forums.phpfreaks.com/topic/295063-processing-php-from-server-storage/#findComment-1507502 Share on other sites More sharing options...
Solution Q695 Posted March 4, 2015 Author Solution Share Posted March 4, 2015 got it:use "eval()" Quote 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 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. Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.