php-general Digest 21 Aug 2012 04:32:19 -0000 Issue 7931

Topics (messages 318769 through 318785):

Re: OT (maybe not): Drupal vs WordPress
        318769 by: Simon Schick
        318770 by: Lester Caine

[PHP-DEV] Separate apc-caches for each fpm-pool
        318771 by: Simon Schick

Re: How do I do count the occurrence of each word?
        318772 by: Ford, Mike

Crash course
        318773 by: Lester Caine
        318774 by: Simon Schick
        318775 by: Lester Caine
        318776 by: Simon Schick
        318777 by: Lester Caine
        318780 by: admin
        318782 by: Lester Caine

Re: Display Array Tree as Menu - Can't figure out how to finddepth with 
something over 2 levels : ANSWERED
        318778 by: Maciek Sokolewicz

Re: Cost of redirect and site domain switch? Good Practice/ Bad Practice / 
Terrible Practice
        318779 by: Jim Giner
        318781 by: Sebastian Krebs

mysqlnd and mysqli as shared extensions?
        318783 by: Lester Caine
        318784 by: David OBrien

Re: extract Occurrences AFTER ... and before "-30-"
        318785 by: John Taylor-Johnston

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Hi, all

+1 for that Joomla sucks ... worked with it for a while and just got
more and more disappointed of the way they write stuff. Just look at
how complicate it is to write an extension ...

Just a bit off-toppic (since you're talking about WP vs Drupal), but I
use Wordpress for small blogs and pages where I know that people don't
have that much experience with creating webpages and so on and need
very simple systems,
and TYPO3 for more complex pages (multiple domains, multi language,
complex submenus) because the system has it's own
configuration-language (TypoScript) that this let you do so many
things, way faster than writing it down in PHP. Another good bonus is
that you can decide to hide each single checkbox, inputfield or even
selections in a selectbox in the backend for an average person
administrating the web-content.

But because of the own configuration-language the learning-curve of
TYPO3 is (in my opinion) the highest of all CMS-systems for
developers.

One thing I also really like at the TYPO3-philolsophy: If someone
finds a security-issue he should immediately get in contact with the
developers (of the extension and the TYPO3 security team) and discuss
the issue with them. They decide how critical the bug is and will do a
hard work to get the fix as soon as possible. If it is a very critical
issue (someone could gain admin-access by something) they will send
out an email that there will be a bugfix coming out at next-coming day
at 9 o'clock GMT and everyone is advised to update his TYPO3-core or
the extension. This is something I really like! To be prepared for
some critical fix and knowing that (in a perfect case) no-one should
have heard about that issue before who wants to hack my website :)

Don't know if there's some similar security-policy in other
communities than this :)

Bye
Simon

On Sun, Aug 19, 2012 at 11:39 PM, Michael Shadle <mike...@gmail.com> wrote:
>
> If you are going to use something like joomla, use Drupal. Why bother.
> Drupal is trending up and is used by large companies and governments. Joomla
> is hokey. Yes this is going to spawn a religious debate. But joomla sucks.
> Sorry folks.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
l...@afan.net wrote:
Special points for me are (not a must, though)
- multiple websites with single core (both CMSs have the capability but I
got impression Drupal does it better?) because of maintenance
- compatibility with CiviCRM

There are a lot more than just Drupal and WordPress and as others have said, Wordpress is not really a 'CMS' so unless you just want to publish pages, there is not really a discussion here ... except ...

Your starting point should perhaps be 'What do I need?' and then look at some of the comparison sites. I don't know what the list is up to now, but http://www.cmsmatrix.org/ is an extensive cross reference, and comparing Drupal and WordPress here would suggest there is less of a difference than seems to be the case in practice.

> Once I decide what to use, I have to stick with it for a while.

My own choice does not fair well on cmsmatrix ...
http://www.cmsmatrix.org/matrix/cms-matrix/bitweaver
But I've not found any compelling reasons to think that any of the other options will do any better and I CAN at least create custom package add-ons, something which a previous attempt at using Drupal simply failed to achieve. You need to stick with something that YOU are comfortable with, and perhaps switch again if you find that it's not providing what you want.

