php-general Digest 14 Feb 2013 15:08:05 -0000 Issue 8123

2013-02-14 Thread php-general-digest-help

php-general Digest 14 Feb 2013 15:08:05 - Issue 8123

Topics (messages 320201 through 320203):

Re: APC opcode cache behavior
320201 by: Aaron Holmes
320202 by: marco.behnke.biz
320203 by: Camilo Sperberg

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---

Driving home, I realized how vague this was.
Specifically, I'm looking for information on when APC will cache a file 
or directory, and what it checks before doing so.


Thanks again,
Aaron Holmes

On 2/13/2013 6:53 PM, Aaron Holmes wrote:

Hello,
I'm trying to find some information on APC opcode cache behavior.
We noticed an issue where, when switching symlinks to different 
versions of sites, old code was running from the previous version 
after switching the symlink.


Anyone know where I can find more information on this?

Thanks,
Aaron holmes


---End Message---
---BeginMessage---
 Aaron Holmes aa...@aaronholmes.net hat am 14. Februar 2013 um 03:53
 geschrieben:
 Hello,
 I'm trying to find some information on APC opcode cache behavior.
 We noticed an issue where, when switching symlinks to different versions
 of sites, old code was running from the previous version after switching
 the symlink.

 Anyone know where I can find more information on this?

Yes, that is the case. And iirc it will not update the cache if the mtime of the
new switched file is not newer. If you switch you must either restart the
apache or touch the files.

read more:
http://linuxaria.com/howto/everything-you-need-to-know-about-apc-alternate-php-cache?lang=en

And on php.net about ini configuration values


 Thanks,
 Aaron holmes

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


--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
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
---End Message---
---BeginMessage---

On 14 feb. 2013, at 15:19, ma...@behnke.biz ma...@behnke.biz wrote:

 Aaron Holmes aa...@aaronholmes.net hat am 14. Februar 2013 um 03:53
 geschrieben:
 Hello,
 I'm trying to find some information on APC opcode cache behavior.
 We noticed an issue where, when switching symlinks to different versions
 of sites, old code was running from the previous version after switching
 the symlink.
 
 Anyone know where I can find more information on this?
 
 Yes, that is the case. And iirc it will not update the cache if the mtime of 
 the
 new switched file is not newer. If you switch you must either restart the
 apache or touch the files.
 
 read more:
 http://linuxaria.com/howto/everything-you-need-to-know-about-apc-alternate-php-cache?lang=en
 
 And on php.net about ini configuration values
 
 
 Thanks,
 Aaron holmes
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 --
 Marco Behnke
 Dipl. Informatiker (FH), SAE Audio Engineer Diploma
 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
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


You can also write a little script that clears the APC cache, something in the 
line of: 

#!/usr/bin/php
?php 
apc_clear_cache();

And execute this script each time you deploy. (can also be a command such as 
php -r apc_clear_cache();). This way you'll avoid restarting the webserver 
and it will clear all APC cache forcing APC to cache everything again.

Greetings.

Met vriendelijke groet,
Camilo Sperberg


W: http://unreal4u.com
T: http://twitter.com/unreal4u

---End Message---


Re: [PHP] APC opcode cache behavior

2013-02-14 Thread ma...@behnke.biz
 Aaron Holmes aa...@aaronholmes.net hat am 14. Februar 2013 um 03:53
 geschrieben:
 Hello,
 I'm trying to find some information on APC opcode cache behavior.
 We noticed an issue where, when switching symlinks to different versions
 of sites, old code was running from the previous version after switching
 the symlink.

 Anyone know where I can find more information on this?

Yes, that is the case. And iirc it will not update the cache if the mtime of the
new switched file is not newer. If you switch you must either restart the
apache or touch the files.

read more:
http://linuxaria.com/howto/everything-you-need-to-know-about-apc-alternate-php-cache?lang=en

And on php.net about ini configuration values


 Thanks,
 Aaron holmes

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


--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
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

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



Re: [PHP] APC opcode cache behavior

2013-02-14 Thread Camilo Sperberg

