[PHP] static Logging class?

2013-03-03 Thread Lars Nielsen
Hi, 

I work on a little hobby-project, and i want to make a oo logging
facility. (php5.3 oop)

Is it best to make a class with static functions that i can call from my
other classes? Or is it more appropriate to make a real logging-class i
should instantiate every time i need to log something? (I just want to
log to a file)

Best regards
Lars Nielsen


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



Re: [PHP] static Logging class?

2013-03-03 Thread Lars Nielsen
Thanks a lot Larry! This PSR-3 looks just the way to do such things! :-)

I hope i chat with you at DrupalCon Praha!
http://www.linkedin.com/profile/view?id=18644639

Best regards
Lars Nielsen
 Make a real classed object that you pass to various objects that need
 it.  Otherwise you make your life way harder for unit testing.  Don't
 have a class that self-enforces that it's a singleton.  That way lies
 pain.

 In particular, I recommend using or writing a class based on the PSR-3
 recommendation:

 https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md

 There's even stock code for the interface and some useful base classes
 available:

 https://packagist.org/packages/psr/log

 And for added fun, there are already publicly available open source
 libraries that implement PSR-3 that you can just drop in and use, such as:

 https://packagist.org/packages/monolog/monolog

 (If that's too heavy for you, writing your own PSR-3 compatible logger
 is dead-simple.)


 I'm sure you're about to say zOMG this is just a hobby project, I don't
 need something that fancy and all injected and shit!  If it's a simple
 project, use a simple container to do all the hard work for you:

 https://packagist.org/packages/pimple/pimple

 (That's  100 lines of executable code.  Quite powerful, dead simple to
 use.)

 Cheers.

 --Larry Garfield, FIG member


 On 03/03/2013 07:26 AM, Lars Nielsen wrote:
 Hi,

 I work on a little hobby-project, and i want to make a oo logging
 facility. (php5.3 oop)

 Is it best to make a class with static functions that i can call from my
 other classes? Or is it more appropriate to make a real logging-class i
 should instantiate every time i need to log something? (I just want to
 log to a file)

 Best regards
 Lars Nielsen




 --
 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] Friday - Return of Brain Teasers

2012-10-07 Thread Lars Nielsen
fre, 05 10 2012 kl. 13:43 -0400, skrev Daniel Brown:
 About five-and-a-half years ago, we had a brainteasers thread
 going on[1].  Last year it was briefly resurrected[2], and both times
 got some good content and dialogue going.  So I'd like to reprise the
 thread in 2012, as well.  Those of you connected to me on Facebook
 (parasane) or Twitter (@oidk) might already have seen it, but a simple
 one to get things rolling:
 
 ?php require ++$cowbell; ?
 
 -- 
 /Daniel P. Brown
 Network Infrastructure Manager
 http://www.php.net/
 

Ah thats easy enough! You just have you includefiles in the $cowbell
array and then require the next one! ;-)

-- 
Lars Nielsen l...@lfweb.dk
LFWeb


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



Re: [PHP] Easiest way to create a web service based on a WSDL document

2012-08-31 Thread Lars Nielsen


fre, 31 08 2012 kl. 16:33 -0430, skrev Néstor Boscán:
 Hi
 
 What's the easiest library/technology/solution to create a web service in
 PHP based on a WSDL document?
 
 Regards,
 
 Néstor Boscán

This one is pretty simple to get started with :
http://www.php.net/manual/en/soapserver.soapserver.php

Best Regards
Lars Nielsen
www.lfweb.dk


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



Re: [PHP] Performance / AB issue?

