php-general Digest 1 Feb 2012 14:24:06 -0000 Issue 7671

2012-02-01 Thread php-general-digest-help

php-general Digest 1 Feb 2012 14:24:06 - Issue 7671

Topics (messages 316432 through 316445):

Re: Time zone in date function
316432 by: Ian
316434 by: Jonesy
316436 by: Matijn Woudt
316442 by: Jonesy

Cannot make bzip2 stream on the fly
316433 by: Michael Shestero
316435 by: Maciek Sokolewicz
316439 by: Michael Shestero

When to call mysqli::close
316437 by: Albert Kamau
316438 by: Stuart Dallas

Re: differences in between these env. variables
316440 by: Tedd Sperling

free space
316441 by: saeed ahmed
316443 by: Sean Greenslade
316444 by: admin.buskirkgraphics.com

Re: Autoloading
316445 by: Marco Behnke

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


--
---BeginMessage---
On 31/01/2012 01:55, Ron Piggott wrote:
 
 On my clients account when I use “echo date(‘D, d M Y H:i:s');” the output is 
 5 hours ahead of us.  How do I change it to my local time?  Is there a way to 
 specify “Eastern” time zone?
 
 I expect this would work:
 
 echo date(‘D, d M Y H:i:s' , ( strtotime( date(‘D, d M Y H:i:s') – 21600  ) ) 
 );
 
 I would prefer to specify Eastern time, so if the web host changes a server 
 setting it will remain in Eastern time zone.  Ron

Hi Ron,

I use this function to get the current time in a particular timezone:

?php
/**
 * Return the current local time by timezone name
 * @param string $timezone
 * @return array
 * @author Ian Gibbons
 */
function getNowByTimezone($timezone){
$remote_timezone= new DateTimeZone($timezone);
$remote_time= new DateTime(now, $remote_timezone);

return getDate(strtotime($remote_time-format(Y-m-d H:i:s)));
}
?

Example:

?

$london_time = getNowByTimezone(Europe/London);
echo date(D, d M Y H:i:s, $london_time[0]);

?

Regards

Ian

---End Message---
---BeginMessage---
On Tue, 31 Jan 2012 14:57:41 +1300, Simon J Welsh wrote:
 On 31/01/2012, at 2:55 PM, Ron Piggott wrote:

 
 On my clients account when I use ?echo date(?D, d M Y H:i:s');? the output 
 is 5 hours ahead of us.  How do I change it to my local time?  Is there a 
 way to specify ?Eastern? time zone?
 
 I expect this would work:
 
 echo date(?D, d M Y H:i:s' , ( strtotime( date(?D, d M Y H:i:s') ? 21600  ) 
 ) );
 
 I would prefer to specify Eastern time, so if the web host changes a server 
 setting it will remain in Eastern time zone.  Ron

 You can set the timezone for your script using date_default_timezone_set() 
 http://php.net/manual/en/function.date-default-timezone-set.php

(wrap your lines, folks!)

Is there a reason _not_ to use viz:

putenv(TZ=America/Anguilla);  
 ??

Or, is it simple Just The Linux Way(tm) , i.e. there's 
always more than one way to do a 'thing'?

Jonesy
-- 
  Marvin L Jones| jonz  | W3DHJ  | linux
   38.24N  104.55W  |  @ config.com | Jonesy |  OS/2
* Killfiling google  banter.com: jonz.net/ng.htm

---End Message---
---BeginMessage---
On Tue, Jan 31, 2012 at 4:22 PM, Jonesy gm...@jonz.net wrote:
 On Tue, 31 Jan 2012 14:57:41 +1300, Simon J Welsh wrote:
 On 31/01/2012, at 2:55 PM, Ron Piggott wrote:


 On my clients account when I use ?echo date(?D, d M Y H:i:s');? the output 
 is 5 hours ahead of us.  How do I change it to my local time?  Is there a 
 way to specify ?Eastern? time zone?

 I expect this would work:

 echo date(?D, d M Y H:i:s' , ( strtotime( date(?D, d M Y H:i:s') ? 21600  ) 
 ) );

 I would prefer to specify Eastern time, so if the web host changes a server 
 setting it will remain in Eastern time zone.  Ron

 You can set the timezone for your script using date_default_timezone_set() 
 http://php.net/manual/en/function.date-default-timezone-set.php

 (wrap your lines, folks!)

 Is there a reason _not_ to use viz:

        putenv(TZ=America/Anguilla);
  ??

 Or, is it simple Just The Linux Way(tm) , i.e. there's
 always more than one way to do a 'thing'?

 Jonesy