I'm having to interface with third party CRM systems, so the flexibility of something that I've worked with for years certainly helps ...

--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk



--- End Message ---
--- Begin Message ---
Hi, all

Not to get the bugfix https://bugs.php.net/bug.php?id=57825 too much
off-topic, I write this question in the mailinglist here:

Taking the case I have two fpm-pools on different sockets - the first
pool is responsible for www.example1.com and the second one for
www.example2.com.

If www.example1.com has 4 workers, they're all using the same
apc-cache. That's absolutely as expected. But also the workers of
www.example2.com are using this cache. In my opinion it would be nice
if the pools would have a separate cache.

I now found a solution for this: Just use more than one fpm-master
that is controlling the pools. (http://groups.drupal.org/node/198168)

Is this the way to go, or do you know of another way?
Should this be added to the APC- or fpm-documentation or is it enough
that you can find f.e. it using Google, if you need it?

Bye
Simon

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Marco Behnke [mailto:ma...@behnke.biz]
> Sent: 19 August 2012 06:39
> To: php-gene...@lists.php.net
> Subject: Re: [PHP] How do I do count the occurrence of each word?
> 
> Am 19.08.12 06:59, schrieb tamouse mailing lists:
> > On Sat, Aug 18, 2012 at 6:44 PM, John Taylor-Johnston
> > <jt.johns...@usherbrooke.ca> wrote:
> >> I want to parse this text and count the occurrence of each word:
> >>
> >> Sample Output:
> >>
> >> determined = 4
> >> fire = 7
> >> patrol = 3
> >> theft = 6
> >> witness = 1
> >> witnessed = 1
> >>

[...]

> > and then you just run through the words building an associative
> array
> > by incrementing the count of each word as the key to the array:
> >
> > foreach ($words as $word) {
> >     $freq[$word]++;
> > }
> 
> Please an existence check to avoid incrementing not set array keys
> 
> foreach ($words as $word) {
>   if (array_key_exists($word, $freq)) {
>     $freq[$word] = 1;
>   } else {
>     $freq[$word]++;
>   }
> }

Erm...

   $freq = array_count_values($words)

(http://php.net/array_count_values)


Cheers!

Mike

-- 
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,  
Portland PD507, City Campus, Leeds Metropolitan University,
Portland Way, LEEDS,  LS1 3HE,  United Kingdom 
E: m.f...@leedsmet.ac.uk     T: +44 113 812 4730





To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

--- End Message ---
--- Begin Message --- OK - MySQL is not an area I've had to bother with, but I'm trying to sort out a tranche of websites that 1&1 messed up the DNS on last week and we have take over support for. All the databases have backed up and been restored ... although after Firebird's backup and restore system having to dump the database as raw SQL ... that took a LONG time :(

Anyway I've installed the mysqli driver and that seems to be working and I've run 'test connection' in mysql workbench with what I think are the same settings in the joomla without a problem, but the website just gives "Database connection error (2): Could not connect to MySQL." I can browse the data in workbench, and changing user admin enables and disables that, but nothing seems to sort the php connection.

Can anybody think of something that I have missed in this or point me to a suitable 'newbie' guide to debugging mysql connections so I can get all these sites back on line again ... If it was Firebird I'd just have mirrored of one of my other machines and been working as the security stuff is managed in the database, by mysql seems to have layers of security that I'm missing somewhere ;)

--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk


--- End Message ---
--- Begin Message ---
Hi, Lester

Just try to connect to your mysqlserver using a simple php script first.

Example for MySqli:
http://www.php.net/manual/en/mysqli.construct.php#example-1625

Example for MySql:
http://www.php.net/manual/en/function.mysql-connect.php#refsect1-function.mysql-connect-examples

If you still use MySql and not MySqli to connect to your MySql-Server:
Please keep in mind, that this extension is about to die out.

I just know of mysqli and mysql that you can chosse in the
Joomla-Installation process ...
PHP itself does also have PDO. There you have to check first if the
pdo-driver for mysql is installed:
http://www.php.net/manual/en/mysqli.quickstart.prepared-statements.php
And then try to connect to your server:
http://de2.php.net/manual/en/pdo.construct.php#refsect1-pdo.construct-examples

If you're using MySqli, please try a prepared-statement as well.
http://www.php.net/manual/en/mysqli.quickstart.prepared-statements.php
I got access to a server where the administrator had mixed it up that
hard, that mysqli as PHP-extension was installed and worked quite well
excepted by the prepared-statement :D

Bye
Simon

On Mon, Aug 20, 2012 at 12:51 PM, Lester Caine <les...@lsces.co.uk> wrote:
>
> OK - MySQL is not an area I've had to bother with, but I'm trying to sort
> out a tranche of websites that 1&1 messed up the DNS on last week and we
> have take over support for. All the databases have backed up and been
> restored ... although after Firebird's backup and restore system having to
> dump the database as raw SQL ... that took a LONG time :(
>
> Anyway I've installed the mysqli driver and that seems to be working and
> I've run 'test connection' in mysql workbench with what I think are the same
> settings in the  joomla without a problem, but the website just gives
> "Database connection error (2): Could not connect to MySQL." I can browse
> the data in workbench, and changing user admin enables and disables that,
> but nothing seems to sort the php connection.
>
> Can anybody think of something that I have missed in this or point me to a
> suitable 'newbie' guide to debugging mysql connections so I can get all
> these sites back on line again ... If it was Firebird I'd just have mirrored
> of one of my other machines and been working as the security stuff is
> managed in the database, by mysql seems to have layers of security that I'm
> missing somewhere ;)
>
> --
> Lester Caine - G8HFL
> -----------------------------
> Contact - http://lsces.co.uk/wiki/?page=contact
> L.S.Caine Electronic Services - http://lsces.co.uk
> EnquirySolve - http://enquirysolve.com/
> Model Engineers Digital Workshop - http://medw.co.uk
> Rainbow Digital Media - http://rainbowdigitalmedia.co.uk
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
Simon Schick wrote:
Just try to connect to your mysqlserver using a simple php script first.

Actually my next step was to try phpMyAdmin ;)

