Problems "config'ing" a file
Posted: Wed Aug 11, 2010 12:05 pm
Hello,
I am trying to install 'mailpars2em', a substitute for mailparse in environments where it is not possible to install that extension.
I am stuck in the installation instructions. At some point I am being given the following instruction:
"Copy 'http/prereq.php' to a web accessible directory, config it, and call it as a web page."
I do not know what "config'ing" a file is. I am aware this must be extremely obvious and simple, but my neural pathways are not making what I am sure must be a stupidly simple connection.
Can you help? What do they mean when they say "config the file"
The entire instructions are posted below for your reference. Any suggestions, clarifications, or comments are highly appreciated.
Thanks!
PS: Entire set of instructions
mailpars2em, ver.2007/11/09
///////////////////////////////////////////////////////////////
// Free, experimental, no warranties, use at your own risk.
// Emulates some of the 'mailparse' PECL extension by using the 'Mail/mimeDecode' PEAR package,
// enough for a workaround in Cerberus 4 RC1.
///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
// Installation
///////////////////////////////////////////////////////////////
1. See important notes in 'mailpars2em.php', etc., so you know what you're installing.
2. If you do not have a local php include_path, then make a directory, preferably not web accessible,
say '/foo/myext/'. If you already have one, pretend it is named '/foo/myext/'.
Copy in these two files:
/foo/myext/mailpars2em/mailpars2em.php
/foo/myext/mailpars2em/mailpars2em_funcs.php
3. Now there is a helper file to find out if you already have 'Mail/mimeDecode', a PEAR package.
Copy 'http/prereq.php' to a web accessible directory, config it, and call it as a web page.
It will try to load 'mailpars2em', which will look for the files it needs.
4. If 'prereq.php' does not run or says "cannot find 'mailpars2em'" then you need to config
the 'MAILPARS2EM_include_path_add' line.
5. If it says "'Mail/mimeDecode' not found", you can get the package by using 'pear', or directly:
http://pear.php.net/package/Mail_mimeDecode/
Copy the single file 'mimeDecode.php' to
/foo/myext/Mail/mimeDecode.php
6. If you are still having problems, check that PEAR is installed. See:
http://pear.php.net/manual/en/installation.getting.php
Note 'Mail/mimeDecode.php' requires 'PEAR.php'. If the screen is blank, check your PHP error logs.
7. If 'prereq.php' says 'OK' then you can config 'mailparse2em.php'.
Set the line defining 'MAILPARS2EM_include_path_add' the same as you did in 'prereq.php'.
Even better find the line about '.htaccess' for apache, uncomment it and run 'prereq.php' again
for the suggested fix. If you get '.htaccess' set up, then comment out the line defining
'MAILPARS2EM_include_path_add' in 'mailpars2em.php'.
Delete 'prereq.php'.
8. If all looks good, you can try 'mailpars2em' in Cerberus 4. There are four files to modify.
* cerb4/install/index.php
* optional: cerb4/install/servercheck.php
* cerb4/api/app/Parser.php
* cerb4/plugins/cerberusweb.core/cron.classes.php
At the top of each file, after the '?php' line, put in this line:
include_once('mailpars2em/mailpars2em.php');
In the two 'cerb4/install/' files you can search down to this line:
if(extension_loaded("mailparse")) {
and change it to:
if(defined('MAILPARS2EM') || extension_loaded("mailparse")) {
You'll be deleting the whole 'install/' directory after install anyway, so you could
just hack the line if you don't want to check that the package loads.
9. Cerb4 should install now.
10. Once you get it going, send in an email and use the Cerb4 browser window to see how it parses.
That thing works on a schedule, and page reloads do not override. There is also a way to inject
emails as files right into the pending directory, I believe. Anyway, this is the browser window
that does the parsing and it will show you the 'mailpars2em' logging to screen:
Right-hand menu, under your name:
[ configuration ]
Then submenu item:
[ scheduler ]
Then go to the link:
"Simple: automatically run jobs in a browser window"
If it starts to parse but doies not end with Cerb4's "time elapsed" bolded line, then you have a
problem. Check your PHP error logs.
11. You can turn off logging to the screen, and/or turn on logging to a file, and other options,
with the define()'s in the first function in 'mailpars2em.php'.
12. Updating Cerberus using SVN. It will probably play well with the two modded files.
Look for 'C ' conflict warnings in the SVN output, or open the two files and look for
'>>>>>>' crapola. Note the Cerb4 files are full of mixed line endings, some \r\n, some \n,
so when you mod and upload files they probably won't match even if they the same.
To view a SVN diff, use this option:
svn diff -x --ignore-eol-style
If Cerberus really changes how it uses 'mailparse_*', then you might at least start to get error
messages, as there is a fair amount error checking built into 'mailpars2em'. Maybe fixes will
get posted, contact info below.
///////////////////////////////////////////////////////////////
// Contact
///////////////////////////////////////////////////////////////
PM me on http://www.cerb4.com/forums, user 'kitchin'.
Ther may be some more info on this Wiki:
http://wiki.cerberusdemo.com/index.php/Installing_4.0
///////////////////////////////////////////////////////////////
// MANIFEST
// [Only the first two PHP files are required.]
///////////////////////////////////////////////////////////////
mailpars2em/_readme.txt
mailpars2em/mailpars2em.php
mailpars2em/mailpars2em_funcs.php
mailpars2em/http/prereq.php
mailpars2em/tester/_readme.txt
mailpars2em/tester/dotest.bat
mailpars2em/tester/php_tester-1.ini
mailpars2em/tester/php_tester-2.ini
mailpars2em/tester/tester.php
mailpars2em/tester/tester_code.php
mailpars2em/tester/testmsgs/sample1.txt
mailpars2em/tester/testmsgs/sample2.txt
mailpars2em/tester/testmsgs/sample3.txt
mailpars2em/tester/testmsgs/sample4.txt
mailpars2em/tester/testmsgs/cpan_mime-tools/_readme.txt
mailpars2em/tester/testmsgs/cpan_mime-tools/ak-0696.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/bluedot-postcard.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/bluedot-simple.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/dup-names.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/empty-preamble.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/frag.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/german.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/german-qp.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/hdr-fakeout.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/multi-2evil.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/multi-2gifs.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/multi-clen.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/multi-digest.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/multi-frag.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/multi-igor.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/multi-igor2.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/multi-nested.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/multi-nested2.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/multi-nested3.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/multi-simple.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/multi-weirdspace.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/re-fwd.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/russian.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/simple.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/uu-junk.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/uu-junk-target.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/uu-zeegee.msg
mailpars2em/tester/testmsgs/php_mailparse/_readme.txt
mailpars2em/tester/testmsgs/php_mailparse/mime.txt
mailpars2em/tester/tmp/
///////////////////////////////////////////////////////////////
// End.
I am trying to install 'mailpars2em', a substitute for mailparse in environments where it is not possible to install that extension.
I am stuck in the installation instructions. At some point I am being given the following instruction:
"Copy 'http/prereq.php' to a web accessible directory, config it, and call it as a web page."
I do not know what "config'ing" a file is. I am aware this must be extremely obvious and simple, but my neural pathways are not making what I am sure must be a stupidly simple connection.
Can you help? What do they mean when they say "config the file"
The entire instructions are posted below for your reference. Any suggestions, clarifications, or comments are highly appreciated.
Thanks!
PS: Entire set of instructions
mailpars2em, ver.2007/11/09
///////////////////////////////////////////////////////////////
// Free, experimental, no warranties, use at your own risk.
// Emulates some of the 'mailparse' PECL extension by using the 'Mail/mimeDecode' PEAR package,
// enough for a workaround in Cerberus 4 RC1.
///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
// Installation
///////////////////////////////////////////////////////////////
1. See important notes in 'mailpars2em.php', etc., so you know what you're installing.
2. If you do not have a local php include_path, then make a directory, preferably not web accessible,
say '/foo/myext/'. If you already have one, pretend it is named '/foo/myext/'.
Copy in these two files:
/foo/myext/mailpars2em/mailpars2em.php
/foo/myext/mailpars2em/mailpars2em_funcs.php
3. Now there is a helper file to find out if you already have 'Mail/mimeDecode', a PEAR package.
Copy 'http/prereq.php' to a web accessible directory, config it, and call it as a web page.
It will try to load 'mailpars2em', which will look for the files it needs.
4. If 'prereq.php' does not run or says "cannot find 'mailpars2em'" then you need to config
the 'MAILPARS2EM_include_path_add' line.
5. If it says "'Mail/mimeDecode' not found", you can get the package by using 'pear', or directly:
http://pear.php.net/package/Mail_mimeDecode/
Copy the single file 'mimeDecode.php' to
/foo/myext/Mail/mimeDecode.php
6. If you are still having problems, check that PEAR is installed. See:
http://pear.php.net/manual/en/installation.getting.php
Note 'Mail/mimeDecode.php' requires 'PEAR.php'. If the screen is blank, check your PHP error logs.
7. If 'prereq.php' says 'OK' then you can config 'mailparse2em.php'.
Set the line defining 'MAILPARS2EM_include_path_add' the same as you did in 'prereq.php'.
Even better find the line about '.htaccess' for apache, uncomment it and run 'prereq.php' again
for the suggested fix. If you get '.htaccess' set up, then comment out the line defining
'MAILPARS2EM_include_path_add' in 'mailpars2em.php'.
Delete 'prereq.php'.
8. If all looks good, you can try 'mailpars2em' in Cerberus 4. There are four files to modify.
* cerb4/install/index.php
* optional: cerb4/install/servercheck.php
* cerb4/api/app/Parser.php
* cerb4/plugins/cerberusweb.core/cron.classes.php
At the top of each file, after the '?php' line, put in this line:
include_once('mailpars2em/mailpars2em.php');
In the two 'cerb4/install/' files you can search down to this line:
if(extension_loaded("mailparse")) {
and change it to:
if(defined('MAILPARS2EM') || extension_loaded("mailparse")) {
You'll be deleting the whole 'install/' directory after install anyway, so you could
just hack the line if you don't want to check that the package loads.
9. Cerb4 should install now.
10. Once you get it going, send in an email and use the Cerb4 browser window to see how it parses.
That thing works on a schedule, and page reloads do not override. There is also a way to inject
emails as files right into the pending directory, I believe. Anyway, this is the browser window
that does the parsing and it will show you the 'mailpars2em' logging to screen:
Right-hand menu, under your name:
[ configuration ]
Then submenu item:
[ scheduler ]
Then go to the link:
"Simple: automatically run jobs in a browser window"
If it starts to parse but doies not end with Cerb4's "time elapsed" bolded line, then you have a
problem. Check your PHP error logs.
11. You can turn off logging to the screen, and/or turn on logging to a file, and other options,
with the define()'s in the first function in 'mailpars2em.php'.
12. Updating Cerberus using SVN. It will probably play well with the two modded files.
Look for 'C ' conflict warnings in the SVN output, or open the two files and look for
'>>>>>>' crapola. Note the Cerb4 files are full of mixed line endings, some \r\n, some \n,
so when you mod and upload files they probably won't match even if they the same.
To view a SVN diff, use this option:
svn diff -x --ignore-eol-style
If Cerberus really changes how it uses 'mailparse_*', then you might at least start to get error
messages, as there is a fair amount error checking built into 'mailpars2em'. Maybe fixes will
get posted, contact info below.
///////////////////////////////////////////////////////////////
// Contact
///////////////////////////////////////////////////////////////
PM me on http://www.cerb4.com/forums, user 'kitchin'.
Ther may be some more info on this Wiki:
http://wiki.cerberusdemo.com/index.php/Installing_4.0
///////////////////////////////////////////////////////////////
// MANIFEST
// [Only the first two PHP files are required.]
///////////////////////////////////////////////////////////////
mailpars2em/_readme.txt
mailpars2em/mailpars2em.php
mailpars2em/mailpars2em_funcs.php
mailpars2em/http/prereq.php
mailpars2em/tester/_readme.txt
mailpars2em/tester/dotest.bat
mailpars2em/tester/php_tester-1.ini
mailpars2em/tester/php_tester-2.ini
mailpars2em/tester/tester.php
mailpars2em/tester/tester_code.php
mailpars2em/tester/testmsgs/sample1.txt
mailpars2em/tester/testmsgs/sample2.txt
mailpars2em/tester/testmsgs/sample3.txt
mailpars2em/tester/testmsgs/sample4.txt
mailpars2em/tester/testmsgs/cpan_mime-tools/_readme.txt
mailpars2em/tester/testmsgs/cpan_mime-tools/ak-0696.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/bluedot-postcard.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/bluedot-simple.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/dup-names.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/empty-preamble.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/frag.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/german.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/german-qp.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/hdr-fakeout.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/multi-2evil.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/multi-2gifs.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/multi-clen.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/multi-digest.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/multi-frag.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/multi-igor.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/multi-igor2.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/multi-nested.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/multi-nested2.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/multi-nested3.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/multi-simple.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/multi-weirdspace.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/re-fwd.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/russian.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/simple.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/uu-junk.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/uu-junk-target.msg
mailpars2em/tester/testmsgs/cpan_mime-tools/uu-zeegee.msg
mailpars2em/tester/testmsgs/php_mailparse/_readme.txt
mailpars2em/tester/testmsgs/php_mailparse/mime.txt
mailpars2em/tester/tmp/
///////////////////////////////////////////////////////////////
// End.