On 14 feb. 2013, at 15:19, ma...@behnke.biz ma...@behnke.biz wrote:

 Aaron Holmes aa...@aaronholmes.net hat am 14. Februar 2013 um 03:53
 geschrieben:
 Hello,
 I'm trying to find some information on APC opcode cache behavior.
 We noticed an issue where, when switching symlinks to different versions
 of sites, old code was running from the previous version after switching
 the symlink.
 
 Anyone know where I can find more information on this?
 
 Yes, that is the case. And iirc it will not update the cache if the mtime of 
 the
 new switched file is not newer. If you switch you must either restart the
 apache or touch the files.
 
 read more:
 http://linuxaria.com/howto/everything-you-need-to-know-about-apc-alternate-php-cache?lang=en
 
 And on php.net about ini configuration values
 
 
 Thanks,
 Aaron holmes
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 --
 Marco Behnke
 Dipl. Informatiker (FH), SAE Audio Engineer Diploma
 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
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


You can also write a little script that clears the APC cache, something in the 
line of: 

#!/usr/bin/php
?php 
apc_clear_cache();

And execute this script each time you deploy. (can also be a command such as 
php -r apc_clear_cache();). This way you'll avoid restarting the webserver 
and it will clear all APC cache forcing APC to cache everything again.

Greetings.

Met vriendelijke groet,
Camilo Sperberg


W: http://unreal4u.com
T: http://twitter.com/unreal4u


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



[PHP] Newbie is trying to set up OOP With PHP and MySQL or MySQLi database class (using CRUD)

2013-02-14 Thread dealTek
Hi everybody,

Newbie is trying to set up OOP With PHP and MySQL or MySQLi database class 
(using CRUD)

Simple story: creating this class database by myself is way over my head. So it 
be best for me to find something on the Internet that has already been created 
and working to pro specs (using CRUD with good security etc).

In my studying, it seems that there is a difference between MySQL and MySQLi - 
MySQLi  being the preferred choice if I understand correctly.

There are lots of examples on the Internet however I don't know enough about it 
to know a good starting example from a bad starting example, so I would much 
appreciate any assistance pointing me towards a good starting point

This seems a good start to me untrained eye, but it seems to be for mysql - not 
mysqli...

http://net.tutsplus.com/tutorials/php/real-world-oop-with-php-and-mysql/

http://www.dreamincode.net/forums/topic/223360-connect-to-your-database-using-oop-php5-with-mysql-and-mysqli/

http://snipplr.com/view/8417/

http://snipplr.com/view/12535/

any assistance is appreciated!

--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]


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



Re: [PHP] Undefined Variables

2013-02-14 Thread Ashley Sheridan


Roman Gelfand rgelfa...@gmail.com wrote:

Is there a performance hit when a variable is undefined? or, perhaps,
aside from the obvious uncontrolled conditions, are there other
impacts?

Thanks in advance

Aside from all the warnings and potential logic bombs?

You will have a negligible performance hit with all the isset() checks you'll 
be using, but they won't be noticeable, and its preferred to use them than not 
to avoid issues with missing values.
Thanks,
Ash
http://www.ashleysheridan.co.uk

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



Re: [PHP] Undefined Variables

2013-02-14 Thread Matijn Woudt
On Thu, Feb 14, 2013 at 7:04 PM, Roman Gelfand rgelfa...@gmail.com wrote:

 Is there a performance hit when a variable is undefined? or, perhaps,
 aside from the obvious uncontrolled conditions, are there other
 impacts?

 Thanks in advance


There might be a little performance hit because the error is getting logged
in your webservers logs, though if it is noticeable depends on which
webserver you're using, and how often there are undefined variables.

- Matijn


Re: [PHP] openssl_encrypt, ecb and IV

2013-02-14 Thread Stephan

Am 24.01.2013 18:08, schrieb Kevin Kinsey:

On Thu, Jan 24, 2013 at 05:55:35PM +0100, steff...@gmx.de wrote:

Hi list,

I am having trouble with error messages saying
Using an empty Initialization Vector (iv) is potentially insecure and not 
recommended

These messages turn up using horde which uses ecb. I don't know the inner 
workings of php and openssl but if I understand correctly, there is no IV used 
in ecb hence there should be no error message according to this:
http://svn.php.net/viewvc?view=revisionrevision=304179
(I am running php version 5.3.20)

Does anybody have any idea why I am getting these errors ? I can reproduce them 
using this code:

?php
openssl_encrypt (Hallo,bf-ecb,abcdef);
?

Regards
Stephan


Because E_WARNING is issued if the optional fourth parameter, Initialization
Vector, is NULL.


