php-general Digest 19 Sep 2011 21:08:30 -0000 Issue 7486
Topics (messages 314934 through 314939):
Re: Installing extensions
314934 by: tamouse mailing lists
314935 by: tamouse mailing lists
314937 by: Daniel Brown
Re: Round with money_format
314936 by: Cyril Lopez
Re: Search for string followed by whitespace
314938 by: Daniel Brown
PHP installations, usage, and popularity
314939 by: Tedd Sperling
Administrivia:
To subscribe to the digest, e-mail:
[email protected]
To unsubscribe from the digest, e-mail:
[email protected]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
On Sun, Sep 18, 2011 at 4:22 PM, Gregor Mitzka <[email protected]> wrote:
> Why don't you use MacPorts? There you can extension in a quite simple way.
> Gregor Mitzka
I DID use MacPorts!
--- End Message ---
--- Begin Message ---
On Sun, Sep 18, 2011 at 4:36 PM, Benjamin Hawkes-Lewis
<[email protected]> wrote:
> On Sun, Sep 18, 2011 at 8:21 PM, tamouse mailing lists
> <[email protected]> wrote:
>> I'm having a bit of trouble installing PHP extensions.
>>
>> I have the following in php.ini:
>>
>> extension_dir =
>> ".:/usr/local/lib/php/extensions:/usr/local/lib/php/extensions/no-debug-non-zts-20090626"
>>
>> In /usr/local/lib/php/extensions/no-debug-non-zts-20090626, i have the
>> following:
>>
>> -rwxr-xr-x 1 root wheel 25652 Sep 18 13:04 geoip.so*
>> -rwxr-xr-x 1 root wheel 115536 Jul 13 16:55 iconv.a*
>> -rwxr-xr-x 1 root wheel 40556 Jul 13 16:55 iconv.so*
>>
>> but if I do php -i | grep -E '(iconv|geoip)' , i get nothing.
>>
>> So apparently the extensions aren't being added as I thought.
>>
>> System info:
>> Mac OSX 10.5.8
>> php 5.3.6
>
> "extension_dir" controls where PHP looks for extensions that _could_
> be dynamically loaded.
>
> It does not dictate which extensions it loads at startup - that's "extension".
>
> http://php.net/manual/en/ini.core.php
>
> http://www.php.net/manual/en/install.pecl.intro.php
>
> --
> Benjamin Hawkes-Lewis
>
Ah, ok, great. I have added the following two lines:
extension=iconv.so
extension=geoip.so
Now, php -i|grep -E '(iconv|geoip)' reveals:
miishka:.calendar tamara$ php -i|grep -E '(iconv|geoip)'
Registered Stream Filters => zlib.*, convert.iconv.*, string.rot13,
string.toupper, string.tolower, string.strip_tags, convert.*, consumed
iconv
iconv support => enabled
iconv implementation => libiconv
iconv library version => 1.11
iconv.input_encoding => ISO-8859-1 => ISO-8859-1
iconv.internal_encoding => ISO-8859-1 => ISO-8859-1
iconv.output_encoding => ISO-8859-1 => ISO-8859-1
But still no geoip love.
Installed the geoip extension from: https://github.com/Zakay/geoip
following the instruction in the README, modified to use version 5.3.6
in /usr/local/:
OSX (MacPorts):
sudo port install libgeoip
Then after unpacking:
/usr/local/bin/phpize
./configure --prefix=/usr/local
--with-php-config=/usr/local/bin/php-config
make
sudo make install
Clearly, something isn't getting in the right place. Running a find:
miishka:.calendar tamara$ find /opt/local -name 'libGeoIP*'
/opt/local/lib/libGeoIP.1.dylib
/opt/local/lib/libGeoIP.a
/opt/local/lib/libGeoIP.dylib
/opt/local/lib/libGeoIP.la
/opt/local/lib/libGeoIPUpdate.0.dylib
/opt/local/lib/libGeoIPUpdate.a
/opt/local/lib/libGeoIPUpdate.dylib
/opt/local/lib/libGeoIPUpdate.la
Shows the install libGeoIP. I'm suspicious about my configure invocation above.
I captured the script of my build here: http://pastebin.com/8KJ5ShnK
Please let me know what I've forgotten or misplaced.
--- End Message ---
--- Begin Message ---
On Sun, Sep 18, 2011 at 15:21, tamouse mailing lists
<[email protected]> wrote:
> I'm having a bit of trouble installing PHP extensions.
>
> I have the following in php.ini:
>
> extension_dir =
> ".:/usr/local/lib/php/extensions:/usr/local/lib/php/extensions/no-debug-non-zts-20090626"
>
> In /usr/local/lib/php/extensions/no-debug-non-zts-20090626, i have the
> following:
>
> -rwxr-xr-x 1 root wheel 25652 Sep 18 13:04 geoip.so*
> -rwxr-xr-x 1 root wheel 115536 Jul 13 16:55 iconv.a*
> -rwxr-xr-x 1 root wheel 40556 Jul 13 16:55 iconv.so*
>
> but if I do php -i | grep -E '(iconv|geoip)' , i get nothing.
>
> So apparently the extensions aren't being added as I thought.
>
> System info:
> Mac OSX 10.5.8
> php 5.3.6
>
> Any clues will be greatly appreciated!
You have to add the extensions to your php.ini file, and - if
using them on the web - remember to restart Apache.
--
</Daniel P. Brown>
Network Infrastructure Manager
http://www.php.net/
--- End Message ---
--- Begin Message ---
2011/9/17 Bill Guion <[email protected]>:
> On Sep 17, 2011, at 3:46 AM, Cyril Lopez wrote:
>
>> From: Cyril Lopez <[email protected]>
>> Date: September 16, 2011 10:58:28 AM EDT
>> To: [email protected]
>> Subject: Round with money_format
>>
>> Hi,
>>
>> Can someone help me understand how money_format() rounds numbers ?
>>
>> <?php
>> setlocale(LC_ALL, 'fr_FR.UTF-8');
>> $price = 12.665;
>> echo money_format('%i',$price);
>> // 12.66 EUR, 12.67 EUR expected
>>
>> $price2 = 12.666;
>> echo money_format('%i',$price2);
>> // 12.67 EUR, ok
>>
>> echo round($price,2);
>> // 12.67, ok
>> echo round($price2,2);
>> // 12.67, ok
>> ?>
>>
>> Misconfiguration ? Bug ?
>> Thanks !
>>
>> Cyril
>>
>> Config :
>> Debian Lenny, PHP 5.3.8
>
> As someone else pointed out, rounding rules vary by locale, but I was taught
> 40+ years ago in graduate school programming class, 4 rounds down, 6 rounds
> up, and 5 rounds to the even number. This means 65 rounds to 6, while 75
> rounds to 8. Your example seems to follow that rule.
Mmh ok. In french we call us "banking round" but the "infinite round"
(PHP_ROUND_HALF_UP) is more usual ?
Thanks all. But... Last question, what kind of round do you use for
pricing information, shop, bank requests ?
Cyril
--- End Message ---
--- Begin Message ---
On Sun, Sep 18, 2011 at 15:12, Tim Streater <[email protected]> wrote:
> At the moment, I'm doing this:
>
> $start = stripos ($body, "<a ", $loc);
>
> You'll note the space after the '<a'. But I really need to search in $body
> for '<a' followed by any whitespace char, at least one, starting at the
> $loc'th character, and returning the location of the string in $start.
>
> I had a look at the PCRE and POSIX regexp functions to no avail. Is there a
> slick way of doing this with one function call or should I just search for
> '<a' and brute-force check that the next char is ' ' or '\t' or '\n'?
>
> Thanks,
Try something along this line:
<?php preg_match_all('/<a\b/Ui',$text,$matches); ?>
Replace $text with the text through which you want to look, and
your results will be an array in $matches. The \b switch in the
regexp will match any word/letter border, which includes whitespaces,
tabs, newlines, periods, et cetera. Essentially, anything that you'll
want to match inside HTML tags, be they valid or otherwise. The U
modifier makes the search "Ungreedy," while the i modifier makes it
case-iNsEnSiTiVe.
--
</Daniel P. Brown>
Network Infrastructure Manager
http://www.php.net/
--- End Message ---
--- Begin Message ---
Hi gang:
I need information to convince administrators in "management" that PHP is a
viable subject that should be taught in college with credits going toward a
Degree or Certification.
You see, I am pushing for a Web Development Certification program that would
include PHP/MySQL as well as several other Web Languages (i.e., html, css,
javascript, ajax).
Currently the college teaches ASP in a regular course toward a IT
Certification, but class attendance has dropped considerably -- no one wants to
take the course.
However, My PHP class has been maxed out. But my class is a "special topic"
class and not part of the regular coursework that would go towards a Degree or
Certification -- and that's where I would like this to go.
As such, I need information regarding how wide-spread PHP is (i.e., number of
installations), who's using it (i.e., companies, organizations), and how it
compares with other Web Languages (i.e., ASP, Ruby, etc.).
So, what say you? References will work.
Thanks,
tedd
_____________________
[email protected]
http://sperling.com
--- End Message ---