INSTALL 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. REQUIREMENTS
  2. MapieRSS requires a recent PHP 4+ (developed with 4.2.0)
  3. with xml (expat) support.
  4. Optionally:
  5. * PHP5 with libxml2 support.
  6. * cURL for SSL support
  7. * iconv (preferred) or mb_string for expanded character set support
  8. QUICK START
  9. Magpie consists of 4 files (rss_fetch.inc, rss_parser.inc, rss_cache.inc,
  10. and rss_utils.inc), and the directory extlib (which contains a modified
  11. version of the Snoopy HTTP client)
  12. Copy these 5 resources to a directory named 'magpierss' in the same
  13. directory as your PHP script.
  14. At the top of your script add the following line:
  15. require_once('magpierss/rss_fetch.inc');
  16. Now you can use the fetch_rss() method:
  17. $rss = fetch_rss($url);
  18. Done. That's it. See README for more details on using MagpieRSS.
  19. NEXT STEPS
  20. Important: you'll probably want to get the cache directory working in
  21. order to speed up your application, and not abuse the webserver you're
  22. downloading the RSS from.
  23. Optionally you can install MagpieRSS in your PHP include path in order to
  24. make it available server wide.
  25. Lastly you might want to look through the constants in rss_fetch.inc see if
  26. there is anything you want to override (the defaults are pretty good)
  27. For more info, or if you have trouble, see TROUBLESHOOTING
  28. SETTING UP CACHING
  29. Magpie has built-in transparent caching. With caching Magpie will only
  30. fetch and parse RSS feeds when there is new content. Without this feature
  31. your pages will be slow, and the sites serving the RSS feed will be annoyed
  32. with you.
  33. ** Simple and Automatic **
  34. By default Magpie will try to create a cache directory named 'cache' in the
  35. same directory as your PHP script.
  36. ** Creating a Local Cache Directory **
  37. Often this will fail, because your webserver doesn't have sufficient
  38. permissions to create the directory.
  39. Exact instructions for how to do this will vary from install to install and
  40. platform to platform. The steps are:
  41. 1. Make a directory named 'cache'
  42. 2. Give the web server write access to that directory.
  43. An example of how to do this on Debian would be:
  44. 1. mkdir /path/to/script/cache
  45. 2. chgrp www-data /path/to/script/cache
  46. 3. chmod 775 /path/to/script/cache
  47. On other Unixes you'll need to change 'www-data' to what ever user Apache
  48. runs as. (on MacOS X the user would be 'www')
  49. ** Cache in /tmp **
  50. Sometimes you won't be able to create a local cache directory. Some reasons
  51. might be:
  52. 1. No shell account
  53. 2. Insufficient permissions to change ownership of a directory
  54. 3. Webserver runs as 'nobody'
  55. In these situations using a cache directory in /tmp can often be a good
  56. option.
  57. The drawback is /tmp is public, so anyone on the box can read the cache
  58. files. Usually RSS feeds are public information, so you'll have to decide
  59. how much of an issue that is.
  60. To use /tmp as your cache directory you need to add the following line to
  61. your script:
  62. define('MAGPIE_CACHE_DIR', '/tmp/magpie_cache');
  63. ** Global Cache **
  64. If you have several applications using Magpie, you can create a single
  65. shared cache directory, either using the /tmp cache, or somewhere else on
  66. the system.
  67. The upside is that you'll distribute fetching and parsing feeds across
  68. several applications.
  69. INSTALLING MAGPIE SERVER WIDE
  70. Rather then following the Quickstart instructions which requires you to have
  71. a copy of Magpie per application, alternately you can place it in some
  72. shared location.
  73. ** Adding Magpie to Your Include Path **
  74. Copy the 5 resources (rss_fetch.inc, rss_parser.inc, rss_cache.inc,
  75. rss_utils.inc, and extlib) to a directory named 'magpierss' in your include
  76. path. Now any PHP file on your system can use Magpie with:
  77. require_once('magpierss/rss_fetch.inc');
  78. Different installs have different include paths, and you'll have to figure
  79. out what your include_path is.
  80. From shell you can try:
  81. php -i | grep 'include_path'
  82. Alternatley you can create a phpinfo.php file with contains:
  83. <?php phpinfo(); ?>
  84. Debian's default is:
  85. /usr/share/php
  86. (though more idealogically pure location would be /usr/local/share/php)
  87. Apple's default include path is:
  88. /usr/lib/php
  89. While the Entropy PHP build seems to use:
  90. /usr/local/php/lib/php