ZeratulsDomain3 Posted February 15, 2011 Share Posted February 15, 2011 At work I wrote many classes/function that are hundreds of lines of code. This code rarely changes, but it does happen. Some of this code is also used in all 4 of the sites. Problem right now is I have "4 sites" with duplicate code on them (copy/pasted). All on a single server running IIS. How can set this up so all 4 sites "share" the same PHP code? My temporary "dirty" fix to this has been to: Setup a 5th site in IIS. Setup a firewall rule to block any access to it, then rename all my PHP files to ".txt" files then simple do "require "somePHPcode.txt" (this way IIS wont "run them" before sending them). This works, but its not very elegant. Got a better method? Link to comment https://forums.phpfreaks.com/topic/227749-how-to-share-my-classes/ Share on other sites More sharing options...
zenlord Posted February 15, 2011 Share Posted February 15, 2011 What you really want to do, seems like a possible security-flaw to me: fetching external scripts to run on your server... Wouldn't an account with f.e. github not be better? You put all classes together, you can maintain your code very easily and everytime you make some adjustments, you can simply fetch the updates with git... Link to comment https://forums.phpfreaks.com/topic/227749-how-to-share-my-classes/#findComment-1174529 Share on other sites More sharing options...
ZeratulsDomain3 Posted February 16, 2011 Author Share Posted February 16, 2011 Found a solution: http://www.php.net/manual/en/ini.core.php#ini.include-path Link to comment https://forums.phpfreaks.com/topic/227749-how-to-share-my-classes/#findComment-1174985 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.