scbookz Posted July 27, 2009 Share Posted July 27, 2009 if i find a new function i like where do i put it on my server? for it to work all parts of the system i use linux ubuntu is there a file i can put all functions so that anytime a function is called that it will be seen no matter what? thanks im new Link to comment https://forums.phpfreaks.com/topic/167677-if-i-find-a-new-function-i-like-where-do-i-put-it-on-my-server-for-it-to-work/ Share on other sites More sharing options...
patrickmvi Posted July 27, 2009 Share Posted July 27, 2009 You'd have to put it in an extension or modify the PHP source and compile it right in. You could also put a global include file (usually in /usr/local/lib/php) that you can then call from any application without providing a path. So if you made a file called "my_shared_functions.php" and placed it in "/usr/local/lib/php" then you could "include" it from anywhere in your system using just include("my_shared_functions.php"). Link to comment https://forums.phpfreaks.com/topic/167677-if-i-find-a-new-function-i-like-where-do-i-put-it-on-my-server-for-it-to-work/#findComment-884297 Share on other sites More sharing options...
waynew Posted July 27, 2009 Share Posted July 27, 2009 Save it in a folder called functions to keep yourself organised. Then: require("functions/filenameoffunction.php"); $result = myFunction(); Link to comment https://forums.phpfreaks.com/topic/167677-if-i-find-a-new-function-i-like-where-do-i-put-it-on-my-server-for-it-to-work/#findComment-884304 Share on other sites More sharing options...
scbookz Posted July 27, 2009 Author Share Posted July 27, 2009 i like this idea and this was what i was asking--> So if you made a file called "my_shared_functions.php" and placed it in "/usr/local/lib/php" then you could "include" it from anywhere in your system using just include("my_shared_functions.php"). this also works with shell commands if a functionis in a certain part of the system it works always no matter where you are Link to comment https://forums.phpfreaks.com/topic/167677-if-i-find-a-new-function-i-like-where-do-i-put-it-on-my-server-for-it-to-work/#findComment-884349 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.