2012-05-15 Thread Lars Nielsen

 On Fri, May 11, 2012 at 9:53 AM, Camilo Sperberg unrea...@gmail.com
 wrote:


 Sent from my iPhone 5 Beta [Confidential use only]

 On 11 mei 2012, at 07:09, Lars Nielsen l...@lfweb.dk wrote:



 On 10 mei 2012, at 23:26, Lars Nielsen wrote:




 Sent from my iPhone 5 Beta [Confidential use only]

 On 10 mei 2012, at 17:40, Matijn Woudt tijn...@gmail.com wrote:

 On Thu, May 10, 2012 at 9:04 AM, Lars Nielsen l...@lfweb.dk
 wrote:
 Hi there,

 I have apache-2.22/php 5.3.10 set up on a dedicated server but I
 have
 a
 strange issue.

 I have made a Drupal 7 site with a mysql db.

 If I stress-test the site with : ab -c 1 -n 150 http://sitename/
 it
 works
 fine.
 If I stress-test the site with : ab -c 2 -n 20 http://sitename/ it
 kills
 apache.
 If I stress-test the site with : ab -c 50 -n 1500
 http://sitename/static.html it works fine.

 I have set apache's errorlog to debug. But it writes nothing,
 either
 in
 the virtualhost or in the server-file.

 Can anyone give a hint about what can be wrong?



 What do you mean with 'kills apache', does it terminate apache or
 does
 apache hang (eg. 100% cpu), and respond normal after the stress
 test
 is over?
 And what is the index of your site? A php script, or..? Do you have
 ModRewrite redirects etc?

 - Matijn

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


 Can you visit the site normally? Try less verbosing in apache, that
 is
 pretty intensive, but as you can benchmark a static file well (with
 moderate high settings), i assume it is some configuration problem
 in
 drupal.

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



 Hi,

 I can visit the site normaly, but with 2-3 concurrent ab test it
 fails.
 seen from 'ps' and 'htop' it seems that both apache and mysql
 continues
 to
 run normaly but it doesnt respond.

 If i run netstat -an after the test it shows this :
 Active Internet connections (servers and established)
 Proto Recv-Q Send-Q Local Address           Foreign Address
  State
 tcp        0      0 0.0.0.0:22              0.0.0.0:*
        LISTEN
 tcp        0      0 127.0.0.1:25            0.0.0.0:*  
      LISTEN
 tcp        0      0 127.0.0.1:3306          0.0.0.0:*  
      LISTEN
 tcp        0      0 0.0.0.0:80              0.0.0.0:*
        LISTEN
 tcp        1      0 x.x.x.x:80        x.x.x.x:39237  
 CLOSE_WAIT
 tcp        1      0 x.x.x.x:80        x.x.x.x:39236  
  CLOSE_WAIT
 tcp        0      0 x.x.x.x:22        x.x.x.x:47383  
  ESTABLISHED
 tcp        0      0 127.0.0.1:80          
  127.0.0.1:34775
 ESTABLISHED
 tcp        1      0 x.x.x.x:80        x.x.x.x:39300  
  CLOSE_WAIT
 ESTABLISHED
 tcp        0      0 127.0.0.1:34775         127.0.0.1:80
 ESTABLISHED
 tcp        0      0 x.x.x.x:80        x.x.x.x:39330  
  ESTABLISHED
 tcp6       0      0 :::22                   :::*
 LISTEN
 tcp6       0      0 ::1:25                  :::*
 LISTEN

 So it does seem like there should be room for new tcp connections?

 But if I restart apache then it works again... So I guess it is a
 apache/php configuration issue?

 --
 Med venlig hilsen / Best Regards

 LFWeb
 Lars Nielsen
 Thorsensvej 30
 4800 Nykøbing Falster
 Tlf: +45 20 64 85 76
 email : l...@lfweb.dk
 www : http://www.lfweb.dk


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


 Have you tried benchmarking a really simple php page, such as

 ?php echo 'hello world'; ?

 ?

 It that works, than it is definitely an issue in Drupal's
 configuration
 and not in PHP/Apache. Additionally, you could check what happens when
 you
 try to establish a session or make a database call to rule out those
 as
 well, just make really simple tests that you know wouldn't fail and
 run ab
 on them.

 Greetings.


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


 Thanks!

 Now I have made
 ?php
  echo Hey from PHP!;
 ?

 It runs fine from a little concurrency. But with -c 5 -n 500 it fails
 after 308 requests!



 Best Regards / Med venlig hilsen

 LFWeb
 Lars Nielsen


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


 Have you tried benchmarking from localhost? Do you have any active
 firewall? Selinux? Shorewall? Anything that could block a ddos attack?


 A firewall is not the case here. He's testing with -c 2 and is getting
 errors, with -c 50 on a static file not. Also, blocking a DDOS attack
 at only 50 connections is way too low, so I don't think that would
 happen.

 - Matijn

Now i have the result of a test on localhost:


ab -c 1 -n 20 http://localhost/
This is ApacheBench, Version 2.3 $Revision

Re: [PHP] Performance / AB issue?