Is that so ? In ext/openssl/openssl.c it looks like php is questioning 
openssl if the cipher in question needs an iv by calling 
EVP_CIPHER_iv_length which according to its manpage returns 0 if the 
cipher does not use an iv. If I understand correctly the warning only 
gets thrown if the vector is needed and empty. Since ecb does not need 
an iv this warning should not appear at all, should it ? This is also 
how I understand the log for the code change:


http://svn.php.net/viewvc?view=revisionrevision=304179


How exactly are the error messages troubling you?  If they're appearing on
your site/pages, you should adjust server or site configuration.


That is what I did as a workaround but the question remains why I keep 
getting the warning with recent versions of php. It doesn't matter if I 
compile php against the 0.9.8 or the 1.0.1 versions of openssl.


Thanks
Stephan


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



Re: [PHP] Newbie is trying to set up OOP With PHP and MySQL or MySQLi database class (using CRUD)

2013-02-14 Thread Haluk Karamete
I recommend a third option, that is PDO.

Start here please. http://net.tutsplus.com/?s=pdo

On Thu, Feb 14, 2013 at 9:49 AM, dealTek deal...@gmail.com wrote:
 Hi everybody,

 Newbie is trying to set up OOP With PHP and MySQL or MySQLi database class 
 (using CRUD)

 Simple story: creating this class database by myself is way over my head. So 
 it be best for me to find something on the Internet that has already been 
 created and working to pro specs (using CRUD with good security etc).

 In my studying, it seems that there is a difference between MySQL and MySQLi 
 - MySQLi  being the preferred choice if I understand correctly.

 There are lots of examples on the Internet however I don't know enough about 
 it to know a good starting example from a bad starting example, so I would 
 much appreciate any assistance pointing me towards a good starting point

 This seems a good start to me untrained eye, but it seems to be for mysql - 
 not mysqli...

 http://net.tutsplus.com/tutorials/php/real-world-oop-with-php-and-mysql/

 http://www.dreamincode.net/forums/topic/223360-connect-to-your-database-using-oop-php5-with-mysql-and-mysqli/

 http://snipplr.com/view/8417/

 http://snipplr.com/view/12535/

 any assistance is appreciated!

 --
 Thanks,
 Dave - DealTek
 deal...@gmail.com
 [db-3]


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


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



Re: [PHP] Undefined Variables

2013-02-14 Thread Jan Ehrhardt
Matijn Woudt in php.general (Thu, 14 Feb 2013 19:12:55 +0100):
On Thu, Feb 14, 2013 at 7:04 PM, Roman Gelfand rgelfa...@gmail.com wrote:

 Is there a performance hit when a variable is undefined? or, perhaps,
 aside from the obvious uncontrolled conditions, are there other
 impacts?

There might be a little performance hit because the error is getting logged
in your webservers logs, though if it is noticeable depends on which
webserver you're using, and how often there are undefined variables.

And frameworks like Drupal might intercept the error and store it in the
watchdog file. Then the performance will be degraded.

Jan

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



[PHP] Re: Newbie is trying to set up OOP With PHP and MySQL or MySQLi database class (using CRUD)

2013-02-14 Thread dealTek


On Feb 14, 2013, at 9:49 AM, dealTek deal...@gmail.com wrote:

 Hi everybody,
 
 Newbie is trying to set up OOP With PHP and MySQL or MySQLi database class 
 (using CRUD)
 
 Simple story: creating this class database by myself is way over my head. So 
 it be best for me to find something on the Internet that has already been 
 created and working to pro specs (using CRUD with good security etc).
 
 In my studying, it seems that there is a difference between MySQL and MySQLi 
 - MySQLi  being the preferred choice if I understand correctly.
 
 There are lots of examples on the Internet however I don't know enough about 
 it to know a good starting example from a bad starting example, so I would 
 much appreciate any assistance pointing me towards a good starting point
 
 This seems a good start to me untrained eye, but it seems to be for mysql - 
 not mysqli...
 
 http://net.tutsplus.com/tutorials/php/real-world-oop-with-php-and-mysql/
 
 http://www.dreamincode.net/forums/topic/223360-connect-to-your-database-using-oop-php5-with-mysql-and-mysqli/
 
 http://snipplr.com/view/8417/
 
 http://snipplr.com/view/12535/
 
 any assistance is appreciated!