From the PHP Manual:
every call to a date/time function will generate a E_NOTICE if the
timezone isn't valid, and/or a E_WARNING message if using the system
settings or the TZ environment variable.

So that will generate E_WARNING messages.

- Matijn
---End Message---
---BeginMessage---
On Tue, 31 Jan 2012 17:15:48 +0100, Matijn Woudt wrote:
 On Tue, Jan 31, 2012 at 4:22 PM, Jonesy gm...@jonz.net wrote:

 Is there a reason _not_ to use viz:

        putenv(TZ=America/Anguilla);
  ??

 Or, is it simple Just The Linux Way(tm) , i.e. there's
 always more than one way to do a 'thing'?

 From the PHP Manual:
 every call to a date/time function will generate a E_NOTICE if the
 timezone isn't valid, and/or a E_WARNING message if using the system
 settings or 

Re: [PHP] Autoloading

2012-02-01 Thread Marco Behnke

Am 26.01.2012 15:44, schrieb Floyd Resler:
 As stated, when I change __autoload to spl_autoload_register I get 
the can't be redeclared error.  Any ideas?



Try

$callback = function($class_name) {
$path = dirname(__FILE__)./../../lib/class.{$class_name}.php;
if (file_exists($path)) {
require_once $path;
}
};

spl_autoload_register($callback);



--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz



smime.p7s
Description: S/MIME Kryptografische Unterschrift


[PHP] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/php_pdo_mysql' ....

2012-02-01 Thread Darryle Steplight
Hello Everyone,
   My name is Darryle. I've installed PHP 5.3.9 on my CentOs box and
some numerous modules via yum. Some of those modules are  PDO,
PDO_MYSQL and PDO_SQLITE. However, my PHP configuration is not
recognizing my PDO_MYSQL module.  I can verify that these modules
exists by looking in my /etc/php.d/ folder.  I'm also including the
PDO and PDO_MYSQL extensions in my httpd.conf file after my
extension_dir=/path/to/modules/ declaration.  When I run php -i | grep
pdo this is what I see




]# php -i | grep pdo
PHP Warning:  PHP Startup: Unable to load dynamic library
'/usr/lib64/php/modules/php_pdo' - /usr/lib64/php/modules/php_pdo:
cannot open shared object file: No such file or directory in Unknown
on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library
'/usr/lib64/php/modules/php_pdo_mysql' -
/usr/lib64/php/modules/php_pdo_mysql: cannot open shared object file:
No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library
'/usr/lib64/php/modules/mysql.so' - libmysqlclient.so.15: cannot open
shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library
'/usr/lib64/php/modules/mysqli.so' - libmysqlclient.so.15: cannot open
shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library
'/usr/lib64/php/modules/pdo_mysql.so' - libmysqlclient.so.15: cannot
open shared object file: No such file or directory in Unknown on line
0
Configure Command =  './configure'  '--build=x86_64-redhat-linux-gnu'
'--host=x86_64-redhat-linux-gnu' '--target=x86_64-redhat-linux-gnu'
'--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr'
'--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc'
'--datadir=/usr/share' '--includedir=/usr/include'
'--libdir=/usr/lib64' '--libexecdir=/usr/libexec'
'--localstatedir=/var' '--sharedstatedir=/usr/com'
'--mandir=/usr/share/man' '--infodir=/usr/share/info'
'--cache-file=../config.cache' '--with-libdir=lib64'
'--with-config-file-path=/etc'
'--with-config-file-scan-dir=/etc/php.d' '--disable-debug'
'--with-pic' '--disable-rpath' '--without-pear' '--with-bz2'
'--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr'
'--with-png-dir=/usr' '--with-xpm-dir=/usr' '--enable-gd-native-ttf'
'--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv'
'--with-jpeg-dir=/usr' '--with-openssl' '--with-zlib'
'--with-layout=GNU' '--enable-exif' '--enable-ftp'
'--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem'
'--enable-sysvshm' '--enable-sysvmsg' '--with-kerberos'
'--enable-ucd-snmp-hack' '--enable-shmop' '--enable-calendar'
'--without-sqlite' '--with-libxml-dir=/usr' '--enable-xml'
'--with-system-tzdata' '--enable-force-cgi-redirect' '--enable-pcntl'
'--with-imap=shared' '--with-imap-ssl' '--enable-mbstring=shared'
'--enable-mbregex' '--with-gd=shared' '--enable-bcmath=shared'
'--enable-dba=shared' '--with-db4=/usr' '--with-xmlrpc=shared'
'--with-ldap=shared' '--with-ldap-sasl' '--with-mysql=shared,/usr'
'--with-mysqli=shared,/usr/lib64/mysql/mysql_config'
'--enable-dom=shared' '--with-pgsql=shared' '--enable-wddx=shared'
'--with-snmp=shared,/usr' '--enable-soap=shared'
'--with-xsl=shared,/usr' '--enable-xmlreader=shared'
'--enable-xmlwriter=shared' '--with-curl=shared,/usr'
'--enable-fastcgi' '--enable-pdo=shared'
'--with-pdo-odbc=shared,unixODBC,/usr'
'--with-pdo-mysql=shared,/usr/lib64/mysql/mysql_config'
'--with-pdo-pgsql=shared,/usr' '--with-pdo-sqlite=shared,/usr'
'--with-pdo-dblib=shared,/usr' '--without-sqlite3'
'--enable-json=shared' '--enable-zip=shared' '--with-readline'
'--with-pspell=shared' '--enable-phar=shared'
'--with-mcrypt=shared,/usr' '--with-tidy=shared,/usr'
'--with-mssql=shared,/usr' '--enable-sysvmsg=shared'
'--enable-sysvshm=shared' '--enable-sysvsem=shared'
'--enable-posix=shared' '--with-unixODBC=shared,/usr'
'--enable-fileinfo=shared' '--enable-intl=shared'
'--with-icu-dir=/usr' '--with-recode=shared,/usr'
/etc/php.d/pdo.ini,
/etc/php.d/pdo_mysql.ini,
/etc/php.d/pdo_sqlite.ini,
PHP Warning:  Unknown: It is not safe to rely on the system's timezone
settings. You are *required* to use the date.timezone setting or the
date_default_timezone_set() function. In case you used any of those
methods and you are still getting this warning, you most likely
misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no
DST' instead in Unknown on line 0
pdo_sqlite