2012-05-15 Thread Lars Nielsen


 On Fri, May 11, 2012 at 9:53 AM, Camilo Sperberg unrea...@gmail.com
 wrote:


 Sent from my iPhone 5 Beta [Confidential use only]

 On 11 mei 2012, at 07:09, Lars Nielsen l...@lfweb.dk wrote:



 On 10 mei 2012, at 23:26, Lars Nielsen wrote:




 Sent from my iPhone 5 Beta [Confidential use only]

 On 10 mei 2012, at 17:40, Matijn Woudt tijn...@gmail.com wrote:

 On Thu, May 10, 2012 at 9:04 AM, Lars Nielsen l...@lfweb.dk
 wrote:
 Hi there,

 I have apache-2.22/php 5.3.10 set up on a dedicated server but I
 have
 a
 strange issue.

 I have made a Drupal 7 site with a mysql db.

 If I stress-test the site with : ab -c 1 -n 150 http://sitename/
 it
 works
 fine.
 If I stress-test the site with : ab -c 2 -n 20 http://sitename/
 it
 kills
 apache.
 If I stress-test the site with : ab -c 50 -n 1500
 http://sitename/static.html it works fine.

 I have set apache's errorlog to debug. But it writes nothing,
 either
 in
 the virtualhost or in the server-file.

 Can anyone give a hint about what can be wrong?



 What do you mean with 'kills apache', does it terminate apache or
 does
 apache hang (eg. 100% cpu), and respond normal after the stress
 test
 is over?
 And what is the index of your site? A php script, or..? Do you
 have
 ModRewrite redirects etc?

 - Matijn

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


 Can you visit the site normally? Try less verbosing in apache, that
 is
 pretty intensive, but as you can benchmark a static file well (with
 moderate high settings), i assume it is some configuration problem
 in
 drupal.

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



 Hi,

 I can visit the site normaly, but with 2-3 concurrent ab test it
 fails.
 seen from 'ps' and 'htop' it seems that both apache and mysql
 continues
 to
 run normaly but it doesnt respond.

 If i run netstat -an after the test it shows this :
 Active Internet connections (servers and established)
 Proto Recv-Q Send-Q Local Address           Foreign Address
  State
 tcp        0      0 0.0.0.0:22              0.0.0.0:*
        LISTEN
 tcp        0      0 127.0.0.1:25            0.0.0.0:*
  
      LISTEN
 tcp        0      0 127.0.0.1:3306          0.0.0.0:*  
      LISTEN
 tcp        0      0 0.0.0.0:80              0.0.0.0:*
        LISTEN
 tcp        1      0 x.x.x.x:80        x.x.x.x:39237  
 CLOSE_WAIT
 tcp        1      0 x.x.x.x:80        x.x.x.x:39236  
  CLOSE_WAIT
 tcp        0      0 x.x.x.x:22        x.x.x.x:47383  
  ESTABLISHED
 tcp        0      0 127.0.0.1:80          
  127.0.0.1:34775
 ESTABLISHED
 tcp        1      0 x.x.x.x:80        x.x.x.x:39300  
  CLOSE_WAIT
 ESTABLISHED
 tcp        0      0 127.0.0.1:34775         127.0.0.1:80
 ESTABLISHED
 tcp        0      0 x.x.x.x:80        x.x.x.x:39330  
  ESTABLISHED
 tcp6       0      0 :::22                   :::*
 LISTEN
 tcp6       0      0 ::1:25                  :::*
 LISTEN

 So it does seem like there should be room for new tcp connections?

 But if I restart apache then it works again... So I guess it is a
 apache/php configuration issue?

 --
 Med venlig hilsen / Best Regards

 LFWeb
 Lars Nielsen
 Thorsensvej 30
 4800 Nykøbing Falster
 Tlf: +45 20 64 85 76
 email : l...@lfweb.dk
 www : http://www.lfweb.dk


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


 Have you tried benchmarking a really simple php page, such as

 ?php echo 'hello world'; ?

 ?

 It that works, than it is definitely an issue in Drupal's
 configuration
 and not in PHP/Apache. Additionally, you could check what happens
 when
 you
 try to establish a session or make a database call to rule out those
 as
 well, just make really simple tests that you know wouldn't fail and
 run ab
 on them.

 Greetings.


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


 Thanks!

 Now I have made
 ?php
  echo Hey from PHP!;
 ?

 It runs fine from a little concurrency. But with -c 5 -n 500 it
 fails
 after 308 requests!



 Best Regards / Med venlig hilsen

 LFWeb
 Lars Nielsen


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


 Have you tried benchmarking from localhost? Do you have any active
 firewall? Selinux? Shorewall? Anything that could block a ddos attack?


 A firewall is not the case here. He's testing with -c 2 and is getting
 errors, with -c 50 on a static file not. Also, blocking a DDOS attack
 at only 50 connections is way too low, so I don't think that would
 happen.

 - Matijn

 Now i have the result of a test on localhost:


 ab -c 1 -n 20 http://localhost/
 This is ApacheBench, Version 2.3

Re: [PHP] Performance / AB issue?