An Here Jeffry Way discusses the PDO API

http://net.tutsplus.com/tutorials/php/php-database-access-are-you-doing-it-correctly/






 
 --
 Thanks,
 Dave - DealTek
 deal...@gmail.com
 [db-3]
 


--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]


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



Re: [PHP] Re: Newbie is trying to set up OOP With PHP and MySQL or MySQLi database class (using CRUD)

2013-02-14 Thread Haluk Karamete
Also worth checking http://justinvincent.com/ezsql
Which is the class behind the WordPress' wpdb class.

This is a great read too -
http://www.devarticles.com/c/a/MySQL/PHP-and-Databases-for-the-Lazy-Sod/

On Thu, Feb 14, 2013 at 10:30 AM, dealTek deal...@gmail.com wrote:


 On Feb 14, 2013, at 9:49 AM, dealTek deal...@gmail.com wrote:

 Hi everybody,

 Newbie is trying to set up OOP With PHP and MySQL or MySQLi database class 
 (using CRUD)

 Simple story: creating this class database by myself is way over my head. So 
 it be best for me to find something on the Internet that has already been 
 created and working to pro specs (using CRUD with good security etc).

 In my studying, it seems that there is a difference between MySQL and MySQLi 
 - MySQLi  being the preferred choice if I understand correctly.

 There are lots of examples on the Internet however I don't know enough about 
 it to know a good starting example from a bad starting example, so I would 
 much appreciate any assistance pointing me towards a good starting point

 This seems a good start to me untrained eye, but it seems to be for mysql - 
 not mysqli...

 http://net.tutsplus.com/tutorials/php/real-world-oop-with-php-and-mysql/

 http://www.dreamincode.net/forums/topic/223360-connect-to-your-database-using-oop-php5-with-mysql-and-mysqli/

 http://snipplr.com/view/8417/

 http://snipplr.com/view/12535/

 any assistance is appreciated!



 An Here Jeffry Way discusses the PDO API

 http://net.tutsplus.com/tutorials/php/php-database-access-are-you-doing-it-correctly/







 --
 Thanks,
 Dave - DealTek
 deal...@gmail.com
 [db-3]



 --
 Thanks,
 Dave - DealTek
 deal...@gmail.com
 [db-3]


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


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



Re: [PHP] Undefined Variables

2013-02-14 Thread Stuart Dallas
Sorry for the top post!

