Difference between pages "PHP" and "Sucknews"

From Wikislax
(Difference between pages)
Jump to: navigation, search
(Created page with "{{RightTOC}} == What is PHP ? == [http://www.php.net PHP] is a widely-used general-purpose scripting language that is specially suited for Web development and can be embedde...")
 
(Installing Sucknews)
 
Line 1: Line 1:
 
{{RightTOC}}
 
{{RightTOC}}
  
== What is PHP ? ==
+
== What is Sucknews ? ==
  
[http://www.php.net PHP] is a widely-used general-purpose scripting language that is specially suited for Web development and can be embedded into HTML.
+
Sucknews affords getting the newsfeeds over a regular NNTP connection with your Internet Service Provider. This comes in handy when you are not a big company and have no agreements with peer Newsgroup servers.
  
== Compiling c-client ==
+
== Installing Sucknews ==
  
The php imap option requires presence of library c-lient, which is part of Imap-uw, by the University of Washington. [ftp://ftp.cac.washington.edu/imap/c-client.tar.Z Download] the software, untar and install :  
+
There was a time when sucknews was available from [http://www.sucknews.org sucknews.org] but this site has disappeared and there seems to be no obvious source of sucknews update software so we'll stick with an old [{{SERVER}}/wikislax/download/suck-4.3.2.tar.gz version] (perfectly satisfactory anyway). Untar and install as below :
  
# gunzip c-client.tar.Z
+
  # tar -C /usr/local -xvf suck-x.y.z.tar.gz
  # tar -C /usr/local -xvf c-client.tar
 
 
  # cd /usr/local
 
  # cd /usr/local
  # chown -R root:root imap-2007f
+
  # chown -R root:root suck-x.y.z.tar.gz
  # chmod -R o-w imap-2007f
+
  # cd suck-x.y.z.tar.gz
  # cd imap2007f
+
# ./configure --help | less
  # make slx EXTRACFLAGS="-I/usr/include/openssl -g -O2 -fPIC" SSLCERTS=/etc/ssl/certs SSLKEYS=/etc/ssl/private
+
  # ./configure --prefix=/usr/local/news --libdir=/usr/local/news/lib64 --mandir=/usr/local/man \
 +
  --with-inn-lib=/usr/local/news/lib --with-inn-include=/usr/local/news/include --with-perl-exe=/usr/bin
 +
# make
 +
# make install
 +
# make clean
 +
# cd /usr/local/news/bin
 +
# chown <nowiki>news:news</nowiki> lmove rpost suck testhost
  
== Compiling PHP ==
+
== Running Sucknews ==
  
As PHP is part of the Slackware distribution, it's possible to skip the compilation step. If this is your choice, please note that '''/etc''' will be used for configuration files '''/usr/local/etc''', and proceed to [[PHP#Configuring PHP|Configuring PHP]].
+
The below script affords posting the local messages and get entering messages on your Internet Service Provider site :
  
Use '''./configure --help | less''' to review the configuration options. '''--with-apxs2''' is to work with apache 2. '''--with-mysql=/usr/local/mysql --with-mysql-sock=/var/run/mysql/mysql.sock''' specify mysql use. '''--enable-mbstring''' and '''--with-mcrypt''' are recommended by phpMyAdmin. Some other options are required by Horde : '''--with-gettext''' to provide local translations of text, '''--with-iconv --enable-mbstring --enable-mbregex''' to handle multibyte character sets, '''--with-gd''' to perform image manipulations. '''--with-zlib''' is for page compression and handling of zip and gz data. Other options reflect the network configuration and solftware installed earlier on this site.
+
# su news
 +
$ cd /usr/local/news/bin
 +
$ '''vi suck.sh'''
 +
'''i'''
 +
#!/bin/sh
 +
 +
NNTP_SERVER=news.free.fr
 +
NEWS_PATH=/usr/local/news
 +
BIN_PATH=/usr/local/news/bin
 +
SUCK_PATH=/usr/local/news/bin
 +
BATCH_PATH=/usr/local/news/spool/outgoing/free
 +
FILTER_PATH=$SUCK_PATH/filter.sh
 +
 +
cd $SUCK_PATH
 +
 +
######################################################
 +
# posting outgoing articles (localhost->NNTP_SERVER) #
 +
######################################################
 +
 +
echo "Sending articles..."
 +
if test -s $BATCH_PATH
 +
then
 +
$BIN_PATH/rpost $NNTP_SERVER -b $BATCH_PATH \
 +
    -f $FILTER_PATH \$\$o=/tmp/filtered \$\$i /tmp/filtered
 +
else
 +
    echo "No articles to post..."
 +
fi
 +
 +
######################################################
 +
# getting incoming articles (NNTP_SERVER->localhost) #
 +
######################################################
 +
 +
echo Getting articles...
 +
if [ -e /tmp/newposts ]; then
 +
    rm /tmp/newposts
 +
fi
 +
$BIN_PATH/suck $NNTP_SERVER -AL $NEWS_PATH/db/active -i 0 -n -H -K -br /tmp/newposts -c
 +
if [ -e /tmp/newposts ]; then
 +
    $BIN_PATH/rnews /tmp/newposts
 +
fi
 +
cat /dev/null > $BATCH_PATH
 +
'''<esc>'''
 +
''':x'''
 +
$ chmod u+x suck.sh
 +
$ ./suck.sh
 +
Sending articles...
 +
No articles to post...
 +
Getting articles...
 +
Attempting to connect to news.free.fr
 +
Using Port 119
 +
Official host name: news.free.fr
 +
Address: 212.27.60.38
 +
Address: 212.27.60.39
 +
Address: 212.27.60.37
 +
Address: 212.27.60.40
 +
Connected to news.free.fr
 +
200 news-4.free.fr (4-2) NNRP Service Ready - newsmaster@proxad.net (posting ok)
 +
No sucknewsrc to read, creating
 +
Adding new groups from local active file to sucknewsrc
 +
New Group - adding to sucknewsrc: control
 +
control - 1 articles 3983-3983
 +
New Group - adding to sucknewsrc: control.cancel
 +
control.cancel - 349 articles 94271852-94272200
 +
New Group - adding to sucknewsrc: control.checkgroups
 +
control.checkgroups - 4 articles 5228-5231
 +
New Group - adding to sucknewsrc: control.newgroup
 +
control.newgroup - 1 articles 73186-73186
 +
New Group - adding to sucknewsrc: control.rmgroup
 +
control.rmgroup - 1 articles 30996-30996
 +
New Group - adding to sucknewsrc: junk
 +
junk - 1 articles 38322-38322
 +
New Group - adding to sucknewsrc: alt.os.linux.slackware
 +
alt.os.linux.slackware - 1907 articles 231211-233117
 +
Elapsed Time = 0 mins 0.72 seconds
 +
2227 Articles to download
 +
Deduping Elapsed Time = 0 mins 0.00 seconds
 +
Deduped, 2227 items remaining, 0 dupes removed.
 +
Total articles to download: 2227
 +
5290946 Bytes received in 1 mins 20.79 secs, BPS = 65489.2
 +
Closed connection to news.free.fr
 +
Building RNews Batch File(s)
 +
Cleaning up after myself
 +
news@inner:/usr/local/news/bin$
 +
<ctrl>d
 +
#
  
We also create a few hard links as by default php searches for libraries in lib and cannot find the libraries in lib64.
+
In the first part, messages are posted to the provider using '''rpost'''. The list of articles is obtained from the information contained in newsfeed file '''/usr/local/news/spool/outgoing/free'''. The '''-f''' option affords applying a filter to the messages so as to expurge certain headers :
  
  # tar -C /usr/local -xvf php-x.y.z.tar.gz
+
  #!/bin/sh
  # cd /usr/local/php-x.y.z
+
  /usr/local/news/bin/sm -R $1 | sed -e "/^X-Trace/d" -e "/^NNTP-Posting-Host/d" \
# ln -s /usr/lib64/libjpeg.so /usr/lib
+
  -e "/^Xref/d" -e "/^X-Complaints-To/d" -e "/^NNTP-Posting-Date/d" > $2
# ln -s /usr/lib64/libpng.so /usr/lib
+
 
# ln -s /usr/local/lib64/libldap.so /usr/local/lib
+
In the second part, suck gets the messages from your Internet Service Provider. The '''-AL''' option affords using the list of groups defined. '''-i 0''' indicates that there is no limit on the number of messages to get, '''-n''' is for the mode « messages identified by their numbers by the provider » '''-c''' is to update the numbers after the end of the operation, '''-br''' defines the output file, '''-H''' and '''-K''' afford skipping the historic and killfile options. The file written is afterwards used by '''rnews'''. The articles are then available.
# ln -s /usr/local/lib64/libldap_r.so /usr/local/lib
 
# ln -s /usr/local/lib64/liblber.so /usr/local/lib
 
# mkdir /usr/local/mysql/lib
 
# ln -s /usr/local/mysql/lib64/libmysqlclient.so /usr/local/mysql/lib
 
# ln -s /usr/local/mysql/lib64/libmysqlclient.so.18 /usr/local/mysql/lib
 
  # ln -s /usr/local/mysql/lib64/libmysqlclient_r.so /usr/local/mysql/lib
 
# less INSTALL
 
# ./configure --help | less
 
# CFLAGS="-g -O2 -fPIC" ./configure --libdir=/usr/local/lib64 --sysconfdir=/etc \
 
--with-apxs2=/usr/local/bin/apxs --with-mysql=/usr/local/mysql --with-pdo-mysql \
 
--with-mysql-sock=/var/run/mysql/mysql.sock --enable-mbstring --with-mcrypt \
 
--with-gettext --with-iconv --enable-mbregex --with-gd --with-zlib --disable-ipv6 \
 
--enable-ftp --with-openssl --with-ldap=/usr/local --with-ldap-sasl \
 
--with-imap=/usr/local/imap-2007f --with-imap-ssl --enable-opcache=no
 
# make
 
# make test
 
# removepkg /var/log/packages/php-x.y.z
 
# /etc/rc.d/rc.httpd stop
 
# make install
 
# make clean
 
# cp php.ini-production /etc/httpd/php.ini
 
  
== Configuring PHP ==
+
== Automating Sucknews ==
  
The PHP configuration is defined in file '''php.ini''' and seems to be possibly installed in various locations, for example '''/etc/httpd''' or '''/usr/local/lib64/php.ini'''. Edit '''/etc/httpd/httpd.conf''' and add line '''LoadModule php5_module modules/libphp5.so''' to load the php module. The '''make install''' might have added this for you but be sure to check. Also tell apache to parse certain extensions as PHP adding line '''AddType application/x-httpd-php .php''', and to show highlighted PHP source adding line '''AddType application/x-httpd-php-source .phps'''. Last restart apache using '''/etc/rc.d/rc.httpd start'''.
+
Automate Sucknews execution using '''crontab'''. In the example below, suck.sh is executed at 13:00 daily :
  
<u>Note</u> : when requiring to recompile or play around with configuration options, be sure to clear your browser's cache between trials.
+
# su news
 +
$ crontab -e
 +
# MIN HOUR DAY MONTH DAYOFWEEK COMMAND
 +
00 13 * * * /usr/local/news/bin/suck.sh
 +
30 13 * * * /usr/local/news/bin/news.daily expireover lowmark
  
 
<br/>
 
<br/>
  
{{pFoot|[[Apache]]|[[Main Page]]|[[PhpMyAdmin]]}}
+
{{pFoot|[[INN]]|[[Main Page]]|[[Asterisk]]}}

Latest revision as of 06:41, 7 July 2018

What is Sucknews ?

Sucknews affords getting the newsfeeds over a regular NNTP connection with your Internet Service Provider. This comes in handy when you are not a big company and have no agreements with peer Newsgroup servers.

Installing Sucknews

There was a time when sucknews was available from sucknews.org but this site has disappeared and there seems to be no obvious source of sucknews update software so we'll stick with an old version (perfectly satisfactory anyway). Untar and install as below :

# tar -C /usr/local -xvf suck-x.y.z.tar.gz
# cd /usr/local
# chown -R root:root suck-x.y.z.tar.gz
# cd suck-x.y.z.tar.gz
# ./configure --help | less
# ./configure --prefix=/usr/local/news --libdir=/usr/local/news/lib64 --mandir=/usr/local/man \
--with-inn-lib=/usr/local/news/lib --with-inn-include=/usr/local/news/include --with-perl-exe=/usr/bin
# make
# make install
# make clean
# cd /usr/local/news/bin
# chown news:news lmove rpost suck testhost

Running Sucknews

The below script affords posting the local messages and get entering messages on your Internet Service Provider site :

# su news
$ cd /usr/local/news/bin
$ vi suck.sh
i
#!/bin/sh

NNTP_SERVER=news.free.fr
NEWS_PATH=/usr/local/news
BIN_PATH=/usr/local/news/bin
SUCK_PATH=/usr/local/news/bin
BATCH_PATH=/usr/local/news/spool/outgoing/free
FILTER_PATH=$SUCK_PATH/filter.sh

cd $SUCK_PATH

######################################################
# posting outgoing articles (localhost->NNTP_SERVER) #
######################################################

echo "Sending articles..."
if test -s $BATCH_PATH
then
$BIN_PATH/rpost $NNTP_SERVER -b $BATCH_PATH \
    -f $FILTER_PATH \$\$o=/tmp/filtered \$\$i /tmp/filtered
else
    echo "No articles to post..."
fi

######################################################
# getting incoming articles (NNTP_SERVER->localhost) #
######################################################

echo Getting articles...
if [ -e /tmp/newposts ]; then
    rm /tmp/newposts
fi
$BIN_PATH/suck $NNTP_SERVER -AL $NEWS_PATH/db/active -i 0 -n -H -K -br /tmp/newposts -c
if [ -e /tmp/newposts ]; then
    $BIN_PATH/rnews /tmp/newposts
fi
cat /dev/null > $BATCH_PATH
<esc>
:x
$ chmod u+x suck.sh
$ ./suck.sh
Sending articles...
No articles to post...
Getting articles...
Attempting to connect to news.free.fr
Using Port 119
Official host name: news.free.fr
Address: 212.27.60.38
Address: 212.27.60.39
Address: 212.27.60.37
Address: 212.27.60.40
Connected to news.free.fr
200 news-4.free.fr (4-2) NNRP Service Ready - newsmaster@proxad.net (posting ok)
No sucknewsrc to read, creating
Adding new groups from local active file to sucknewsrc
New Group - adding to sucknewsrc: control
control - 1 articles 3983-3983
New Group - adding to sucknewsrc: control.cancel
control.cancel - 349 articles 94271852-94272200
New Group - adding to sucknewsrc: control.checkgroups
control.checkgroups - 4 articles 5228-5231
New Group - adding to sucknewsrc: control.newgroup
control.newgroup - 1 articles 73186-73186
New Group - adding to sucknewsrc: control.rmgroup
control.rmgroup - 1 articles 30996-30996
New Group - adding to sucknewsrc: junk
junk - 1 articles 38322-38322
New Group - adding to sucknewsrc: alt.os.linux.slackware
alt.os.linux.slackware - 1907 articles 231211-233117
Elapsed Time = 0 mins 0.72 seconds
2227 Articles to download
Deduping Elapsed Time = 0 mins 0.00 seconds
Deduped, 2227 items remaining, 0 dupes removed.
Total articles to download: 2227
5290946 Bytes received in 1 mins 20.79 secs, BPS = 65489.2
Closed connection to news.free.fr
Building RNews Batch File(s)
Cleaning up after myself
news@inner:/usr/local/news/bin$
<ctrl>d
#

In the first part, messages are posted to the provider using rpost. The list of articles is obtained from the information contained in newsfeed file /usr/local/news/spool/outgoing/free. The -f option affords applying a filter to the messages so as to expurge certain headers :

#!/bin/sh
/usr/local/news/bin/sm -R $1 | sed -e "/^X-Trace/d" -e "/^NNTP-Posting-Host/d" \
-e "/^Xref/d" -e "/^X-Complaints-To/d" -e "/^NNTP-Posting-Date/d" > $2

In the second part, suck gets the messages from your Internet Service Provider. The -AL option affords using the list of groups defined. -i 0 indicates that there is no limit on the number of messages to get, -n is for the mode « messages identified by their numbers by the provider » -c is to update the numbers after the end of the operation, -br defines the output file, -H and -K afford skipping the historic and killfile options. The file written is afterwards used by rnews. The articles are then available.

Automating Sucknews

Automate Sucknews execution using crontab. In the example below, suck.sh is executed at 13:00 daily :

# su news
$ crontab -e
# MIN HOUR DAY MONTH DAYOFWEEK COMMAND
00 13 * * * /usr/local/news/bin/suck.sh
30 13 * * * /usr/local/news/bin/news.daily expireover lowmark


INN Main Page Asterisk