2012-05-11 Thread Lars Nielsen

 On Fri, May 11, 2012 at 9:53 AM, Camilo Sperberg unrea...@gmail.com
 wrote:


 Sent from my iPhone 5 Beta [Confidential use only]

 On 11 mei 2012, at 07:09, Lars Nielsen l...@lfweb.dk wrote:



 On 10 mei 2012, at 23:26, Lars Nielsen wrote:




 Sent from my iPhone 5 Beta [Confidential use only]

 On 10 mei 2012, at 17:40, Matijn Woudt tijn...@gmail.com wrote:

 On Thu, May 10, 2012 at 9:04 AM, Lars Nielsen l...@lfweb.dk
 wrote:
 Hi there,

 I have apache-2.22/php 5.3.10 set up on a dedicated server but I
 have
 a
 strange issue.

 I have made a Drupal 7 site with a mysql db.

 If I stress-test the site with : ab -c 1 -n 150 http://sitename/
 it
 works
 fine.
 If I stress-test the site with : ab -c 2 -n 20 http://sitename/ it
 kills
 apache.
 If I stress-test the site with : ab -c 50 -n 1500
 http://sitename/static.html it works fine.

 I have set apache's errorlog to debug. But it writes nothing,
 either
 in
 the virtualhost or in the server-file.

 Can anyone give a hint about what can be wrong?



 What do you mean with 'kills apache', does it terminate apache or
 does
 apache hang (eg. 100% cpu), and respond normal after the stress
 test
 is over?
 And what is the index of your site? A php script, or..? Do you have
 ModRewrite redirects etc?

 - Matijn

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


 Can you visit the site normally? Try less verbosing in apache, that
 is
 pretty intensive, but as you can benchmark a static file well (with
 moderate high settings), i assume it is some configuration problem
 in
 drupal.

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



 Hi,

 I can visit the site normaly, but with 2-3 concurrent ab test it
 fails.
 seen from 'ps' and 'htop' it seems that both apache and mysql
 continues
 to
 run normaly but it doesnt respond.

 If i run netstat -an after the test it shows this :
 Active Internet connections (servers and established)
 Proto Recv-Q Send-Q Local Address           Foreign Address
  State
 tcp        0      0 0.0.0.0:22              0.0.0.0:*
        LISTEN
 tcp        0      0 127.0.0.1:25            0.0.0.0:*  
      LISTEN
 tcp        0      0 127.0.0.1:3306          0.0.0.0:*  
      LISTEN
 tcp        0      0 0.0.0.0:80              0.0.0.0:*
        LISTEN
 tcp        1      0 x.x.x.x:80        x.x.x.x:39237  
 CLOSE_WAIT
 tcp        1      0 x.x.x.x:80        x.x.x.x:39236  
  CLOSE_WAIT
 tcp        0      0 x.x.x.x:22        x.x.x.x:47383  
  ESTABLISHED
 tcp        0      0 127.0.0.1:80          
  127.0.0.1:34775
 ESTABLISHED
 tcp        1      0 x.x.x.x:80        x.x.x.x:39300  
  CLOSE_WAIT
 ESTABLISHED
 tcp        0      0 127.0.0.1:34775         127.0.0.1:80
 ESTABLISHED
 tcp        0      0 x.x.x.x:80        x.x.x.x:39330  
  ESTABLISHED
 tcp6       0      0 :::22                   :::*
 LISTEN
 tcp6       0      0 ::1:25                  :::*
 LISTEN

 So it does seem like there should be room for new tcp connections?

 But if I restart apache then it works again... So I guess it is a
 apache/php configuration issue?

 --
 Med venlig hilsen / Best Regards

 LFWeb
 Lars Nielsen
 Thorsensvej 30
 4800 Nykøbing Falster
 Tlf: +45 20 64 85 76
 email : l...@lfweb.dk
 www : http://www.lfweb.dk


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


 Have you tried benchmarking a really simple php page, such as

 ?php echo 'hello world'; ?

 ?

 It that works, than it is definitely an issue in Drupal's
 configuration
 and not in PHP/Apache. Additionally, you could check what happens when
 you
 try to establish a session or make a database call to rule out those
 as
 well, just make really simple tests that you know wouldn't fail and
 run ab
 on them.

 Greetings.


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


 Thanks!

 Now I have made
 ?php
  echo Hey from PHP!;
 ?

 It runs fine from a little concurrency. But with -c 5 -n 500 it fails
 after 308 requests!



 Best Regards / Med venlig hilsen

 LFWeb
 Lars Nielsen


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


 Have you tried benchmarking from localhost? Do you have any active
 firewall? Selinux? Shorewall? Anything that could block a ddos attack?


 A firewall is not the case here. He's testing with -c 2 and is getting
 errors, with -c 50 on a static file not. Also, blocking a DDOS attack
 at only 50 connections is way too low, so I don't think that would
 happen.

 - Matijn

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



Php is running

[PHP] Performance / AB issue?

2012-05-10 Thread Lars Nielsen
Hi there,

I have apache-2.22/php 5.3.10 set up on a dedicated server but I have a
strange issue.

I have made a Drupal 7 site with a mysql db.

If I stress-test the site with : ab -c 1 -n 150 http://sitename/ it works
fine.
If I stress-test the site with : ab -c 2 -n 20 http://sitename/ it kills
apache.
If I stress-test the site with : ab -c 50 -n 1500
http://sitename/static.html it works fine.

I have set apache's errorlog to debug. But it writes nothing, either in
the virtualhost or in the server-file.

Can anyone give a hint about what can be wrong?


Best regards
LFWeb
Lars Nielsen


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



Re: [PHP] Performance / AB issue?

2012-05-10 Thread Lars Nielsen



 Sent from my iPhone 5 Beta [Confidential use only]

 On 10 mei 2012, at 17:40, Matijn Woudt tijn...@gmail.com wrote:

 On Thu, May 10, 2012 at 9:04 AM, Lars Nielsen l...@lfweb.dk wrote:
 Hi there,

 I have apache-2.22/php 5.3.10 set up on a dedicated server but I have a
 strange issue.

 I have made a Drupal 7 site with a mysql db.

 If I stress-test the site with : ab -c 1 -n 150 http://sitename/ it
 works
 fine.
 If I stress-test the site with : ab -c 2 -n 20 http://sitename/ it
 kills
 apache.
 If I stress-test the site with : ab -c 50 -n 1500
 http://sitename/static.html it works fine.

 I have set apache's errorlog to debug. But it writes nothing, either in
 the virtualhost or in the server-file.

 Can anyone give a hint about what can be wrong?



 What do you mean with 'kills apache', does it terminate apache or does
 apache hang (eg. 100% cpu), and respond normal after the stress test
 is over?
 And what is the index of your site? A php script, or..? Do you have
 ModRewrite redirects etc?

 - Matijn

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


 Can you visit the site normally? Try less verbosing in apache, that is
 pretty intensive, but as you can benchmark a static file well (with
 moderate high settings), i assume it is some configuration problem in
 drupal.

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