Having created a new user with the correct rights it just worked out of the box. I was simply trying to use 'root' just to get going, but it seems that is blocked somewhere and will only work internally. That is I could not log into phpMyAdmin using 'root' ...

joomla is using mysqli but as yet is obviously not strict compliant as http://gc.lsces.org.uk/ will demonstrate ... that is if I've not found where to patch joomla since I don't want to switch E_STRICT off just for that. If I do anything with joomla it will be replacing mysql, but to be honest I'll probably just move most of the sites to something *I* can work with :) I've already sorted the E_STRICT problem with my own stuff. I just need to get them running for now!

--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk



--- End Message ---
--- Begin Message ---
Hi, Lester

I know how you feel ... I didn't want to disable E_STRICT either, but
as most of those errors come from the Joomla-Core or some extensions,
I don't have the nerves to fix code that's not mine and the developer
just says "aaa ... those E_STRICTs ... why do you even care ...".

Therefore I gave up because the developer won't fix those and I don't
want to support my own fork of those extensions.

Bye
Simon

On Mon, Aug 20, 2012 at 1:40 PM, Lester Caine <les...@lsces.co.uk> wrote:
> Simon Schick wrote:
>>
>> Just try to connect to your mysqlserver using a simple php script first.
>
>
> Actually my next step was to try phpMyAdmin ;)
>
> Having created a new user with the correct rights it just worked out of the
> box. I was simply trying to use 'root' just to get going, but it seems that
> is blocked somewhere and will only work internally. That is I could not log
> into phpMyAdmin using 'root' ...
>
> joomla is using mysqli but as yet is obviously not strict compliant as
> http://gc.lsces.org.uk/ will demonstrate ... that is if I've not found where
> to patch joomla since I don't want to switch E_STRICT off just for that. If
> I do anything with joomla it will be replacing mysql, but to be honest I'll
> probably just move most of the sites to something *I* can work with :) I've
> already sorted the E_STRICT problem with my own stuff. I just need to get
> them running for now!
>
>
> --
> Lester Caine - G8HFL
> -----------------------------
> Contact - http://lsces.co.uk/wiki/?page=contact
> L.S.Caine Electronic Services - http://lsces.co.uk
> EnquirySolve - http://enquirysolve.com/
> Model Engineers Digital Workshop - http://medw.co.uk
> Rainbow Digital Media - http://rainbowdigitalmedia.co.uk
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
Simon Schick wrote:
Hi, Lester