and if I run php -m, this is  a sample pf what I see  (  I still see
the same warnings that I see from above )
pcre
PDO
pdo_sqlite
Phar








What do I need to do to make my php configuration recognize my
pdp_mysql module? Being that's i'm a LAMP Developer, I have frameworks
that I use that require PDO_MYSQL to exist.

-- 
--
May the Source be with you.

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



[PHP] Looking for the string functions

2012-02-01 Thread Tim Streater
I'm keen to look at the C source of such as substr_replace() and stripos(). 
I've downloaded the 5.3.9 PHP source, but am having difficulty locating the 
string functions. Could someone point me at the right directory or .c file?

Thanks,

--
Cheers  --  Tim

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

Re: [PHP] Looking for the string functions

2012-02-01 Thread Mike Mackintosh
If you don't get any replies, try the Dev Mailing list.

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



Re: [PHP] Looking for the string functions

2012-02-01 Thread Mike Mackintosh
btw, php dev = internals

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



Re: [PHP] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/php_pdo_mysql' ....

2012-02-01 Thread Matijn Woudt
On Wed, Feb 1, 2012 at 6:56 PM, Darryle Steplight dstepli...@gmail.com wrote:
 Hello Everyone,
    My name is Darryle. I've installed PHP 5.3.9 on my CentOs box and
 some numerous modules via yum. Some of those modules are  PDO,
 PDO_MYSQL and PDO_SQLITE. However, my PHP configuration is not
 recognizing my PDO_MYSQL module.  I can verify that these modules
 exists by looking in my /etc/php.d/ folder.  I'm also including the
 PDO and PDO_MYSQL extensions in my httpd.conf file after my
 extension_dir=/path/to/modules/ declaration.  When I run php -i | grep
 pdo this is what I see


 ]# php -i | grep pdo
 PHP Warning:  PHP Startup: Unable to load dynamic library
 '/usr/lib64/php/modules/php_pdo' - /usr/lib64/php/modules/php_pdo:
 cannot open shared object file: No such file or directory in Unknown
 on line 0
 PHP Warning:  PHP Startup: Unable to load dynamic library
 '/usr/lib64/php/modules/php_pdo_mysql' -
 /usr/lib64/php/modules/php_pdo_mysql: cannot open shared object file:
 No such file or directory in Unknown on line 0
 PHP Warning:  PHP Startup: Unable to load dynamic library
 '/usr/lib64/php/modules/mysql.so' - libmysqlclient.so.15: cannot open