Hi,

I can visit the site normaly, but with 2-3 concurrent ab test it fails.
seen from 'ps' and 'htop' it seems that both apache and mysql continues to
run normaly but it doesnt respond.

If i run netstat -an after the test it shows this :
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address   Foreign Address  State
tcp0  0 0.0.0.0:22  0.0.0.0:*LISTEN
tcp0  0 127.0.0.1:250.0.0.0:*LISTEN
tcp0  0 127.0.0.1:3306  0.0.0.0:*LISTEN
tcp0  0 0.0.0.0:80  0.0.0.0:*LISTEN
tcp1  0 x.x.x.x:80x.x.x.x:39237   CLOSE_WAIT
tcp1  0 x.x.x.x:80x.x.x.x:39236CLOSE_WAIT
tcp0  0 x.x.x.x:22x.x.x.x:47383ESTABLISHED
tcp0  0 127.0.0.1:80127.0.0.1:34775
ESTABLISHED
tcp1  0 x.x.x.x:80x.x.x.x:39300CLOSE_WAIT 
ESTABLISHED
tcp0  0 127.0.0.1:34775 127.0.0.1:80   
ESTABLISHED
tcp0  0 x.x.x.x:80x.x.x.x:39330ESTABLISHED
tcp6   0  0 :::22   :::*LISTEN
tcp6   0  0 ::1:25  :::*LISTEN

So it does seem like there should be room for new tcp connections?

But if I restart apache then it works again... So I guess it is a
apache/php configuration issue?

-- 
Med venlig hilsen / Best Regards

LFWeb
Lars Nielsen
Thorsensvej 30
4800 Nykøbing Falster
Tlf: +45 20 64 85 76
email : l...@lfweb.dk
www : http://www.lfweb.dk


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



Re: [PHP] Performance / AB issue?

2012-05-10 Thread Lars Nielsen


 On 10 mei 2012, at 23:26, Lars Nielsen wrote:




 Sent from my iPhone 5 Beta [Confidential use only]

 On 10 mei 2012, at 17:40, Matijn Woudt tijn...@gmail.com wrote:

 On Thu, May 10, 2012 at 9:04 AM, Lars Nielsen l...@lfweb.dk wrote:
 Hi there,

 I have apache-2.22/php 5.3.10 set up on a dedicated server but I have
 a
 strange issue.

 I have made a Drupal 7 site with a mysql db.

 If I stress-test the site with : ab -c 1 -n 150 http://sitename/ it
 works
 fine.
 If I stress-test the site with : ab -c 2 -n 20 http://sitename/ it
 kills
 apache.
 If I stress-test the site with : ab -c 50 -n 1500
 http://sitename/static.html it works fine.

 I have set apache's errorlog to debug. But it writes nothing, either
 in
 the virtualhost or in the server-file.

 Can anyone give a hint about what can be wrong?



 What do you mean with 'kills apache', does it terminate apache or does
 apache hang (eg. 100% cpu), and respond normal after the stress test
 is over?
 And what is the index of your site? A php script, or..? Do you have
 ModRewrite redirects etc?

 - Matijn

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


 Can you visit the site normally? Try less verbosing in apache, that is
 pretty intensive, but as you can benchmark a static file well (with
 moderate high settings), i assume it is some configuration problem in
 drupal.

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



 Hi,

 I can visit the site normaly, but with 2-3 concurrent ab test it fails.
 seen from 'ps' and 'htop' it seems that both apache and mysql continues
 to
 run normaly but it doesnt respond.

 If i run netstat -an after the test it shows this :
 Active Internet connections (servers and established)
 Proto Recv-Q Send-Q Local Address   Foreign Address  State
 tcp0  0 0.0.0.0:22  0.0.0.0:*LISTEN
 tcp0  0 127.0.0.1:250.0.0.0:*LISTEN
 tcp0  0 127.0.0.1:3306  0.0.0.0:*LISTEN
 tcp0  0 0.0.0.0:80  0.0.0.0:*LISTEN
 tcp1  0 x.x.x.x:80x.x.x.x:39237   CLOSE_WAIT
 tcp1  0 x.x.x.x:80x.x.x.x:39236CLOSE_WAIT
 tcp0  0 x.x.x.x:22x.x.x.x:47383ESTABLISHED
 tcp0  0 127.0.0.1:80127.0.0.1:34775
 ESTABLISHED
 tcp1  0 x.x.x.x:80x.x.x.x:39300CLOSE_WAIT
 ESTABLISHED
 tcp0  0 127.0.0.1:34775 127.0.0.1:80
 ESTABLISHED
 tcp0  0 x.x.x.x:80x.x.x.x:39330ESTABLISHED
 tcp6   0  0 :::22   :::*
 LISTEN
 tcp6   0  0 ::1:25  :::*
 LISTEN

 So it does seem like there should be room for new tcp connections?

 But if I restart apache then it works again... So I guess it is a
 apache/php configuration issue?

 --
 Med venlig hilsen / Best Regards

 LFWeb
 Lars Nielsen
 Thorsensvej 30
 4800 Nykøbing Falster
 Tlf: +45 20 64 85 76
 email : l...@lfweb.dk
 www : http://www.lfweb.dk


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


 Have you tried benchmarking a really simple php page, such as

 ?php echo 'hello world'; ?

 ?

 It that works, than it is definitely an issue in Drupal's configuration
 and not in PHP/Apache. Additionally, you could check what happens when you
 try to establish a session or make a database call to rule out those as
 well, just make really simple tests that you know wouldn't fail and run ab
 on them.

 Greetings.


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