I know how you feel ... I didn't want to disable E_STRICT either, but
as most of those errors come from the Joomla-Core or some extensions,
I don't have the nerves to fix code that's not mine and the developer
just says "aaa ... those E_STRICTs ... why do you even care ...".

Therefore I gave up because the developer won't fix those and I don't
want to support my own fork of those extensions.

Actually all I was trying to work out was overriding the setting for the joomla sites ... but I hit another problem first :(

Need to compile mysqli and mysqlnd as shared modules, but can't seem to untangle the interrelation on header files ... I'm missing something there when running ./configure to get them to see the other's ext/ folder on the php5.4 configuration on the main server ... what should be a 5 minute job always seems to take hours :(

--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk



--- End Message ---
--- Begin Message ---
-----Original Message-----
From: Lester Caine [mailto:les...@lsces.co.uk] 
Sent: Monday, August 20, 2012 6:52 AM
To: php-gene...@lists.php.net
Subject: [PHP] Crash course

OK - MySQL is not an area I've had to bother with, but I'm trying to sort
out a tranche of websites that 1&1 messed up the DNS on last week and we
have take over support for. All the databases have backed up and been
restored ... 
although after Firebird's backup and restore system having to dump the
database as raw SQL ... that took a LONG time :(

Anyway I've installed the mysqli driver and that seems to be working and
I've run 'test connection' in mysql workbench with what I think are the same
settings in the  joomla without a problem, but the website just gives
"Database connection error (2): Could not connect to MySQL." I can browse
the data in workbench, and changing user admin enables and disables that,
but nothing seems to sort the php connection.

Can anybody think of something that I have missed in this or point me to a
suitable 'newbie' guide to debugging mysql connections so I can get all
these sites back on line again ... If it was Firebird I'd just have mirrored
of one of my other machines and been working as the security stuff is
managed in the database, by mysql seems to have layers of security that I'm
missing somewhere ;)

-- 
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
------------------------------------------------------------------


First of all, I HIGHLY doubt that 1and1 AKA Cisco messed up the DNS. I would
be very careful blaming them and publically announcing it.
Secondly if you tested mysql connection with Workbench then the error you
describe is configuration error in Joomla, common sense would dictate so.
http://www.inmotionhosting.com/support/edu/joomla-25/database/troubleshootin
g-database-errors


This list is for PHP 








--- End Message ---
--- Begin Message ---
admin wrote:
First of all, I HIGHLY doubt that 1and1 AKA Cisco messed up the DNS. I would
be very careful blaming them and publically announcing it.
We can publish the list of sites that were unavailable for 48 hours. It was the last straw for the customer as this was not the first occasion it had happened and we were asked to sort the matter out after several hours of being given the run around. NOW I'm trying to get PHP working with the customers material which was running on PHP5.2 but I no longer have 5.2 on my servers.

Secondly if you tested mysql connection with Workbench then the error you
describe is configuration error in Joomla, common sense would dictate so.
http://www.inmotionhosting.com/support/edu/joomla-25/database/troubleshootin
g-database-errors
Which was exactly the sort of help I was asking for, finding some things like that can take time when one is in a rush, but ACTUALLY that page gave me nothing as the subsequent post indicated. It was the PHP setup with MySQL that I was playing with at the time although the actual problem was simply adding a user name that PHP could access - not something I was expecting since I can always use the system accounts with Firebird.

This list is for PHP
And the problems I am having are getting PHP working!
Current problem simply getting mysqli and mysqlnd compiled so I can add them to the PHP5.4 setup. I've been at this for the last 3 hours and am making progress, but nothing actually worked first time :(
And the sites still arn't up on my servers.

--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk



--- End Message ---
--- Begin Message ---
On 16-08-2012 20:28, Tristan wrote:
Thanks for all your help. The answer was so simple in the end. Thanks Tim
for clearing that up!!! Perfect little script now for creating navigation.
Just feed it an array like posted at the bottom of this message.

function createTree(&$list, $parent){

     global $depth;

     $depth++; // Increment as we descend

     $tree = array();
//$depth = 0;
     foreach ($parent as $k=>$l){
$l['depth'] = $depth;
         if(isset($list[$l['section_id']])){
             $l['children'] = createTree($list, $list[$l['section_id']]);
         }
         $tree[] = $l;
     }

     $depth--; // Decrement as we ascend

     return $tree;
}

$arr = $dashSections;

$new = array();
foreach ($arr as $a){
     $new[$a['section_parent_id']][] = $a;
}

// CREATE THE TREE
$depth = 0;

$tree = createTree($new, $new[0]);
//echo count($tree);
print_r($tree);



Tristan, using globals for such a thing is bound to bite you in the ass at some point. IMO it is a far better idea to include the depth as a parameter to createTree. So something like:

function createTree($list, $parent, $depth=0) {
   $tree = [];
   foreach($parent as $k=>$l) {
      $l['depth'] = ($depth+1);
      if(isset($list[$l['section_id']])) {
         $child = $list[$l['section_id']])l
         $l['children'] = createTree($list, $child, $depth+1);
      }
      $tree[] = $l;
   }
}