I don't know numbers, but my gut instinct is that the cycles wasted raising the 
notice (it gets raised even if it goes nowhere so turning display and log 
doesn't remove the hit completely) are better spent executing defensive code.

There is no reason, ever, that production code should raise notices about which 
you don't care. If PHP is telling you something might be wrong, something might 
be wrong! And if you're investigating the code already, figure out what's 
happening and deal with it properly.

Only lazy and/or developers ignore notices. If you're one of them and this 
statement offends you, you probably know it's right!

-Stuart

-- 
Sent from my leaf blower

On 14 Feb 2013, at 18:04, Roman Gelfand rgelfa...@gmail.com wrote:

 Is there a performance hit when a variable is undefined? or, perhaps,
 aside from the obvious uncontrolled conditions, are there other
 impacts?
 
 Thanks in advance
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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



[PHP] PHP fails to install on Ubuntu 12.10. What's going on?

2013-02-14 Thread Chris Bergstresser
Hi all --

   I've got a cloud server on Rackspace.  If I bring up a fresh Ubuntu
12.10 machine image, and type apt-get install php5 it seems to
install fine.  But if I then type php -version I get PHP Parse
error:  syntax error, unexpected end of file in Command line code on
line 1.

   What went wrong?  How can I fix it?

-- Chris

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



Re: [PHP] PHP fails to install on Ubuntu 12.10. What's going on?

2013-02-14 Thread Daniel Brown
On Thu, Feb 14, 2013 at 2:20 PM, Chris Bergstresser ch...@subtlety.com wrote:
 Hi all --

I've got a cloud server on Rackspace.  If I bring up a fresh Ubuntu
 12.10 machine image, and type apt-get install php5 it seems to
 install fine.  But if I then type php -version I get PHP Parse
 error:  syntax error, unexpected end of file in Command line code on
 line 1.

What went wrong?  How can I fix it?

Not only is that extremely vague, but it's possibly more of an
issue with Ubuntu's repo than PHP itself.  Nonetheless, try this and
reply to the list with the output of each:

php -v
php -r 'echo phpversion().PHP_EOL;'
php -nv

Also, while it does work with PHP, note that, with a few
exceptions such as `find`, *NIX CLI short options (single dash)
generally expect a single character, while long options
(double-dashes) take longer strings.

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

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



Re: [PHP] APC opcode cache behavior

2013-02-14 Thread Marco Behnke
Am 14.02.13 16:05, schrieb Camilo Sperberg:

 You can also write a little script that clears the APC cache, something in 
 the line of: 

 #!/usr/bin/php
 ?php 
 apc_clear_cache();

 And execute this script each time you deploy. (can also be a command such as 
 php -r apc_clear_cache();). This way you'll avoid restarting the webserver 
 and it will clear all APC cache forcing APC to cache everything again.

since apache and cli do not share the same apc, it will not work.

-- 
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
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




signature.asc
Description: OpenPGP digital signature


Re: [PHP] Newbie is trying to set up OOP With PHP and MySQL or MySQLi database class (using CRUD)

2013-02-14 Thread Bastien Koert
On Thu, Feb 14, 2013 at 1:24 PM, Haluk Karamete halukkaram...@gmail.com wrote:
 I recommend a third option, that is PDO.

 Start here please. http://net.tutsplus.com/?s=pdo

 On Thu, Feb 14, 2013 at 9:49 AM, dealTek deal...@gmail.com wrote:
 Hi everybody,

 Newbie is trying to set up OOP With PHP and MySQL or MySQLi database class 
 (using CRUD)

 Simple story: creating this class database by myself is way over my head. So 
 it be best for me to find something on the Internet that has already been 
 created and working to pro specs (using CRUD with good security etc).

 In my studying, it seems that there is a difference between MySQL and MySQLi 
 - MySQLi  being the preferred choice if I understand correctly.

 There are lots of examples on the Internet however I don't know enough about 
 it to know a good starting example from a bad starting example, so I would 
 much appreciate any assistance pointing me towards a good starting point

 This seems a good start to me untrained eye, but it seems to be for mysql - 
 not mysqli...

 http://net.tutsplus.com/tutorials/php/real-world-oop-with-php-and-mysql/

 http://www.dreamincode.net/forums/topic/223360-connect-to-your-database-using-oop-php5-with-mysql-and-mysqli/

 http://snipplr.com/view/8417/

 http://snipplr.com/view/12535/

 any assistance is appreciated!

 --
 Thanks,
 Dave - DealTek
 deal...@gmail.com
 [db-3]


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


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


The DreamInCode one is good. MySQLi is the recommended option over
MySQL since the mysql one is deprecated. PDO is also a great option
since you can prepare your queries to help sanitize the data

-- 

Bastien

Cat, the other other white meat

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



Re: [PHP] PHP fails to install on Ubuntu 12.10. What's going on?

2013-02-14 Thread Daniel Brown
Remember to hit reply-all, Andy, so it goes to the list as well as
the previous author.

On Thu, Feb 14, 2013 at 2:49 PM, Andy McKenzie amckenz...@gmail.com wrote:
 On Thu, Feb 14, 2013 at 2:29 PM, Daniel Brown danbr...@php.net wrote:
 On Thu, Feb 14, 2013 at 2:20 PM, Chris Bergstresser ch...@subtlety.com 
 wrote:
 Hi all --

I've got a cloud server on Rackspace.  If I bring up a fresh Ubuntu
 12.10 machine image, and type apt-get install php5 it seems to
 install fine.  But if I then type php -version I get PHP Parse
 error:  syntax error, unexpected end of file in Command line code on
 line 1.

What went wrong?  How can I fix it?

 I'm pretty sure the php5 package in ubuntu doesn't include the cli
 client.  Try adding apt-get install php5-cli (or whatever they're
 calling the package these days) and see if the version command works
 then.  Also, you may need a second hyphen before the word version.

Yes, it would be php5-cli, but since he's getting the response
from PHP (parse error) and not the environment saying the command
isn't found, it shows he's got the CLI installed.  Ubuntu is actually
really helpful with a lot of that, too, since - if it can't find the
command - it'll suggest packages from APT to install which match the
command given.

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

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



Re: [PHP] PHP fails to install on Ubuntu 12.10. What's going on?

2013-02-14 Thread John Iliffe
On Thursday 14 February 2013 14:20:06 Chris Bergstresser wrote:
 Hi all --
 
I've got a cloud server on Rackspace.  If I bring up a fresh Ubuntu
 12.10 machine image, and type apt-get install php5 it seems to
 install fine.  But if I then type php -version I get PHP Parse
 error:  syntax error, unexpected end of file in Command line code on
 line 1.
 
What went wrong?  How can I fix it?
 
 -- Chris
type php --version

There are two - preceding the word version.

J.

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



Re: [PHP] PHP fails to install on Ubuntu 12.10. What's going on?

2013-02-14 Thread Chris Bergstresser
On Thu, Feb 14, 2013 at 3:05 PM, John Iliffe john.ili...@iliffe.ca wrote:
 type php --version

 There are two - preceding the word version.

   Apparently, the version of PHP installed on 12.04 accepts
-version.  The version of PHP installed on 12.10 does not, and bombs
without giving a proper error message.
   Good to know.

-- Chris

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



Re: [PHP] Undefined Variables

2013-02-14 Thread Al



On 2/14/2013 1:54 PM, Stuart Dallas wrote:

Sorry for the top post!

I don't know numbers, but my gut instinct is that the cycles wasted raising the 
notice (it gets raised even if it goes nowhere so turning display and log 
doesn't remove the hit completely) are better spent executing defensive code.

There is no reason, ever, that production code should raise notices about which 
you don't care. If PHP is telling you something might be wrong, something might 
be wrong! And if you're investigating the code already, figure out what's 
happening and deal with it properly.

Only lazy and/or developers ignore notices. If you're one of them and this 
statement offends you, you probably know it's right!

-Stuart



I agree with Stuart.

To minimize the overhead of testing every possible undefined variable with 
isset(), I assign them at the top of the page which uses them. e.g.,


$userInstrHtmlSizeWarning = false;
$currentUserRecArray = array();
if(!isset($_SESSION['pwPassed']))$_SESSION['pwPassed'] = false;

I also have this snippet at the top of my app config file.

if(true){ // TRUE for debug only
  ini_set(display_errors, on); //use off if users will see them
  error_reporting(E_ALL)
  $error_reporting = 'span style=color:redError display and logging 
on/span  ';

}
else $error_reporting=null;

I put this at a convenient place on the page so I don't forget to turn off the 
error reporting when the code goes live.


if($error_reporting) echo $error_reporting;

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



Re: [PHP] Undefined Variables

2013-02-14 Thread Stuart Dallas
On 14 Feb 2013, at 20:57, Al n...@ridersite.org wrote:
 On 2/14/2013 1:54 PM, Stuart Dallas wrote:
 Sorry for the top post!
 
 I don't know numbers, but my gut instinct is that the cycles wasted raising 
 the notice (it gets raised even if it goes nowhere so turning display and 
 log doesn't remove the hit completely) are better spent executing defensive 
 code.
 
 There is no reason, ever, that production code should raise notices about 
 which you don't care. If PHP is telling you something might be wrong, 
 something might be wrong! And if you're investigating the code already, 
 figure out what's happening and deal with it properly.
 
 Only lazy and/or developers ignore notices. If you're one of them and this 
 statement offends you, you probably know it's right!
 
 -Stuart
 
 
 I agree with Stuart.
 
 To minimize the overhead of testing every possible undefined variable with 
 isset(), I assign them at the top of the page which uses them. e.g.,
 
 $userInstrHtmlSizeWarning = false;
 $currentUserRecArray = array();
 if(!isset($_SESSION['pwPassed']))$_SESSION['pwPassed'] = false;
 
 I also have this snippet at the top of my app config file.
 
 if(true){ // TRUE for debug only
  ini_set(display_errors, on); //use off if users will see them
  error_reporting(E_ALL)
  $error_reporting = 'span style=color:redError display and logging 
 on/span  ';
 }
 else $error_reporting=null;
 
 I put this at a convenient place on the page so I don't forget to turn off 
 the error reporting when the code goes live.
 
 if($error_reporting) echo $error_reporting;

I've used the following method for accessing elements of the global arrays for 
a long time. It saves a lot of typing!

http://stut.net/2011/04/12/php-snippet-array-element-access/

Note that if you're using PHP5 you should remove the  before the $a in the 
function definition.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/

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



Re: [PHP] PHP fails to install on Ubuntu 12.10. What's going on?

2013-02-14 Thread Andy McKenzie
On Thu, Feb 14, 2013 at 2:52 PM, Daniel Brown danbr...@php.net wrote:
 Remember to hit reply-all, Andy, so it goes to the list as well as
 the previous author.

 On Thu, Feb 14, 2013 at 2:49 PM, Andy McKenzie amckenz...@gmail.com wrote:
 On Thu, Feb 14, 2013 at 2:29 PM, Daniel Brown danbr...@php.net wrote:
 On Thu, Feb 14, 2013 at 2:20 PM, Chris Bergstresser ch...@subtlety.com 
 wrote:
 Hi all --

I've got a cloud server on Rackspace.  If I bring up a fresh Ubuntu
 12.10 machine image, and type apt-get install php5 it seems to
 install fine.  But if I then type php -version I get PHP Parse
 error:  syntax error, unexpected end of file in Command line code on
 line 1.

What went wrong?  How can I fix it?

 I'm pretty sure the php5 package in ubuntu doesn't include the cli
 client.  Try adding apt-get install php5-cli (or whatever they're
 calling the package these days) and see if the version command works
 then.  Also, you may need a second hyphen before the word version.

 Yes, it would be php5-cli, but since he's getting the response
 from PHP (parse error) and not the environment saying the command
 isn't found, it shows he's got the CLI installed.  Ubuntu is actually
 really helpful with a lot of that, too, since - if it can't find the
 command - it'll suggest packages from APT to install which match the
 command given.

 --
 /Daniel P. Brown
 Network Infrastructure Manager
 http://www.php.net/

Can I just mention, as so many others have, how much I hate the fact
that this list is configured to not reply to the list by default?

Thanks for forwarding this on to the right address, Dan.

-Andy

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



Re: [PHP] PHP fails to install on Ubuntu 12.10. What's going on?

2013-02-14 Thread Daniel Brown
On Thu, Feb 14, 2013 at 4:56 PM, Andy McKenzie amckenz...@gmail.com wrote:

 Can I just mention, as so many others have, how much I hate the fact
 that this list is configured to not reply to the list by default?

I know.  Actually, the only reason it's like this is because a lot
of people will take the conversations off-list on their own, so we
don't force the list as the reply-to address.  After ~13 years,
though, it's difficult to justify the change.

No problem on the forward, though.  Thanks for contributing to the
community.

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

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



Re: [PHP] APC opcode cache behavior

2013-02-14 Thread Camilo Sperberg

On 14 feb. 2013, at 20:32, Marco Behnke ma...@behnke.biz wrote:

 Am 14.02.13 16:05, schrieb Camilo Sperberg:
 
 You can also write a little script that clears the APC cache, something in 
 the line of: 
 
 #!/usr/bin/php
 ?php 
 apc_clear_cache();
 
 And execute this script each time you deploy. (can also be a command such as 
 php -r apc_clear_cache();). This way you'll avoid restarting the webserver 
 and it will clear all APC cache forcing APC to cache everything again.
 
 since apache and cli do not share the same apc, it will not work.
 
 -- 
 Marco Behnke
 Dipl. Informatiker (FH), SAE Audio Engineer Diploma
 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
 
 

Oh true, sorry, I totally forgot.

In that case, you can always do a wget or cURL request to your server forcing 
it to clean APC cache through the webserver, I assume that if you're deploying 
through symlinks you want a really minimal downtime during update, the only bad 
thing about this method is that you need to protect the script from external 
visitors through htaccess or similar methods if you're using other webservers. 
Make the request like: 
wget http://localhost/apc-clear.php -O /dev/null 21

man wget for more information about how to use always the correct options.


If you are using Apache, you can also give a try with a graceful restart, in 
red hat based systems, you would restart apache with:
/etc/init.d/httpd graceful
or
apachectl graceful

I have never tried this on a production machine so I really don't know if that 
is gonna work, but the idea after this method is to: 
The USR1 or graceful signal causes the parent process to advise the children 
to exit after their current request (or to exit immediately if they're not 
serving anything).
http://httpd.apache.org/docs/2.2/stopping.html#graceful

Hope this helps ^^

Met vriendelijke groet,
Camilo Sperberg


W: http://unreal4u.com
T: http://twitter.com/unreal4u


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