Thanks!

Now I have made
?php
  echo Hey from PHP!;
?

It runs fine from a little concurrency. But with -c 5 -n 500 it fails
after 308 requests!



Best Regards / Med venlig hilsen

LFWeb
Lars Nielsen


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



Re: [PHP] Zend Amf and Drupal?

2011-10-30 Thread Lars Nielsen
Silence ?
I havn't got any responses from drupal.org, and i think its very quiet
here too?
Should I start to analyze the code to understand the inner workings? Can
anyone give some advise on where to get more information?

Or... is there another proven way to communicate between Flash and
PHP/Drupal?

Regards
Lars Nielsen
lør, 29 10 2011 kl. 12:53 +0200, skrev Lars Nielsen:
 Hey List,
 
 I am making a webservice in Drupal with AMF Zend to provide some methods
 to a Flash app. I have now managed to use standard Drupal services
 (node,user and files) and I have made my own method to create users.
 But! ... When I try to pass on arguments from Flash to Drupal it fails.
 It says that it expects zero arguments but I have provided 4 arguments.
 
 I have posted some info here : http://drupal.org/node/1323678
 
 Can you give me some guidelines? or pointers on what to do?
 
 Kind Regards
 Lars Nielsen
 www.lfweb.dk / www.gearworks.dk
 
 
 




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



[PHP] Zend Amf and Drupal?

2011-10-29 Thread Lars Nielsen
Hey List,

I am making a webservice in Drupal with AMF Zend to provide some methods
to a Flash app. I have now managed to use standard Drupal services
(node,user and files) and I have made my own method to create users.
But! ... When I try to pass on arguments from Flash to Drupal it fails.
It says that it expects zero arguments but I have provided 4 arguments.

I have posted some info here : http://drupal.org/node/1323678

Can you give me some guidelines? or pointers on what to do?

Kind Regards
Lars Nielsen
www.lfweb.dk / www.gearworks.dk



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



Re: [PHP] starting php by asking basic questions

2011-10-16 Thread Lars Nielsen
søn, 16 10 2011 kl. 11:40 +0200, skrev saeed ahmed:
 i want to learn php and i do not know much and my english is also
 limited.isthere anyone who can explain me php by most simple
 example,like explainig to
 a child,something like this:if you put this symbol or writing, in your php
 script,when someone open this page,will see this messagelong time not see
 .
 at the moment ,i am scared of terms used by professionals.
 thnks,for many this could a stupid but this is what i am facing.
 thanks.

You could start at http://php.net/manual/en/getting-started.php which
gives a basic introduction to php-concepts.

What is you preferred spoken language? Try to google for php basic
tutorial or php getting started. Try somthing similar in you own
language.

Regards Lars
www.lfweb.dk


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



Re: [PHP] Generate CMS based on database schema

2011-09-30 Thread Lars Nielsen
If you like Drupal, you should definitely take a look at Drush. Its a
shell for Drupal which allows you to install, configure and manage
drupal from the commandline. Secondly you could make Drupal
installprofiles which is you own custom drupal configuration. Last you
can look at Aegir which is a webinterface build on top of drush to
provide a gui to manage installations and configurations.

Regards Lars

fre, 30 09 2011 kl. 14:35 -0400, skrev Marc Guay:
 Howdy,
 
 I'm looking for a FOSS equivalent to PHPMaker, or at least something
 which comes close to it.  For those who don't know the program, it
 syncs with your database and allows you to generate an entire CMS
 system based on it.  To be clear, I am not looking for a CRUD code
 generator, I'm looking for something that can generate the whole
 shabang so I can get on with it.
 
 Perhaps someone could sassily tell me why I don't need this tool or
 propose another method, that would be good too.  I really enjoy
 building sites up from the DB schema but hate creating web interfaces
 for editing them.  I've also taken a stab at Drupal, which is like
 doing it the other way around, using the CMS to create the schema, but
 a lot of the time it seems ass backwards and I'm not in the mood to
 get another hand cramp from clicking through the interface for 6 hours
 setting everything up.
 
 Marc
 




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



Re: [PHP] how to use echo checkboxes in php when i don't have access to $_POST

2011-05-28 Thread Lars Nielsen
lør, 28 05 2011 kl. 13:32 +0430, skrev Negin Nickparsa:
 because I echo the checkboxes like this:
 
 if($num0)
 {
 echo table border=2;
 for($i=0;$i$num;$i++)
 {
 $row=mysql_fetch_row($result);
 echo tr;
 echotdinput type='Checkbox' name='p$i'  value='yes' unchecked //td;
 echotd$row[0]/td;
  echo/tr;
 }//for
 echo/table;
 }//if
 
 i can't use $_POST because it's not in html
 how can i insert my items that are checked into table?