Now you don't have to remember to set $depth to anything, it just works out of the box. Having global variables floating around just makes it easy for them to get overwritten by accident, and then you'll be wondering why the hell your menus suddenly look weird when you haven't even touched them! ;)

- Tul

--- End Message ---
--- Begin Message ---

On 8/20/2012 12:19 AM, Jim Lucas wrote:
On 8/17/2012 6:35 PM, Jim Giner wrote:
On 8/17/2012 7:16 PM, Jim Lucas wrote:

You could simply remove all full domain+path URL links and replace
them with absolute path urls only.

turn http://www.somedomain.com/path/to/my/webpage.html

into /path/to/my/webpage.html

This would work with either domain.

Those would be "relative paths", ..o?


No.

Quick Google search turns up this:

http://www.uvsc.edu/disted/decourses/dgm/2120/IN/steinja/lessons/06/06_04.html

I have three description or types of paths that I use normally.

I feel the first two generally get grouped together by most persons.

Full or complete path:
    <a href="http://www.cmsws.com/index.php";>Home</a>

Absolute Path:
    <a href="/index.php">Home</a>

Relative:
    <a href="index.php">Home</a>

--
Jim Lucas
http://cmsws.com


Anything that does not "absolutely" define something, is "relative" to the current context. In this case since your href does not mention the sitename, in my book that equates to something relative. Count me as one person who would never lump the first two ex. into one. The simple device of using the leading slash to start the href indicates its "relativity" to the the home folder of the site. The lack of a leading slash indicates its "relativity" to the current folder.
--- End Message ---
--- Begin Message ---
2012/8/20 Jim Giner <jim.gi...@albanyhandball.com>

>
> On 8/20/2012 12:19 AM, Jim Lucas wrote:
>
>> On 8/17/2012 6:35 PM, Jim Giner wrote:
>>
>>> On 8/17/2012 7:16 PM, Jim Lucas wrote:
>>>
>>>>
>>>> You could simply remove all full domain+path URL links and replace
>>>> them with absolute path urls only.
>>>>
>>>> turn 
>>>> http://www.somedomain.com/**path/to/my/webpage.html<http://www.somedomain.com/path/to/my/webpage.html>
>>>>
>>>> into /path/to/my/webpage.html
>>>>
>>>> This would work with either domain.
>>>>
>>>>  Those would be "relative paths", ..o?
>>>
>>>
>> No.
>>
>> Quick Google search turns up this:
>>
>> http://www.uvsc.edu/disted/**decourses/dgm/2120/IN/steinja/**
>> lessons/06/06_04.html<http://www.uvsc.edu/disted/decourses/dgm/2120/IN/steinja/lessons/06/06_04.html>
>>
>> I have three description or types of paths that I use normally.
>>
>> I feel the first two generally get grouped together by most persons.
>>
>> Full or complete path:
>>     <a href="http://www.cmsws.com/**index.php<http://www.cmsws.com/index.php>
>> ">Home</a>
>>
>> Absolute Path:
>>     <a href="/index.php">Home</a>
>>
>> Relative:
>>     <a href="index.php">Home</a>
>>
>> --
>> Jim Lucas
>> http://cmsws.com
>>
>>
>>  Anything that does not "absolutely" define something, is "relative" to
> the current context.  In this case since your href does not mention the
> sitename, in my book that equates to something relative.