Hi,

This seems to be an common error with CentOS 64 bit. If you google for
it there are plenty of people experiencing the same issue, and there
are probably a few fixes for it.
One of the first hits I got was a user who did:

ln -s /usr/lib64/mysql/libmysqlclient.so.15 /usr/lib64/libmysqlclient.so.15

And it solved his problem. So you can try that, and if that fails, try Google!

- Matijn

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



Re: [PHP] Looking for the string functions

2012-02-01 Thread Matijn Woudt
On Thu, Feb 2, 2012 at 12:17 AM, Tim Streater t...@clothears.org.uk wrote:
 I'm keen to look at the C source of such as substr_replace() and stripos(). 
 I've downloaded the 5.3.9 PHP source, but am having difficulty locating the 
 string functions. Could someone point me at the right directory or .c file?

 Thanks,

 --
 Cheers  --  Tim

On linux you can use a combination of find and grep to find it, on
windows there's a search function? I believe you can specify in the
search that you want to search inside files to get it, and else you
can use software like Notepad++ for example that has a 'search in
files' option.

- Matijn

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



Re: [PHP] Looking for the string functions

2012-02-01 Thread Mike Mackintosh




On Feb 1, 2012, at 18:49, Matijn Woudt tijn...@gmail.com wrote:

 On Thu, Feb 2, 2012 at 12:17 AM, Tim Streater t...@clothears.org.uk wrote:
 I'm keen to look at the C source of such as substr_replace() and stripos(). 
 I've downloaded the 5.3.9 PHP source, but am having difficulty locating the 
 string functions. Could someone point me at the right directory or .c file?
 
 Thanks,
 
 --
 Cheers  --  Tim
 
 On linux you can use a combination of find and grep to find it, on
 windows there's a search function? I believe you can specify in the
 search that you want to search inside files to get it, and else you
 can use software like Notepad++ for example that has a 'search in
 files' option.
 
 - Matijn
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

See http://www.highonphp.com/how-to-find-file-by-content
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/php_pdo_mysql' ....

2012-02-01 Thread Darryle Steplight
I have version usr/lib64/mysql/libmysqlclient.so.18 instead of
usr/lib64mysql//libmysqlclient.so.15 . I coped over the file into
usr/lib64/libmysqlclient.so.18, because that file didn't exist in that
path, I created the sym link but no luck. Few fixes are better than no
fixes for sure.


On Wed, Feb 1, 2012 at 6:44 PM, Matijn Woudt tijn...@gmail.com wrote:
 On Wed, Feb 1, 2012 at 6:56 PM, Darryle Steplight dstepli...@gmail.com 
 wrote:
 Hello Everyone,
    My name is Darryle. I've installed PHP 5.3.9 on my CentOs box and
 some numerous modules via yum. Some of those modules are  PDO,
 PDO_MYSQL and PDO_SQLITE. However, my PHP configuration is not
 recognizing my PDO_MYSQL module.  I can verify that these modules
 exists by looking in my /etc/php.d/ folder.  I'm also including the
 PDO and PDO_MYSQL extensions in my httpd.conf file after my
 extension_dir=/path/to/modules/ declaration.  When I run php -i | grep
 pdo this is what I see


 ]# php -i | grep pdo
 PHP Warning:  PHP Startup: Unable to load dynamic library
 '/usr/lib64/php/modules/php_pdo' - /usr/lib64/php/modules/php_pdo:
 cannot open shared object file: No such file or directory in Unknown
 on line 0
 PHP Warning:  PHP Startup: Unable to load dynamic library
 '/usr/lib64/php/modules/php_pdo_mysql' -
 /usr/lib64/php/modules/php_pdo_mysql: cannot open shared object file:
 No such file or directory in Unknown on line 0
 PHP Warning:  PHP Startup: Unable to load dynamic library
 '/usr/lib64/php/modules/mysql.so' - libmysqlclient.so.15: cannot open

 Hi,

 This seems to be an common error with CentOS 64 bit. If you google for
 it there are plenty of people experiencing the same issue, and there
 are probably a few fixes for it.
 One of the first hits I got was a user who did:

 ln -s /usr/lib64/mysql/libmysqlclient.so.15 /usr/lib64/libmysqlclient.so.15

 And it solved his problem. So you can try that, and if that fails, try Google!

 - Matijn



-- 
--
May the Source be with you.

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