Hey,

You are generating HTML output from PHP! Right?

Then why dont you have access to $_POST ???

/Lars


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



Re: [PHP] dynamic copyright in page footer?

2011-04-30 Thread Lars Nielsen
lør, 30 04 2011 kl. 11:18 +, skrev dholmes1...@gmail.com:
 Something simple like this would work 
 $date=date('Y');
 $startdate='2011';
 if($date == $startdate) {
 echo $startdate
 } else {
 Echo $startdate;
 Echo '-';
 echo  $date;
 
 }
 Sent via BlackBerry from T-Mobile
 
 -Original Message-
 From: David Mehler dave.meh...@gmail.com
 Date: Sat, 30 Apr 2011 07:06:17 
 To: php-generalphp-general@lists.php.net
 Subject: [PHP] dynamic copyright in page footer?
 Hello,
 
 I am trying to use php to put a copyright notice in a page footer. I'm
 using the date function with the Y value for the year. Here's the
 code:
 
 ?php
 echo date ('Y');
 ?
 
 This works great for a site done in 2011 but next year I'm going to
 want to have 2011 and 2012 in the copyright notice, adding an
 additional year the site's up. I'd appreciate some suggestions i'm
 very likely overthinking this.
 
 Thanks.
 Dave.
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
Hi there,

I have been using the following little chunk:

?php
$startYear = 2010;
$curYear = date(Y);
echo copy; .$startYear.(($startYear!=$curYear)?' -
'.$curYear : ''); 
?

Regards 
Lars Nielsen

http://www.lfweb.dk


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



[PHP] database abstraction layer

2010-02-02 Thread Lars Nielsen
Hi List

I am trying to make a Database Abstraction Layer so I can which the DB
of my application between MySQL and Postgresql. I have been looking at
the way phpBB does it, and it seems that it is only then php-functions
which are different. The SQL seems to be the same.

Is it save to assume that I can use the same SQL, or should i make some
exceptions?

Regards 
Lars Nielsen



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



[PHP] IDE with ftp and subversion?

2009-10-24 Thread Lars Nielsen
Hi there,

Can anyone recommend an IDE with both subversion and ftp integration?
I have played a little with eclipse but find the integrations a little
dificult to manage.
Idealy I want a local development server with LAMP+svn and then an easy
opportunity to publish a site to a production server.

Can anyone give me a hint?

Regards
Lars Nielsen


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



Re: [PHP] IDE with ftp and subversion?

2009-10-24 Thread Lars Nielsen
Hi,
No I have not tryed that yet. Giving it a shot now! :-) 

Thanks

/Lars
lør, 24 10 2009 kl. 12:15 +0200, skrev John Black:
 Lars Nielsen wrote:
  Can anyone recommend an IDE with both subversion and ftp integration?
  I have played a little with eclipse but find the integrations a little
  dificult to manage.
  Idealy I want a local development server with LAMP+svn and then an easy
  opportunity to publish a site to a production server.
 
 
 Have you tried Netbeans?
   http://www.netbeans.org/downloads/index.html
 
 It comes with svn support, can upload your project to your webserver 
 over ftp, step by step debugger and a lot more.
 
 Give it a try
 -- 
 John
 A casual stroll through the lunatic asylum shows that faith does not 
 prove anything.
 [Friedrich Nietzsche]
 


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



Re: [PHP] IDE with ftp and subversion?

2009-10-24 Thread Lars Nielsen
lør, 24 10 2009 kl. 12:15 +0200, skrev John Black:
 Lars Nielsen wrote:
  Can anyone recommend an IDE with both subversion and ftp integration?
  I have played a little with eclipse but find the integrations a little
  dificult to manage.
  Idealy I want a local development server with LAMP+svn and then an easy
  opportunity to publish a site to a production server.
 
 
 Have you tried Netbeans?
   http://www.netbeans.org/downloads/index.html
 
 It comes with svn support, can upload your project to your webserver 
 over ftp, step by step debugger and a lot more.
 
 Give it a try
 -- 
 John
 A casual stroll through the lunatic asylum shows that faith does not 
 prove anything.
 [Friedrich Nietzsche]
 
Thanks again! :-)
It works like a dream! 

/Lars


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



[PHP] php exception handling

2009-10-11 Thread Lars Nielsen
Hi,

I am trying to make an exception class that emails the errors to myself.
I have started by using the example by ask at nilpo dot com on
http://dk2.php.net/manual/en/language.exceptions.php.

It work ok but i want it NOT to show the errors on the php-page but only
show the details in the email and then just write eg An error occurred
or so on the webpage. Can anyone give me a hint about how to achieve
this?

Regards 
Lars Nielsen


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



[PHP] modules in php?

2009-09-26 Thread Lars Nielsen
Hi, 
I am developing a cms and I want to make it able to use modules. Ex a
statistics module.
Can you give som examples or pointers to where i can start reading
without getting lost in the details?

regards
Lars Nielsen


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



Re: [PHP] variable

2009-09-24 Thread Lars Nielsen
Hi Grega

I think you might want to have a look at the array's section of the php
manual.
http://www.php.net/array

regards Lars