absolute path != absolute (or better "full-qualified") URL/URI. Therefore
"/foo/bar" is an absolute path, but a relative URI.


> Count me as one person who would never lump the first two ex. into one.
>  The simple device of using the leading slash to start the href indicates
> its "relativity" to the the home folder of the site.


The document-root. The home of the user the webserver/interpreter is
running on may be somewhere else.


> The lack of a leading slash indicates its "relativity" to the current
> folder.


Relative to the current path. Especially with rewrites "folder" and "path"
can be completely different.

--- End Message ---
--- Begin Message ---
Can mysqlnd be built as a shared module?

make test is telling me the resulting .so is not a valid
"Warning: PHP Startup: Invalid library (maybe not a PHP library) 'mysqlnd.so' in Unknown on line 0"

I'm still on PHP5.4.3 on that machine as I've not had time to upgrade as yet. It's running my own PHP sites without a problem via Firebird.

--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk


--- End Message ---
--- Begin Message ---
On Mon, Aug 20, 2012 at 10:20 AM, Lester Caine <les...@lsces.co.uk> wrote:

> Can mysqlnd be built as a shared module?
>
> make test is telling me the resulting .so is not a valid
> "Warning: PHP Startup: Invalid library (maybe not a PHP library)
> 'mysqlnd.so' in Unknown on line 0"
>
> I'm still on PHP5.4.3 on that machine as I've not had time to upgrade as
> yet. It's running my own PHP sites without a problem via Firebird.
>
> --
> Lester Caine - G8HFL
> -----------------------------
> Contact - 
> http://lsces.co.uk/wiki/?page=**contact<http://lsces.co.uk/wiki/?page=contact>
> L.S.Caine Electronic Services - http://lsces.co.uk
> EnquirySolve - http://enquirysolve.com/
> Model Engineers Digital Workshop - http://medw.co.uk
> Rainbow Digital Media - 
> http://rainbowdigitalmedia.co.**uk<http://rainbowdigitalmedia.co.uk>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
there was a bugfix in the 5.3 changelog

mysqlnd:
Fixed bug #55609 <http://bugs.php.net/55609> (mysqlnd cannot be built
shared). (Johannes)

and I see this in the 5.4.0

ext/mysql, mysqli and pdo_mysql now use mysqlnd by default.

--- End Message ---
--- Begin Message ---


This is usually a first-year CS programming problem (word frequency
counts) complicated a little bit by needing to extract the text.
You've started off fine, stripping tags, converting to lower case,
you'll want to either convert or strip HTML entities as well, deciding
what you want to do with plurals and words like "you're", "Charlie's",
"it's", etc, also whether something like RFC822 is a word or not
(mixed letters and numbers).

When you've arranged all that, splitting on white space is trivial:

$words = preg_split('/[[:space:]]+/',$text);

and then you just run through the words building an associative array
by incrementing the count of each word as the key to the array:

foreach ($words as $word) {
     $freq[$word]++;
}

For output, you may want to sort the array:

ksort($freq);

That's awesome. Thanks!
Let me start with my first problem:

I want to extract All Occurrences of text AFTER "News Releases" and before "-30-".

http://www.cegepsherbrooke.qc.ca/~languesmodernes/test/test.html

How do I do that?

Yeah, I am still asking first year questions :)) Every project brings new challenges.

John


--- End Message ---

Reply via email to