tor, 24 09 2009 kl. 19:10 +0200, skrev Grega Leskovšek:
 Suppose I have a variable $i = 0 or 1 or 2
 and I have variables $item0, $item1 and $item2
 how do I print the variable $item0 using a combination of variable $item and
 variable $i?
 or with this code it gives me an error:
 $i = 0;
 $item0 = test;
 echo $item$i; #how do I properly use this variable $item with $i?
 
 Thanks in advance, Yours, Grega
 
 
 -- Peace refuge: http://users.skavt.net/~gleskovs/
 When the sun rises I receive and when it sets I forgive;) Grega Leskovšek


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



[PHP] accessing variable from inside a class

2009-09-04 Thread Lars Nielsen
Hi,

How do i access a variable from inside a class? ex. I want to use
$template_dir inside Template.


$template_dir = 'templates/';

class templateParser {
var $output;

function templateParser($templateFile='default_template.htm')
{
(file_exists($template_dir.$templateFile)) ? 

$this-output=file_get_contents($template_dir.$templateFile) 
:
die('Error:Template file 
'.$template_dir.$templateFile.' not found');
}

}

I run Fedora 10, apache 2.2.11 and php 5.2.9.
I get an error saying that $template_dir is undefined.

Regards
Lars Nielsen


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



Re: [PHP] accessing variable from inside a class

2009-09-04 Thread Lars Nielsen
I cant get it to work. I will use a configuration class instead.

function templateParser($templateFile='default_template.htm')
{
$c = new config();
(file_exists($c-template_dir.$templateFile)) ? 

$this-output=file_get_contents($c-template_dir.$templateFile) 
:
die('Error:Template file 
'.$template_dir.$templateFile.' not found');
}


/Lars

fre, 04 09 2009 kl. 14:49 -0700, skrev James Colannino:
 Lars Nielsen wrote:
  Hi,
  
  How do i access a variable from inside a class?
 
 Add the following statement:
 global $template_dir;
 
 James
 


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



[PHP] php cms?

2009-08-25 Thread Lars Nielsen
Hey list,

I am going to use a cms for some sites and I have looked a little at
Typo3, Joomla and php-fusion.
Can anyone recommend a system where it is easy to customize the
templates?

regards
Lars Nielsen


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



Re: [PHP] php cms?

2009-08-25 Thread Lars Nielsen
tir, 25 08 2009 kl. 17:05 -0400, skrev Bastien Koert:
 On Tue, Aug 25, 2009 at 4:35 PM, Lars Nielsenl...@mit-web.dk wrote:
  Hey list,
 
  I am going to use a cms for some sites and I have looked a little at
  Typo3, Joomla and php-fusion.
  Can anyone recommend a system where it is easy to customize the
  templates?
 
  regards
  Lars Nielsen
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 Joomla or Drupal are good
 
 -- 
 
 Bastien
 
 Cat, the other other white meat
 

ok, thanks

I'll give joomla! another shot.

/Lars


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



[PHP] mirroring website

2009-06-21 Thread Lars Nielsen
Hey

I have the following issue! I want to develop my website on my local
machine, and then upload the entire developed site to a production
server. What is the best strategy to do that?
I have been looking at a php mirroring script but that was about 5 years
old! Is'nt there a better/newer approach?

By the way... I'm using Fedora linux with LAMP (php5)

best regards
Lars Nielsen
www.mit-web.dk


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



Re: [PHP] mirroring website

2009-06-21 Thread Lars Nielsen
Thanks for the cents.

I will try a combination of multiple configuration files and rsync!

/Lars
søn, 21 06 2009 kl. 16:39 +0100, skrev Richard Heyes:
 Hi,
 
  I have the following issue! I want to develop my website on my local
  machine, and then upload the entire developed site to a production
  server. What is the best strategy to do that?
  I have been looking at a php mirroring script but that was about 5 years
  old! Is'nt there a better/newer approach?
 
 I used to use rsync (with a bunch of options) whenever I did this.
 With you being on Linux, it would be trivial to automate it with a
 script.
 
 -- 
 Richard Heyes
 HTML5 graphing: RGraph (www.rgraph.net - updated 20th June)
 PHP mail: RMail (www.phpguru.org/rmail)
 PHP datagrid: RGrid (www.phpguru.org/rgrid)
 PHP Template: RTemplate (www.phpguru.org/rtemplate)
 PHP SMTP: http://www.phpguru.org/smtp
 


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



[PHP] share code between sites

2009-06-21 Thread Lars Nielsen
Hey List

Is there any good approach to share code between multiple sites? The
code might be on the same server but on different domains.

best regards

Lars


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



Re: [PHP] share code between sites

2009-06-21 Thread Lars Nielsen
Yeah maybe thats the way to do it. It certantly sounds like a working
solution.

søn, 21 06 2009 kl. 16:02 -0400, skrev Eddie Drapkin:
 The same document root and different Vhosts?
 
 On Sun, Jun 21, 2009 at 4:01 PM, Lars Nielsenl...@mit-web.dk wrote:
  Hey List
 
  Is there any good approach to share code between multiple sites? The
  code might be on the same server but on different domains.
 
  best regards
 
  Lars
 
 
  --
  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