Re: [PHP] Problem with mbstring.internal_encoding, mcrypt and php-fpm
Hristo, Try changing the php.ini config: mbstring.func_overload 0 See if that helps your issue, more on what it does: http://php.net/manual/en/mbstring.overload.php Aziz On Mon, Sep 23, 2013 at 8:23 AM, Condor con...@stz-bg.com wrote: Hello, from two days I have strange problem with this param mbstring.internal_encoding on nginx and php-fpm. I use php version 5.4.20 and when I setting mbstring.internal_encoding I have a problem with mcrypt. NOTICE: PHP message: PHP Warning: mcrypt_generic_init(): Iv size incorrect; supplied length: 12, needed: 8 in file.php I setup php.ini file: zend.multibyte = On default_mimetype = text/html default_charset = UTF-8 mbstring.internal_encoding = UTF-8 and here is function: 85 private function decrypt($blob) 86 { 87 $deckey = $_SESSION['key']; 88 $realkey = sha1($deckey, true); 89 $rawblob = hex2bin($blob); /* binary blob */ 90 $td = mcrypt_module_open($this-**CIPHER, , MCRYPT_MODE_CFB, ); 91 $iv = mb_substr($rawblob, 0, mcrypt_enc_get_iv_size($td)); /* IV */ 92 if (mb_strlen($iv) mcrypt_enc_get_iv_size($td)) return FALSE; 93 $ct = mb_substr($rawblob, mcrypt_enc_get_iv_size($td)); /* CipherText */ 94--- mcrypt_generic_init($td, $realkey, $iv); 95 $unblob = mdecrypt_generic($td, $ct); 96 mcrypt_generic_deinit($td); 97 $pt = mb_substr($unblob, 20); 98 $check = mb_substr($unblob, 0, 20); 99 if ($check != sha1($pt, true)) 100 { 101 return FALSE; 102 } else { 103 return $pt; 104 } 105 } The same code with the same config options is worked fine with apache httpd. Any one can give me a little help ? Thanks Regards, Hristo S. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with mbstring.internal_encoding, mcrypt and php-fpm
On 2013-09-23 15:42, Aziz Saleh wrote: Hristo, Try changing the php.ini config: mbstring.func_overload 0 See if that helps your issue, more on what it does: http://php.net/manual/en/mbstring.overload.php [3] Aziz On Mon, Sep 23, 2013 at 8:23 AM, Condor con...@stz-bg.com wrote: Hello, from two days I have strange problem with this param mbstring.internal_encoding on nginx and php-fpm. I use php version 5.4.20 and when I setting mbstring.internal_encoding I have a problem with mcrypt. NOTICE: PHP message: PHP Warning: mcrypt_generic_init(): Iv size incorrect; supplied length: 12, needed: 8 in file.php I setup php.ini file: zend.multibyte = On default_mimetype = text/html default_charset = UTF-8 mbstring.internal_encoding = UTF-8 and here is function: 85 private function decrypt($blob) 86 { 87 $deckey = $_SESSION['key']; 88 $realkey = sha1($deckey, true); 89 $rawblob = hex2bin($blob); /* binary blob */ 90 $td = mcrypt_module_open($this-CIPHER, , MCRYPT_MODE_CFB, ); 91 $iv = mb_substr($rawblob, 0, mcrypt_enc_get_iv_size($td)); /* IV */ 92 if (mb_strlen($iv) mcrypt_enc_get_iv_size($td)) return FALSE; 93 $ct = mb_substr($rawblob, mcrypt_enc_get_iv_size($td)); /* CipherText */ 94 --- mcrypt_generic_init($td, $realkey, $iv); 95 $unblob = mdecrypt_generic($td, $ct); 96 mcrypt_generic_deinit($td); 97 $pt = mb_substr($unblob, 20); 98 $check = mb_substr($unblob, 0, 20); 99 if ($check != sha1($pt, true)) 100 { 101 return FALSE; 102 } else { 103 return $pt; 104 } 105 } The same code with the same config options is worked fine with apache httpd. Any one can give me a little help ? Thanks Regards, Hristo S. Hello, I just try and no effect after reload the php-fpm. Regards, Hristo S. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with variables
Fernando A soporteallpurp...@gmail.com wrote: I am working with php and codeigniter, but I have not yet experienced. I need create a variable that is available throughout system. This variable contains the number of company and can change. as I can handle this? Hi, Fernando, welcome. I'm just a little unsure what you mean by number of company -- is this a count, as in 10 companies, or is it a phone number, or is it something else? Jim's reply is workable -- storing session values is quite useful, but sessions are tied to a specific browser client/ip, and I'm not sure that's what you want/need here. If you are looking for setting a global variable that will be available everywhere in your application, you can use $GLOBALS, or set it from the very top level context of the application. Given you're using CodeIgniter, which sadly I am not versed in, you may need to set it with $GLOBALS: $GLOBALS['my_var'] = 10; // whatever you need to do here When you say it changes, how and when exactly does it change? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with my login script
Hello Thomas. The if are being evaluated in all iterations of the while, the problem is you didn't stop the loop when it finds what it's searching for. Try putting a break in the end of the if, them, when the condition match, the while will stop. And hey! You're using a lot of legacy code for one that is learning php. If you want, I can give you some tips to modernize your script ;) Regards, Rodrigo Silva dos Santos. Enviado por Samsung Mobile Thomas Conrad koopasfore...@gmail.com escreveu: I'm currently learning php and as a challenge, I'm creating a login script using text files to store the information (until I learn how to handle databases with php). The problem I'm having is the if statement in my while loop is only evaluated on the last iteration of the while loop, so its only comparing the last username in the file and no others. Heres the code: ?php session_start(); $users = file(../inc/users.inc.php); if($_POST['username'] $_POST['password']){ if(ereg(^[^@ ]+@[^@ ]+\.[^@ \.]+$, $_POST['username'])){ while(list($id ,$username) = each($users)){ if($_POST['username'] == $username){ $_SESSION['logged_in'] = 1; $_SESSION['username'] = $username; } } if($_SESSION['logged_in'] != 1){ $error = 2; } }else{ $error = 4; } }else{ $error = 3; } if($error){ header(Location: http://koopasforever.com/scripts/login.php?error=$error;); }else{ header(Location: http://koopasforever.com/;); } ? I have checked all my variables and they all contain the proper information Some help would be greatly appriciated, Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with my login script
The problem was already solved. I forgot to send a copy to the list... Rodrigo, break!? Ohh man, it's a crazy idea... A developer DOES NOT use break at all (in a loop)... (switch is an exception) In the other hand Thomas, you should use while and count the lines and u need to test if username found... Yeah, this script is near to the good solution: ?php session_start(); $users = file(users.inc.php); if (!empty($_POST['username']) !empty($_POST['password'])) { if (filter_var($_POST['username'], FILTER_VALIDATE_EMAIL)) { $ui = 0; while ($ui count($users) $error != 0) { $user = explode(' ', trim($users[$ui])); if ($_POST['username'] == $user[1]) { $_SESSION['logged_in'] = 1; $_SESSION['username'] = $user[1]; $error = 0; } else{ $error = 2; } $ui++; } } else { $error = 4; } } else { $error = 3; } if ($error == 0) { print(redirecting); } else { print(error: . $error); } ? On Tue, Oct 2, 2012 at 8:52 AM, Thomas Conrad koopasfore...@gmail.comwrote: I'm currently learning php and as a challenge, I'm creating a login script using text files to store the information (until I learn how to handle databases with php). The problem I'm having is the if statement in my while loop is only evaluated on the last iteration of the while loop, so its only comparing the last username in the file and no others. Heres the code: ?php session_start(); $users = file(../inc/users.inc.php); if($_POST['username'] $_POST['password']){ if(ereg(^[^@ ]+@[^@ ]+\.[^@ \.]+$, $_POST['username'])){ while(list($id ,$username) = each($users)){ if($_POST['username'] == $username){ $_SESSION['logged_in'] = 1; $_SESSION['username'] = $username; } } if($_SESSION['logged_in'] != 1){ $error = 2; } }else{ $error = 4; } }else{ $error = 3; } if($error){ header(Location: http://koopasforever.com/scripts/login.php?error=$error;); }else{ header(Location: http://koopasforever.com/;); } ? I have checked all my variables and they all contain the proper information Some help would be greatly appriciated, Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with my login script
Better solution than mine (that don't even make a code) As a Oo developer, a run away from using switch, so I should never use break too... Good to know. By the way, what's the problem with it? Enviado por Samsung Mobile Bálint Horváth hbal...@gmail.com escreveu: The problem was already solved. I forgot to send a copy to the list... Rodrigo, break!? Ohh man, it's a crazy idea... A developer DOES NOT use break at all (in a loop)... (switch is an exception) In the other hand Thomas, you should use while and count the lines and u need to test if username found... Yeah, this script is near to the good solution: ?php session_start(); $users = file(users.inc.php); if (!empty($_POST['username']) !empty($_POST['password'])) { if (filter_var($_POST['username'], FILTER_VALIDATE_EMAIL)) { $ui = 0; while ($ui count($users) $error != 0) { $user = explode(' ', trim($users[$ui])); if ($_POST['username'] == $user[1]) { $_SESSION['logged_in'] = 1; $_SESSION['username'] = $user[1]; $error = 0; } else{ $error = 2; } $ui++; } } else { $error = 4; } } else { $error = 3; } if ($error == 0) { print(redirecting); } else { print(error: . $error); } ? On Tue, Oct 2, 2012 at 8:52 AM, Thomas Conrad koopasfore...@gmail.comwrote: I'm currently learning php and as a challenge, I'm creating a login script using text files to store the information (until I learn how to handle databases with php). The problem I'm having is the if statement in my while loop is only evaluated on the last iteration of the while loop, so its only comparing the last username in the file and no others. Heres the code: ?php session_start(); $users = file(../inc/users.inc.php); if($_POST['username'] $_POST['password']){ if(ereg(^[^@ ]+@[^@ ]+\.[^@ \.]+$, $_POST['username'])){ while(list($id ,$username) = each($users)){ if($_POST['username'] == $username){ $_SESSION['logged_in'] = 1; $_SESSION['username'] = $username; } } if($_SESSION['logged_in'] != 1){ $error = 2; } }else{ $error = 4; } }else{ $error = 3; } if($error){ header(Location: http://koopasforever.com/scripts/login.php?error=$error;); }else{ header(Location: http://koopasforever.com/;); } ? I have checked all my variables and they all contain the proper information Some help would be greatly appriciated, Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with my login script
As a Oo developer, a run away from using switch - I don't understand this: OOP and switch could be good together and I also prefer switch eg. at action or page selection... break is an old stuff and not a nice solution (like goto)... killing a procedure!? -means wrong planning of an app! (and jumping in the code with goto also like this) On Tue, Oct 2, 2012 at 12:11 PM, Rodrigo Silva dos Santos rodrigos.santo...@gmail.com wrote: Better solution than mine (that don't even make a code) As a Oo developer, a run away from using switch, so I should never use break too... Good to know. By the way, what's the problem with it? Enviado por Samsung Mobile Bálint Horváth hbal...@gmail.com escreveu: The problem was already solved. I forgot to send a copy to the list... Rodrigo, break!? Ohh man, it's a crazy idea... A developer DOES NOT use break at all (in a loop)... (switch is an exception) In the other hand Thomas, you should use while and count the lines and u need to test if username found... Yeah, this script is near to the good solution: ?php session_start(); $users = file(users.inc.php); if (!empty($_POST['username']) !empty($_POST['password'])) { if (filter_var($_POST['username'], FILTER_VALIDATE_EMAIL)) { $ui = 0; while ($ui count($users) $error != 0) { $user = explode(' ', trim($users[$ui])); if ($_POST['username'] == $user[1]) { $_SESSION['logged_in'] = 1; $_SESSION['username'] = $user[1]; $error = 0; } else{ $error = 2; } $ui++; } } else { $error = 4; } } else { $error = 3; } if ($error == 0) { print(redirecting); } else { print(error: . $error); } ? On Tue, Oct 2, 2012 at 8:52 AM, Thomas Conrad koopasfore...@gmail.com wrote: I'm currently learning php and as a challenge, I'm creating a login script using text files to store the information (until I learn how to handle databases with php). The problem I'm having is the if statement in my while loop is only evaluated on the last iteration of the while loop, so its only comparing the last username in the file and no others. Heres the code: ?php session_start(); $users = file(../inc/users.inc.php); if($_POST['username'] $_POST['password']){ if(ereg(^[^@ ]+@[^@ ]+\.[^@ \.]+$, $_POST['username'])){ while(list($id ,$username) = each($users)){ if($_POST['username'] == $username){ $_SESSION['logged_in'] = 1; $_SESSION['username'] = $username; } } if($_SESSION['logged_in'] != 1){ $error = 2; } }else{ $error = 4; } }else{ $error = 3; } if($error){ header(Location: http://koopasforever.com/scripts/login.php?error=$error;); }else{ header(Location: http://koopasforever.com/;); } ? I have checked all my variables and they all contain the proper information Some help would be greatly appriciated, Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with my login script
Make sense, I haven't ever realizad how old the code appears like when it haves a break. Fell like C. Livin' n' learnin'. Thanks! Enviado por Samsung Mobile Bálint Horváth hbal...@gmail.com escreveu: As a Oo developer, a run away from using switch - I don't understand this: OOP and switch could be good together and I also prefer switch eg. at action or page selection... break is an old stuff and not a nice solution (like goto)... killing a procedure!? -means wrong planning of an app! (and jumping in the code with goto also like this) On Tue, Oct 2, 2012 at 12:11 PM, Rodrigo Silva dos Santos rodrigos.santo...@gmail.com wrote: Better solution than mine (that don't even make a code) As a Oo developer, a run away from using switch, so I should never use break too... Good to know. By the way, what's the problem with it? Enviado por Samsung Mobile Bálint Horváth hbal...@gmail.com escreveu: The problem was already solved. I forgot to send a copy to the list... Rodrigo, break!? Ohh man, it's a crazy idea... A developer DOES NOT use break at all (in a loop)... (switch is an exception) In the other hand Thomas, you should use while and count the lines and u need to test if username found... Yeah, this script is near to the good solution: ?php session_start(); $users = file(users.inc.php); if (!empty($_POST['username']) !empty($_POST['password'])) { if (filter_var($_POST['username'], FILTER_VALIDATE_EMAIL)) { $ui = 0; while ($ui count($users) $error != 0) { $user = explode(' ', trim($users[$ui])); if ($_POST['username'] == $user[1]) { $_SESSION['logged_in'] = 1; $_SESSION['username'] = $user[1]; $error = 0; } else{ $error = 2; } $ui++; } } else { $error = 4; } } else { $error = 3; } if ($error == 0) { print(redirecting); } else { print(error: . $error); } ? On Tue, Oct 2, 2012 at 8:52 AM, Thomas Conrad koopasfore...@gmail.comwrote: I'm currently learning php and as a challenge, I'm creating a login script using text files to store the information (until I learn how to handle databases with php). The problem I'm having is the if statement in my while loop is only evaluated on the last iteration of the while loop, so its only comparing the last username in the file and no others. Heres the code: ?php session_start(); $users = file(../inc/users.inc.php); if($_POST['username'] $_POST['password']){ if(ereg(^[^@ ]+@[^@ ]+\.[^@ \.]+$, $_POST['username'])){ while(list($id ,$username) = each($users)){ if($_POST['username'] == $username){ $_SESSION['logged_in'] = 1; $_SESSION['username'] = $username; } } if($_SESSION['logged_in'] != 1){ $error = 2; } }else{ $error = 4; } }else{ $error = 3; } if($error){ header(Location: http://koopasforever.com/scripts/login.php?error=$error;); }else{ header(Location: http://koopasforever.com/;); } ? I have checked all my variables and they all contain the proper information Some help would be greatly appriciated, Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with my login script
On 02-10-2012 11:59, Bálint Horváth wrote: The problem was already solved. I forgot to send a copy to the list... Rodrigo, break!? Ohh man, it's a crazy idea... A developer DOES NOT use break at all (in a loop)... (switch is an exception) I personally find this statement to be utter bullshit. There is nothing wrong with using break. There is a very good reason why it's available in the language. In very many cases, it costs a lot less code to add a break than to add additional clauses to your while-conditional. You don't honestly believe that: while(list($key,$user) = each(file('someUserList')) and $foundUser=false) { if($user == $usernameWeAreLookingFor) { $foundUser = true; } } looks oh so much better than a simple: foreach(file('someUserList') as $key=$val) { if($user == $usernameWeAreLookingFor) { break; } } Also do note that it is very hard to use your do not use break, ever when you want to use foreach and want to stop at the first find. Seriously, stop giving advice to never use perfectly good code. In very complicated, long, loops, I agree that using break in various places can make debugging difficult. The solution however is not to refrain from ever using break, but rather to change your code into a clearer format. This is like saying you can make bombs from fertilizer, ergo fertilizer should not ever be used!. Everything has its use, and abuse. Same goes for goto, it can also be used for good. In the other hand Thomas, you should use while and count the lines and u need to test if username found... Ehr, he could also use foreach, for or any other loop construct... On a sidenote: please, please, please do not say u need. There is no u in english, it's written (and pronounced) you. Stick to that, you sound like a damned dumb teenager to me when using such needlessly abbreviated words. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with PHP in Moodle LMS
Has anyone ever heard of a problem with the Moodle LMS when trying to edit an activity (quiz, resource) in which there is a timeout after only a few seconds and a message saying something to the effect of that the system is sorry but there was a time out, please retry. When I look in the URL I see the following after my domain name: .../course/modeit.php Is this purely a Moodle thing, or something someone can help me with. (I've already searched the Moodle site for information about this error, but can't see anything related to version 2.2.3, which I am using.) Any help would be appreciated. I thought I might want to up the timout figure in the php5.ini file in the root directory of my shared Linux hosting with Godaddy, but I don't think that's really the problem. Regards, Gary Gary, Yes Moodle has a configuration issue. I would switch it to Debug mode and check the error logs it will tell you exactly what is going wrong. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem sending email
On Thu, May 24, 2012 at 2:00 PM, As'ad Djamalilleil asad@gmail.com wrote: hi all,i'm having this problem in sending email using pear. it just wont send :( here's the code .. ?php require_once 'Mail.php'; $from_name = My Self; $to_name = My Friend; $subject = Sending Trial; $mailmsg = GOD please make it work; $From = From: .$from_name. mym...@gmail.com; $To = To: .$to_name. some...@yahoo.com; Don't prefix with From: and To: here. $recipients = some...@yahoo.com; $headers[From] = $From; $headers[To] = $To; $headers[Subject] = $subject; $headers[Content-Type] = text/plain; charset=iso-8859-1; $smtpinfo[host] = smtp.gmail.com; $smtpinfo[port] = 465; $smtpinfo[auth] = true; $smtpinfo[username] = mym...@gmail.com; $smtpinfo[password] = mypassword; $mail_object = Mail::factory(smtp, $smtpinfo); $mail_object-send($recipients, $headers, $mailmsg); if (PEAR::isError($mail_object)) echo $mail_object-getMessage(); ? Also, Gmail SMTP supports only SSL connections. I don't know this PEAR module, but I think you need to host set to something like ssl://smtp.gmail.com, to enforce SSL connection. - Matijn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with AssertTag: children count wrong
On 05/02/2012 10:55 AM, Michael Otteneder wrote: Hi List! I'm trying to use phpUnit's AssertTag function to make sure that some html code contains an ul element with exactly li items in it. My test looks like this: function testUnconfiguredFilter() { $matcher = array( 'tag' = 'ul', 'children' = array( 'count' = 3, 'only' = array('tag' = 'li') ) ); $this-assertTag($matcher, $this-html, $message, $isHtml = FALSE); } the value of $html is: div class=flFilterbox id=flFilterunconfiguredFilter h3unconfiguredFilter/h3 ul class=flFilterboxInner lia href= FilterValue1/a ()/li lia href= FilterValue2/a ()/li lia href= FilterValue3/a ()/li /ul /div So I think the assertion SHOULD work - but it does not, no matter what I use for count! Sadly PHPUnit's output ist not very helpful, all it gives me is: 1) GeneratedFiltersTest::testUnconfiguredFilter Failed asserting that false is true. When dealing with classes, and specifically calling a static method within a class, the variable $this does not exist. You must use 'self' instead. You would need to do this instead if you wanted to use the $this way of things $test = new GeneratedFiltersTest; $test-testUnconfiguredFilter(); Plus, I am going to assume (since I don't see your code), that the method assertTag() is in a parent class that is inherited by the class GeneratedFiltersTest and again, since you are calling it via a static method, the inheritance would not have taken place. Has someone got an idea whats going on? This is really freakin me out, could not find anything about it anywhere on the web. Kind regards, Michael -- Jim Lucas http://www.cmsws.com/ http://www.cmsws.com/examples/ http://www.bendsource.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with AssertTag: children count wrong
Hi, sorry, I forgot to include the class definition: class GeneratedFiltersTest extends PHPUnit_Framework_Testcase { function testUnconfiguredFilter() { $matcher = array( 'tag' = 'ul', 'children' = array( 'count' = 3, 'only' = array('tag' = 'li') ) ); $this-assertTag($matcher, $this-html, $message, $isHtml = FALSE); } } I dont think that the problem is that $this does not exist. Other examples of assertTag() and other assert* functions work perfectly well. The only problem I have is when I use the 'children' option with assertTag, because the count never hast the value it should have. kind regards, Michael On Wed, May 2, 2012 at 9:22 PM, Jim Lucas li...@cmsws.com wrote: On 05/02/2012 10:55 AM, Michael Otteneder wrote: Hi List! I'm trying to use phpUnit's AssertTag function to make sure that some html code contains an ul element with exactly li items in it. My test looks like this: function testUnconfiguredFilter() { $matcher = array( 'tag' = 'ul', 'children' = array( 'count' = 3, 'only' = array('tag' = 'li') ) ); $this-assertTag($matcher, $this-html, $message, $isHtml = FALSE); } the value of $html is: div class=flFilterbox id=**flFilterunconfiguredFilter h3unconfiguredFilter/h3 ul class=flFilterboxInner lia href= FilterValue1/a ()/li lia href= FilterValue2/a ()/li lia href= FilterValue3/a ()/li /ul /div So I think the assertion SHOULD work - but it does not, no matter what I use for count! Sadly PHPUnit's output ist not very helpful, all it gives me is: 1) GeneratedFiltersTest::**testUnconfiguredFilter Failed asserting that false is true. When dealing with classes, and specifically calling a static method within a class, the variable $this does not exist. You must use 'self' instead. You would need to do this instead if you wanted to use the $this way of things $test = new GeneratedFiltersTest; $test-testUnconfiguredFilter(**); Plus, I am going to assume (since I don't see your code), that the method assertTag() is in a parent class that is inherited by the class GeneratedFiltersTest and again, since you are calling it via a static method, the inheritance would not have taken place. Has someone got an idea whats going on? This is really freakin me out, could not find anything about it anywhere on the web. Kind regards, Michael -- Jim Lucas http://www.cmsws.com/ http://www.cmsws.com/examples/ http://www.bendsource.com/
Re: [PHP] problem about PHP-FPM in TCP socket and Unix socket
This how I would look at it, if it on the same box use socket, and yes it is expected that socket is faster than TCP since (as far as I know) you don't need to deal with the overhead of TCP. Regards, Daniel Fenn On Sat, Mar 3, 2012 at 3:56 AM, Yuchen Wang phob...@gmail.com wrote: Hello all, I am trying to config some new server All of my servers are using TCP Socket(127.0.0.1:9000) between nginx and php-fpm before But, I run ab(ab -n 2 -c50 http://192.168.74.130:81/) to test the performance of Unix Socket and TCP Socket, the result is Unix is little better than TCP Usually we run php and web server in the same server, So, TCP socket and Unix socket Which method do you prefer ? Thank you -- *Yuchen Wang* -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem about PHP-FPM in TCP socket and Unix socket
On Fri, Mar 2, 2012 at 5:56 PM, Yuchen Wang phob...@gmail.com wrote: Hello all, I am trying to config some new server All of my servers are using TCP Socket(127.0.0.1:9000) between nginx and php-fpm before But, I run ab(ab -n 2 -c50 http://192.168.74.130:81/) to test the performance of Unix Socket and TCP Socket, the result is Unix is little better than TCP Usually we run php and web server in the same server, So, TCP socket and Unix socket Which method do you prefer ? Thank you -- *Yuchen Wang* Always go for Unix sockets. TCP has quite a bit overhead which includes stuff you really don't need if two processes live on the same server. Think about error detection, flow control, congestion control, packet loss. None of these are needed if your system is functioning correctly. - Matijn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem about PHP-FPM in TCP socket and Unix socket
Something else that should be said: You won't need to muck around with firewall settings as well (that if your running a firewall on the same box On Sat, Mar 3, 2012 at 11:22 AM, Matijn Woudt tijn...@gmail.com wrote: On Fri, Mar 2, 2012 at 5:56 PM, Yuchen Wang phob...@gmail.com wrote: Hello all, I am trying to config some new server All of my servers are using TCP Socket(127.0.0.1:9000) between nginx and php-fpm before But, I run ab(ab -n 2 -c50 http://192.168.74.130:81/) to test the performance of Unix Socket and TCP Socket, the result is Unix is little better than TCP Usually we run php and web server in the same server, So, TCP socket and Unix socket Which method do you prefer ? Thank you -- *Yuchen Wang* Always go for Unix sockets. TCP has quite a bit overhead which includes stuff you really don't need if two processes live on the same server. Think about error detection, flow control, congestion control, packet loss. None of these are needed if your system is functioning correctly. - Matijn -- 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] Problem with date
$pubdate is probably null or something. Regards, –Josh Joshua Kehn | @joshkehn http://joshuakehn.com On Dec 7, 2011, at 1:48 PM, Jack wrote: Hello All, I have a problem where Dates are coming out as 12.31.1969 19:00:00 which of course we didn't have PC's in 1969 I'm not able to see where the date is getting screwed up, any ideas?? // # function ShowFeed_RSS($XmlRoot) { $title = GetFirstChildContentByPath($XmlRoot, channel/title); $link = GetFirstChildContentByPath($XmlRoot, channel/link); $desc = GetFirstChildContentByPath($XmlRoot, channel/description); # Next 2 lines display the title of the feed, and feed description # echo font face=arial color=blue size =2ba href=\$link\$title/a/b\n; # echo $desc; $nodelist = GetChildrenByPathAndName($XmlRoot, channel, item); if (!$nodelist) return 0; foreach ($nodelist as $nl) { $title = GetFirstChildContentByName($nl, title); $link= GetFirstChildContentByName($nl, link); $desc= GetFirstChildContentByName($nl, description); $creator = GetFirstChildContentByName($nl, author); #if (!$creator) $creator = GetFirstChildContentByName($nl, dc:creator); # echo JACK . $nl . br; #$pubdate = GetFirstChildContentByName($nl, pubDate); if (!isset($pubdate)) $pubdate = GetFirstChildContentByName($nl, dc:date); #if (!$pubdate) $pubdate = GetFirstChildContentByName($nl, dc:date); if (isset($pubdate)) $pubdate = strtotime($pubdate); if (isset($pubdate)) $pubdate = strftime(%m.%d.%Y %H:%M:%S, $pubdate); $out = $creator; if ( ($creator != ) ($pubdate != ) ) $out .= @ ; $out .= $pubdate; echo a class=\rss-link\ href=\$link\b$title/b/a; echo font size=1 color=\black\$outbr; echo font size=2$descbrbr; # echo font size=1 class=rss-linkThis is not green/font; } # this line is after each rss feed group # echo hr\n; } Thanks! Jack
Re: [PHP] Problem with date
On 12/7/2011 10:48 AM, Jack wrote: Hello All, I have a problem where Dates are coming out as 12.31.1969 19:00:00 which of course we didn't have PC's in 1969 I'm not able to see where the date is getting screwed up, any ideas?? // # function ShowFeed_RSS($XmlRoot) { $title = GetFirstChildContentByPath($XmlRoot, channel/title); $link = GetFirstChildContentByPath($XmlRoot, channel/link); $desc = GetFirstChildContentByPath($XmlRoot, channel/description); # Next 2 lines display the title of the feed, and feed description # echo font face=arial color=blue size =2ba href=\$link\$title/a/b\n; # echo $desc; $nodelist = GetChildrenByPathAndName($XmlRoot, channel, item); if (!$nodelist) return 0; foreach ($nodelist as $nl) { $title = GetFirstChildContentByName($nl, title); $link= GetFirstChildContentByName($nl, link); $desc= GetFirstChildContentByName($nl, description); $creator = GetFirstChildContentByName($nl, author); #if (!$creator) $creator = GetFirstChildContentByName($nl, dc:creator); # echo JACK . $nl . br; #$pubdate = GetFirstChildContentByName($nl, pubDate); if (!isset($pubdate)) $pubdate = GetFirstChildContentByName($nl, dc:date); #if (!$pubdate) $pubdate = GetFirstChildContentByName($nl, dc:date); if (isset($pubdate)) $pubdate = strtotime($pubdate); if (isset($pubdate)) $pubdate = strftime(%m.%d.%Y %H:%M:%S, $pubdate); $out = $creator; if ( ($creator != ) ($pubdate != ) ) $out .= @ ; $out .= $pubdate; echo a class=\rss-link\ href=\$link\b$title/b/a; echo font size=1 color=\black\$outbr; echo font size=2$descbrbr; # echo font size=1 class=rss-linkThis is not green/font; } # this line is after each rss feed group # echo hr\n; } Thanks! Jack Can you supply an example of the data you are feeding this. -- Jim Lucas http://www.cmsws.com/ http://www.cmsws.com/examples/ http://www.bendsource.com/ C - (541) 408-5189 O - (541) 323-9113 H - (541) 323-4219 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with date
How about a little debugging here (and possibly elsewhere): if (isset($pubdate) ($pubdate 0)) { $pubdate=strtotime($pubdate); } else { die(Barf. Can't run a string to time conversion on 0 or -1.); } Thanks Kevin, This bombs and gives me the BARF! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with date
How about a little debugging here (and possibly elsewhere): if (isset($pubdate) ($pubdate 0)) { $pubdate=strtotime($pubdate); } else { die(Barf. Can't run a string to time conversion on 0 or -1.); } Thanks Kevin, This bombs and gives me the BARF! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with date
To: PHP Subject: RE: [PHP] Problem with date How about a little debugging here (and possibly elsewhere): if (isset($pubdate) ($pubdate 0)) { $pubdate=strtotime($pubdate); } else { die(Barf. Can't run a string to time conversion on 0 or -1.); } Thanks Kevin, This bombs and gives me the BARF! FYI the date field is stored in a MySQL DB as a datetime type -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with date
-Original Message- From: Jack [mailto:jacklistm...@gmail.com] Sent: Wednesday, December 07, 2011 1:49 PM To: PHP Subject: [PHP] Problem with date Hello All, I have a problem where Dates are coming out as 12.31.1969 19:00:00 which of course we didn't have PC's in 1969 I'm not able to see where the date is getting screwed up, any ideas?? // ### # # function ShowFeed_RSS($XmlRoot) { $title = GetFirstChildContentByPath($XmlRoot, channel/title); $link = GetFirstChildContentByPath($XmlRoot, channel/link); $desc = GetFirstChildContentByPath($XmlRoot, channel/description); # Next 2 lines display the title of the feed, and feed description # echo font face=arial color=blue size =2ba href=\$link\$title/a/b\n; # echo $desc; $nodelist = GetChildrenByPathAndName($XmlRoot, channel, item); if (!$nodelist) return 0; foreach ($nodelist as $nl) { $title = GetFirstChildContentByName($nl, title); $link= GetFirstChildContentByName($nl, link); $desc= GetFirstChildContentByName($nl, description); $creator = GetFirstChildContentByName($nl, author); #if (!$creator) $creator = GetFirstChildContentByName($nl, dc:creator); # echo JACK . $nl . br; #$pubdate = GetFirstChildContentByName($nl, pubDate); if (!isset($pubdate)) $pubdate = GetFirstChildContentByName($nl, dc:date); #if (!$pubdate) $pubdate = GetFirstChildContentByName($nl, dc:date); if (isset($pubdate)) $pubdate = strtotime($pubdate); if (isset($pubdate)) $pubdate = strftime(%m.%d.%Y %H:%M:%S, $pubdate); $out = $creator; if ( ($creator != ) ($pubdate != ) ) $out .= @ ; $out .= $pubdate; echo a class=\rss-link\ href=\$link\b$title/b/a; echo font size=1 color=\black\$outbr; echo font size=2$descbrbr; # echo font size=1 class=rss-linkThis is not green/font; } # this line is after each rss feed group # echo hr\n; } Thanks! Jack Suggestion only. if (isset($pubdate)) $pubdate = strtotime($pubdate); if (isset($pubdate)) $pubdate = strftime(%m.%d.%Y %H:%M:%S, $pubdate); could be if (isset($pubdate)) $pubdate = mktime(m d Y H:i:s,strtotime($pubdate)); Reducing the code I also changed this to MKtime from strftime because The %e modifier is not supported in the Windows implementation of this function. To achieve this value, the %#d modifier can be used instead. The example below illustrates how to write a cross platform compatible function. Please read on the MKTIME function http://php.net/manual/en/function.mktime.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with sending AT command in php
In The Name Of Allah Thank you all for attentions ; Weird but solved with using another symbolink of Device Weird because other App in linux in the same time were using for example /dev/ttyusb1 but php code works with /dev/ttyusb3 .. Regards dehqan On Tue, Nov 15, 2011 at 7:39 PM, Richard Quadling rquadl...@gmail.comwrote: On 15 November 2011 15:12, Mike Mackintosh mike.mackint...@angrystatic.com wrote: On Nov 15, 2011, at 8:25, Richard Quadling rquadl...@gmail.com wrote: On 15 November 2011 11:50, a dehqan dehqa...@gmail.com wrote: \n is for Linux \r is for Windows On 11/14/11, Richard Quadling rquadl...@gmail.com wrote: On 12 November 2011 20:02, a dehqan dehqa...@gmail.com wrote: dio_write($handle, 'AT') dio_write($handle, AT) make firefox times out on Waiting for localhost ... . But dio_write($handle, AT\n) makes it prints AT exactly the same command or A A , .. On Sat, Nov 12, 2011 at 10:02 PM, Negin Nickparsa nickpa...@gmail.comwrote: are you sure about ATD03518726535\n? can you try if ( dio_write($handle, 'AT') )? Don't use \n, use \r. http://en.wikipedia.org/wiki/AT_commands#Example_session -- Richard Quadling Twitter : EE : Zend : PHPDoc : Fantasy Shopper @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea : fan.sh/6/370 No, \r is the requirement of the modem. Nothing to do with the OS. Windows uses \r\n as its line terminators, but when you talk to a modem, you use \r. -- Richard Quadling Twitter : EE : Zend : PHPDoc : Fantasy Shopper @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea : fan.sh/6/370 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I've had better luck with PHP_EOL instead of \r or \n. I think I've not explained myself properly. The modem wants a carriage return. That is a \r. It doesn't matter what OS you are on. If you don't send the right string to the modem, then the modem won't process it properly. If your OS maps \r to PHP_EOL, then, obviously PHP_EOL will be just fine. But I would recommend ... ?php define('CR', chr(13)); ? -- Richard Quadling Twitter : EE : Zend : PHPDoc : Fantasy Shopper @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea : fan.sh/6/370
Re: [PHP] problem with sending AT command in php
\n is for Linux \r is for Windows On 11/14/11, Richard Quadling rquadl...@gmail.com wrote: On 12 November 2011 20:02, a dehqan dehqa...@gmail.com wrote: dio_write($handle, 'AT') dio_write($handle, AT) make firefox times out on Waiting for localhost ... . But dio_write($handle, AT\n) makes it prints AT exactly the same command or A A , .. On Sat, Nov 12, 2011 at 10:02 PM, Negin Nickparsa nickpa...@gmail.comwrote: are you sure about ATD03518726535\n? can you try if ( dio_write($handle, 'AT') )? Don't use \n, use \r. http://en.wikipedia.org/wiki/AT_commands#Example_session -- Richard Quadling Twitter : EE : Zend : PHPDoc : Fantasy Shopper @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea : fan.sh/6/370 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with sending AT command in php
On 15 November 2011 11:50, a dehqan dehqa...@gmail.com wrote: \n is for Linux \r is for Windows On 11/14/11, Richard Quadling rquadl...@gmail.com wrote: On 12 November 2011 20:02, a dehqan dehqa...@gmail.com wrote: dio_write($handle, 'AT') dio_write($handle, AT) make firefox times out on Waiting for localhost ... . But dio_write($handle, AT\n) makes it prints AT exactly the same command or A A , .. On Sat, Nov 12, 2011 at 10:02 PM, Negin Nickparsa nickpa...@gmail.comwrote: are you sure about ATD03518726535\n? can you try if ( dio_write($handle, 'AT') )? Don't use \n, use \r. http://en.wikipedia.org/wiki/AT_commands#Example_session -- Richard Quadling Twitter : EE : Zend : PHPDoc : Fantasy Shopper @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea : fan.sh/6/370 No, \r is the requirement of the modem. Nothing to do with the OS. Windows uses \r\n as its line terminators, but when you talk to a modem, you use \r. -- Richard Quadling Twitter : EE : Zend : PHPDoc : Fantasy Shopper @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea : fan.sh/6/370 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with sending AT command in php
On Nov 15, 2011, at 8:25, Richard Quadling rquadl...@gmail.com wrote: On 15 November 2011 11:50, a dehqan dehqa...@gmail.com wrote: \n is for Linux \r is for Windows On 11/14/11, Richard Quadling rquadl...@gmail.com wrote: On 12 November 2011 20:02, a dehqan dehqa...@gmail.com wrote: dio_write($handle, 'AT') dio_write($handle, AT) make firefox times out on Waiting for localhost ... . But dio_write($handle, AT\n) makes it prints AT exactly the same command or A A , .. On Sat, Nov 12, 2011 at 10:02 PM, Negin Nickparsa nickpa...@gmail.comwrote: are you sure about ATD03518726535\n? can you try if ( dio_write($handle, 'AT') )? Don't use \n, use \r. http://en.wikipedia.org/wiki/AT_commands#Example_session -- Richard Quadling Twitter : EE : Zend : PHPDoc : Fantasy Shopper @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea : fan.sh/6/370 No, \r is the requirement of the modem. Nothing to do with the OS. Windows uses \r\n as its line terminators, but when you talk to a modem, you use \r. -- Richard Quadling Twitter : EE : Zend : PHPDoc : Fantasy Shopper @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea : fan.sh/6/370 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I've had better luck with PHP_EOL instead of \r or \n. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with sending AT command in php
On 15 November 2011 15:12, Mike Mackintosh mike.mackint...@angrystatic.com wrote: On Nov 15, 2011, at 8:25, Richard Quadling rquadl...@gmail.com wrote: On 15 November 2011 11:50, a dehqan dehqa...@gmail.com wrote: \n is for Linux \r is for Windows On 11/14/11, Richard Quadling rquadl...@gmail.com wrote: On 12 November 2011 20:02, a dehqan dehqa...@gmail.com wrote: dio_write($handle, 'AT') dio_write($handle, AT) make firefox times out on Waiting for localhost ... . But dio_write($handle, AT\n) makes it prints AT exactly the same command or A A , .. On Sat, Nov 12, 2011 at 10:02 PM, Negin Nickparsa nickpa...@gmail.comwrote: are you sure about ATD03518726535\n? can you try if ( dio_write($handle, 'AT') )? Don't use \n, use \r. http://en.wikipedia.org/wiki/AT_commands#Example_session -- Richard Quadling Twitter : EE : Zend : PHPDoc : Fantasy Shopper @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea : fan.sh/6/370 No, \r is the requirement of the modem. Nothing to do with the OS. Windows uses \r\n as its line terminators, but when you talk to a modem, you use \r. -- Richard Quadling Twitter : EE : Zend : PHPDoc : Fantasy Shopper @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea : fan.sh/6/370 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I've had better luck with PHP_EOL instead of \r or \n. I think I've not explained myself properly. The modem wants a carriage return. That is a \r. It doesn't matter what OS you are on. If you don't send the right string to the modem, then the modem won't process it properly. If your OS maps \r to PHP_EOL, then, obviously PHP_EOL will be just fine. But I would recommend ... ?php define('CR', chr(13)); ? -- Richard Quadling Twitter : EE : Zend : PHPDoc : Fantasy Shopper @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea : fan.sh/6/370 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with sending AT command in php
On 12 November 2011 20:02, a dehqan dehqa...@gmail.com wrote: dio_write($handle, 'AT') dio_write($handle, AT) make firefox times out on Waiting for localhost ... . But dio_write($handle, AT\n) makes it prints AT exactly the same command or A A , .. On Sat, Nov 12, 2011 at 10:02 PM, Negin Nickparsa nickpa...@gmail.comwrote: are you sure about ATD03518726535\n? can you try if ( dio_write($handle, 'AT') )? Don't use \n, use \r. http://en.wikipedia.org/wiki/AT_commands#Example_session -- Richard Quadling Twitter : EE : Zend : PHPDoc : Fantasy Shopper @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea : fan.sh/6/370 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with sending AT command in php
are you sure about ATD03518726535\n? can you try if ( dio_write($handle, 'AT') )?
Re: [PHP] problem with sending AT command in php
dio_write($handle, 'AT') dio_write($handle, AT) make firefox times out on Waiting for localhost ... . But dio_write($handle, AT\n) makes it prints AT exactly the same command or A A , .. On Sat, Nov 12, 2011 at 10:02 PM, Negin Nickparsa nickpa...@gmail.comwrote: are you sure about ATD03518726535\n? can you try if ( dio_write($handle, 'AT') )?
Re: [PHP] Problem with code...
On 2011-10-06, at 6:28 PM, Jason Pruim wrote: ?PHP //SETUP VARIABLES $mailTo = li...@pruimphotography.com; $mailFrom = li...@pruimphotography.com; //These 2 can be changed IF you know what you are doing and why! $returnPath = $mailFrom; $replyTo = $mailFrom; $mailSubject = New Convention registration!; $message = ; //DO NOT CHANGE UNDER PENALITY OF BEING SLAPPED WITH A WET NOODLE!!! $headers = From: .$mailFrom.\n; $headers .= Return-Path: .$returnPath.\n; $headers .= Reply-To: .$replyTo.\n; function send_email($mailTo, $mailSubject, $mailMessage, $headers) { if(mail( $mailTo, $mailSubject, $mailMessage, $headers )) { $message = Thank you for registering!; }else { echo There was an issue with your registration.. Please try again later; } }//Close Function if(!empty($errorCount)) { }else { //Build Email message $mailmessage = Full Name: . $_POST['firstname'] . . $_POST['lastname'] . \n\n; $mailmessage .= Address: . $_POST['address'] . \n\n; $mailmessage .= City, State, Zip: . $_POST['city'] . . $_POST['state'] . . $_POST['zip'] . \n\n; $mailmessage .= Phone: . $_POST['phone'] . \n\n; $mailmessage .= Email address: . $_POST['email'] . \n\n; if($_POST['affiliation'] == NFBOther) { $mailmessage .= Chapter Affiliation: . $_POST['other'] . \n\n; }else{ $mailmessage .= Chapter Affiliation: . $_POST['affiliation'] . \n\n; } if($_POST['person'] ==Other){ $mailmessage .= Who will pick up the ticket? . $_POST['Pfirstname'] . . $_POST['Llastname'] . \n\n; }else{ $mailmessage .= Who will pick up the ticket? I will pick it up my self! \n\n; } $mailmessage .= Payment Method: . $_POST['paymentMethod']; send_email($mailTo, $mailSubject, $mailmessage, $headers); } ? Sometimes... It is dropping the last $mailmessage line... The payment method in the actual email it sends... Anyone have any ideas? I'm stumped Hi there. First thought is perhaps it is not getting a value for paymentMethod and if it doesn't exist, will the line still get added? I would always check to see if every post variable isset, before adding the line. Can write a default line in its place if missing. George Langley Interactive Developer RIP, Mr. Jobs.
Re: [PHP] Problem with code...
Jason Pruim li...@pruimphotography.com On Oct 6, 2011, at 9:04 PM, George Langley wrote: On 2011-10-06, at 6:28 PM, Jason Pruim wrote: ?PHP //SETUP VARIABLES $mailTo = li...@pruimphotography.com; $mailFrom = li...@pruimphotography.com; //These 2 can be changed IF you know what you are doing and why! $returnPath = $mailFrom; $replyTo = $mailFrom; $mailSubject = New Convention registration!; $message = ; //DO NOT CHANGE UNDER PENALITY OF BEING SLAPPED WITH A WET NOODLE!!! $headers = From: .$mailFrom.\n; $headers .= Return-Path: .$returnPath.\n; $headers .= Reply-To: .$replyTo.\n; function send_email($mailTo, $mailSubject, $mailMessage, $headers) { if(mail( $mailTo, $mailSubject, $mailMessage, $headers )) { $message = Thank you for registering!; }else { echo There was an issue with your registration.. Please try again later; } }//Close Function if(!empty($errorCount)) { }else { //Build Email message $mailmessage = Full Name: . $_POST['firstname'] . . $_POST['lastname'] . \n\n; $mailmessage .= Address: . $_POST['address'] . \n\n; $mailmessage .= City, State, Zip: . $_POST['city'] . . $_POST['state'] . . $_POST['zip'] . \n\n; $mailmessage .= Phone: . $_POST['phone'] . \n\n; $mailmessage .= Email address: . $_POST['email'] . \n\n; if($_POST['affiliation'] == NFBOther) { $mailmessage .= Chapter Affiliation: . $_POST['other'] . \n\n; }else{ $mailmessage .= Chapter Affiliation: . $_POST['affiliation'] . \n\n; } if($_POST['person'] ==Other){ $mailmessage .= Who will pick up the ticket? . $_POST['Pfirstname'] . . $_POST['Llastname'] . \n\n; }else{ $mailmessage .= Who will pick up the ticket? I will pick it up my self! \n\n; } $mailmessage .= Payment Method: . $_POST['paymentMethod']; send_email($mailTo, $mailSubject, $mailmessage, $headers); } ? Sometimes... It is dropping the last $mailmessage line... The payment method in the actual email it sends... Anyone have any ideas? I'm stumped Hi there. First thought is perhaps it is not getting a value for paymentMethod and if it doesn't exist, will the line still get added? I would always check to see if every post variable isset, before adding the line. Can write a default line in its place if missing. The variable is being set with a default value of nothing else... But for some reason it's not bringing it through when the form is submitted... Any other ideas? hehe :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with code...
On Thu, Oct 6, 2011 at 7:29 PM, Jason Pruim li...@pruimphotography.comwrote: Jason Pruim li...@pruimphotography.com On Oct 6, 2011, at 9:04 PM, George Langley wrote: On 2011-10-06, at 6:28 PM, Jason Pruim wrote: ?PHP //SETUP VARIABLES $mailTo = li...@pruimphotography.com; $mailFrom = li...@pruimphotography.com; //These 2 can be changed IF you know what you are doing and why! $returnPath = $mailFrom; $replyTo = $mailFrom; $mailSubject = New Convention registration!; $message = ; //DO NOT CHANGE UNDER PENALITY OF BEING SLAPPED WITH A WET NOODLE!!! $headers = From: .$mailFrom.\n; $headers .= Return-Path: .$returnPath.\n; $headers .= Reply-To: .$replyTo.\n; function send_email($mailTo, $mailSubject, $mailMessage, $headers) { if(mail( $mailTo, $mailSubject, $mailMessage, $headers )) { $message = Thank you for registering!; }else { echo There was an issue with your registration.. Please try again later; } }//Close Function if(!empty($errorCount)) { }else { //Build Email message $mailmessage = Full Name: . $_POST['firstname'] . . $_POST['lastname'] . \n\n; $mailmessage .= Address: . $_POST['address'] . \n\n; $mailmessage .= City, State, Zip: . $_POST['city'] . . $_POST['state'] . . $_POST['zip'] . \n\n; $mailmessage .= Phone: . $_POST['phone'] . \n\n; $mailmessage .= Email address: . $_POST['email'] . \n\n; if($_POST['affiliation'] == NFBOther) { $mailmessage .= Chapter Affiliation: . $_POST['other'] . \n\n; }else{ $mailmessage .= Chapter Affiliation: . $_POST['affiliation'] . \n\n; } if($_POST['person'] ==Other){ $mailmessage .= Who will pick up the ticket? . $_POST['Pfirstname'] . . $_POST['Llastname'] . \n\n; }else{ $mailmessage .= Who will pick up the ticket? I will pick it up my self! \n\n; } $mailmessage .= Payment Method: . $_POST['paymentMethod']; send_email($mailTo, $mailSubject, $mailmessage, $headers); } ? Sometimes... It is dropping the last $mailmessage line... The payment method in the actual email it sends... Anyone have any ideas? I'm stumped Hi there. First thought is perhaps it is not getting a value for paymentMethod and if it doesn't exist, will the line still get added? I would always check to see if every post variable isset, before adding the line. Can write a default line in its place if missing. The variable is being set with a default value of nothing else... But for some reason it's not bringing it through when the form is submitted... Any other ideas? hehe :) Have you tested with the same payment method to see if somewhere in your code or a hiccup in the server is causing the problem? Does that happen to any or certain payment method (including blank entry)? I'm guessing it may happen with only certain payment method. From the line if(!empty($errorCount)) {, I presume you have a mechanism in place to sanitize and validate inputs? I'd suggest you start troubleshooting from there. If this is still development phase, try to bypass that mechanism for a quick confirmation that is causing the problem. Regards, Tommy
Re: [PHP] Problem with code...
On Thu, Oct 6, 2011 at 7:28 PM, Jason Pruim li...@pruimphotography.com wrote: Have a question about this block of code I'm not seeing anything immediately standing out as a problem. Sometimes... It is dropping the last $mailmessage line... The payment method in the actual email it sends... Can you see if the last line is actually in $mailmessage before sending the email? Maybe it's somehow getting truncated during the mail step. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with inserting numbers...
On 11 Aug 2011 at 02:22, Jason Pruim pru...@gmail.com wrote: while ($num != 1) { while($row = mysql_fetch_assoc($result)) { $padnum = number_pad($num, 4); echo $row['areacode'] . - . $row['prefix'] . - . $padnum . BR; $num++; } } This is certain to fail. You've got the $num++ in the *inner* loop, and are checking its value in the *outer* loop. Think about it: suppose you enter the inner loop with $num being 9998. Suppose also that you then go round the inner loop 5 times. What is the value of $num when you then exit the inner loop in order to do the test against 1 in the outer loop? You need to rework that logic. -- Cheers -- Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with inserting numbers...
While no tusing just one while loop? $num = 0; while ( ( $row = mysql_fetch_assoc($result) ) $num++ = 1000 ) { //do whatever you want and you'll get all results or max. 1000 lines ( whatever comes first ) } Cheers, Tom -Original Message- From: Tim Streater [mailto:t...@clothears.org.uk] Sent: Thursday, August 11, 2011 11:22 AM To: Jason Pruim Cc: PHP General List Subject: Re: [PHP] Problem with inserting numbers... On 11 Aug 2011 at 02:22, Jason Pruim pru...@gmail.com wrote: while ($num != 1) { while($row = mysql_fetch_assoc($result)) { $padnum = number_pad($num, 4); echo $row['areacode'] . - . $row['prefix'] . - . $padnum . BR; $num++; } } This is certain to fail. You've got the $num++ in the *inner* loop, and are checking its value in the *outer* loop. Think about it: suppose you enter the inner loop with $num being 9998. Suppose also that you then go round the inner loop 5 times. What is the value of $num when you then exit the inner loop in order to do the test against 1 in the outer loop? You need to rework that logic. -- Cheers -- Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with inserting numbers...
Replies below Jason Pruim li...@pruimphotography.com On Aug 10, 2011, at 11:08 PM, Ken Robinson wrote: At 09:22 PM 8/10/2011, Jason Pruim wrote: So here I am attempting to generate some numbers to be inserted into a database... eventually they will make up a phone number (Which I've emailed about before and know about the bad ideas with it.. But it's the customer :)) Here is the code I am working with: ?PHP function number_pad($number,$n) { return str_pad((int) $number,$n,0,STR_PAD_LEFT); } $SQL = SELECT * FROM Test WHERE `areacode` = '907' AND `prefix` = '200' LIMIT 5; $result = mysql_query($SQL); while ($num != 1) { while($row = mysql_fetch_assoc($result)) { $padnum = number_pad($num, 4); echo $row['areacode'] . - . $row['prefix'] . - . $padnum . BR; $num++; } } ? Try to avoid putting a database query in a loop. But that's exactly what I need to do... onceI have the code working with the echo I need to update the database with the numbers being displayed... $fullnumber = $row['areacode'].$row['prefix'].$padnum; $SQL = INSERT INTO Test ('fullnumber'( VALUES($fullnumber); So I want that to be in a loop since it will be inserting roughly 10,000 records for every areacode/prefix combination :) In the query only ask for the fields you are going to use, it's faster. Why use your own function to pad a string, when there is a built-in function? Because when I was doing my searching I came across the function I'm using before I saw the range function :) Try this code (untested): ?php $nums = range(0,); $q = SELECT areacode, prefix FROM Test WHERE `areacode` = '907' AND `prefix` = '200' LIMIT 5; $rs = mysql_query($q); while ($row = mysql_fetch_assoc($rs)) { foreach ($nums as $n) { echo sprintf('%03d-%03d-%04d',$row['areacode'],$row['prefix'],$n) br\n; } } ? I will try this later today after the day job gets done... Thanks for the help! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with inserting numbers...
On Aug 10, 2011, at 8:22 PM, Jason Pruim wrote: So here I am attempting to generate some numbers to be inserted into a database... eventually they will make up a phone number (Which I've emailed about before and know about the bad ideas with it.. But it's the customer :)) Here is the code I am working with: ?PHP function number_pad($number,$n) { return str_pad((int) $number,$n,0,STR_PAD_LEFT); } $SQL = SELECT * FROM Test WHERE `areacode` = '907' AND `prefix` = '200' LIMIT 5; $result = mysql_query($SQL); //$num = ; //foreach ($result as $key = $value) { //echo $key . - . $value . - . number_pad($num, 4) . BR; //$num++; //} while ($num != 1) { Problem is here ^ You are testing a numeric $num with a string 1, which $num will *never* equal. Leave off the quotes on the number. while($row = mysql_fetch_assoc($result)) { $padnum = number_pad($num, 4); echo $row['areacode'] . - . $row['prefix'] . - . $padnum . BR; $num++; } } ? basically all I'm trying to do is generate the last 4 digits starting at and going up to . for testing purposes I'm just echoing back but will eventually insert the complete number back into the database as a 7 digit string. The error I'm getting is: Fatal error: Maximum execution time of 30 seconds exceeded in /home/ pruimpho/public_html/jason/dev/clients/flewid/Phone/config/ phoneareacodes.php on line25 which is where the second while starts... Does anyone know a better way to do this? I'm off to finish searching google while waiting for some good news :) Thanks Everyone! Jason Pruim pru...@gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with inserting numbers...
Le 11/08/2011 13:08, Tamara Temple a écrit : On Aug 10, 2011, at 8:22 PM, Jason Pruim wrote: while ($num != 1) { Problem is here ^ You are testing a numeric $num with a string 1, which $num will *never* equal. Leave off the quotes on the number. Hum, I suggest you read this page properly : http://www.php.net/manual/en/types.comparisons.php exemple : ?php $num = 1; $num++; print ($num != 2 ? different : equal) . PHP_EOL . ($num != 2 ? different : equal) . PHP_EOL; print ($num !== 2 ? different : equal) . PHP_EOL . ($num !== 2 ? different : equal) . PHP_EOL; result : equal equal equal different -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with inserting numbers...
Jason Pruim li...@pruimphotography.com wrote: Replies below Jason Pruim li...@pruimphotography.com On Aug 10, 2011, at 11:08 PM, Ken Robinson wrote: At 09:22 PM 8/10/2011, Jason Pruim wrote: So here I am attempting to generate some numbers to be inserted into a database... eventually they will make up a phone number (Which I've emailed about before and know about the bad ideas with it.. But it's the customer :)) Here is the code I am working with: ?PHP function number_pad($number,$n) { return str_pad((int) $number,$n,0,STR_PAD_LEFT); } $SQL = SELECT * FROM Test WHERE `areacode` = '907' AND `prefix` = '200' LIMIT 5; $result = mysql_query($SQL); while ($num != 1) { while($row = mysql_fetch_assoc($result)) { $padnum = number_pad($num, 4); echo $row['areacode'] . - . $row['prefix'] . - . $padnum . BR; $num++; } } ? Try to avoid putting a database query in a loop. But that's exactly what I need to do... onceI have the code working with the echo I need to update the database with the numbers being displayed... $fullnumber = $row['areacode'].$row['prefix'].$padnum; $SQL = INSERT INTO Test ('fullnumber'( VALUES($fullnumber); So I want that to be in a loop since it will be inserting roughly 10,000 records for every areacode/prefix combination :) In the query only ask for the fields you are going to use, it's faster. Why use your own function to pad a string, when there is a built-in function? Because when I was doing my searching I came across the function I'm using before I saw the range function :) Try this code (untested): ?php $nums = range(0,); $q = SELECT areacode, prefix FROM Test WHERE `areacode` = '907' AND `prefix` = '200' LIMIT 5; $rs = mysql_query($q); while ($row = mysql_fetch_assoc($rs)) { foreach ($nums as $n) { echo sprintf('%03d-%03d-%04d',$row['areacode'],$row['prefix'],$n) br\n; } } ? I will try this later today after the day job gets done... Thanks for the help! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php You might need to insert 10,000 rows, but that doesn't mean you need to perform 10,000 separate inserts. Use bulk inserts to ease the load. Also, try to run the script over the cli if you can, it will use less memory (no Apache and its posse) and it won't time out. Thanks, Ash http://www.ashleysheridan.co.uk -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with inserting numbers...
On Wed, Aug 10, 2011 at 9:22 PM, Jason Pruim pru...@gmail.com wrote: So here I am attempting to generate some numbers to be inserted into a database... eventually they will make up a phone number (Which I've emailed about before and know about the bad ideas with it.. But it's the customer :)) Here is the code I am working with: ?PHP function number_pad($number,$n) { return str_pad((int) $number,$n,0,STR_PAD_LEFT); } $SQL = SELECT * FROM Test WHERE `areacode` = '907' AND `prefix` = '200' LIMIT 5; $result = mysql_query($SQL); //$num = ; //foreach ($result as $key = $value) { // echo $key . - . $value . - . number_pad($num, 4) . BR; // $num++; //} while ($num != 1) { while($row = mysql_fetch_assoc($result)) { $padnum = number_pad($num, 4); echo $row['areacode'] . - . $row['prefix'] . - . $padnum . BR; $num++; } } ? basically all I'm trying to do is generate the last 4 digits starting at and going up to . for testing purposes I'm just echoing back but will eventually insert the complete number back into the database as a 7 digit string. The error I'm getting is: Fatal error: Maximum execution time of 30 seconds exceeded in /home/pruimpho/public_html/jason/dev/clients/flewid/Phone/config/phoneareacodes.php on line25 which is where the second while starts... Does anyone know a better way to do this? I'm off to finish searching google while waiting for some good news :) Thanks Everyone! Jason Pruim pru...@gmail.com You could always push it off to MySQL. I don't have a MySQL instance available to test right now, but I ran this on SQL Server and it should be generic enough to port without much change. Basically, you just load a table with a single tinyint column with the digits between 0 and 9, and then allow the database to cross join that table 4 times to get 1 resulting rows numbered through . The cross join on this database server executes in around 44ms. -- Create a temporary table containing the digits 0 through 9 CREATE TABLE Digits ( n tinyint NOT NULL PRIMARY KEY CHECK (n BETWEEN 0 AND 9) ) INSERT INTO Digits VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9) -- Cross join the digits table 4 times to load into a table called numbers. SELECT CONVERT(char(1), Thousands.n) + CONVERT(char(1), Hundreds.n) + CONVERT(char(1), Tens.n) + CONVERT(char(1), Ones.n) AS Number INTONumbers FROMDigits AS Thousands, Digits AS Hundreds, Digits AS Tens, Digits AS Ones ORDER BY Thousands.n, Hundreds.n, Tens.n, Ones.n SELECT * FROMNumbers -- Drop the temporary digits table DROP TABLE Digits Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with inserting numbers...
On 8/10/2011 6:22 PM, Jason Pruim wrote: So here I am attempting to generate some numbers to be inserted into a database... eventually they will make up a phone number (Which I've emailed about before and know about the bad ideas with it.. But it's the customer :)) Here is the code I am working with: ?PHP function number_pad($number,$n) { return str_pad((int) $number,$n,0,STR_PAD_LEFT); } $SQL = SELECT * FROM Test WHERE `areacode` = '907' AND `prefix` = '200' LIMIT 5; $result = mysql_query($SQL); //$num = ; //foreach ($result as $key = $value) { //echo $key . - . $value . - . number_pad($num, 4) . BR; //$num++; //} while ($num != 1) { while($row = mysql_fetch_assoc($result)) { $padnum = number_pad($num, 4); echo $row['areacode'] . - . $row['prefix'] . - . $padnum . BR; $num++; } } ? basically all I'm trying to do is generate the last 4 digits starting at and going up to . for testing purposes I'm just echoing back but will eventually insert the complete number back into the database as a 7 digit string. The error I'm getting is: Fatal error: Maximum execution time of 30 seconds exceeded in /home/pruimpho/public_html/jason/dev/clients/flewid/Phone/config/phoneareacodes.php on line25 which is where the second while starts... Does anyone know a better way to do this? I'm off to finish searching google while waiting for some good news :) Thanks Everyone! Jason Pruim pru...@gmail.com Jason, Here is my rendition of what you should do. ?PHP $SQL = SELECT areacode, prefix FROMTest WHERE `areacode` = '907' AND `prefix` = '200'; $result = mysql_query($SQL); $values = ''; while( $row = mysql_fetch_assoc($result) ) { foreach ( range(0, ) AS $n ) { $values .= $row['areacode'] . '-' . $row['prefix'] . '-' . str_pad($n, 4, '0', STR_PAD_LEFT); } } echo $values; ? It will be much faster if you build the complete string in memory then echo out the built string. Jim Lucas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with inserting numbers...
Jason Pruim pru...@gmail.com On Aug 11, 2011, at 9:35 AM, Andrew Ballard wrote: On Wed, Aug 10, 2011 at 9:22 PM, Jason Pruim pru...@gmail.com wrote: So here I am attempting to generate some numbers to be inserted into a database... eventually they will make up a phone number (Which I've emailed about before and know about the bad ideas with it.. But it's the customer :)) Here is the code I am working with: ?PHP function number_pad($number,$n) { return str_pad((int) $number,$n,0,STR_PAD_LEFT); } $SQL = SELECT * FROM Test WHERE `areacode` = '907' AND `prefix` = '200' LIMIT 5; $result = mysql_query($SQL); //$num = ; //foreach ($result as $key = $value) { //echo $key . - . $value . - . number_pad($num, 4) . BR; //$num++; //} while ($num != 1) { while($row = mysql_fetch_assoc($result)) { $padnum = number_pad($num, 4); echo $row['areacode'] . - . $row['prefix'] . - . $padnum . BR; $num++; } } ? basically all I'm trying to do is generate the last 4 digits starting at and going up to . for testing purposes I'm just echoing back but will eventually insert the complete number back into the database as a 7 digit string. The error I'm getting is: Fatal error: Maximum execution time of 30 seconds exceeded in /home/pruimpho/public_html/jason/dev/clients/flewid/Phone/config/phoneareacodes.php on line25 which is where the second while starts... Does anyone know a better way to do this? I'm off to finish searching google while waiting for some good news :) Thanks Everyone! Jason Pruim pru...@gmail.com You could always push it off to MySQL. I don't have a MySQL instance available to test right now, but I ran this on SQL Server and it should be generic enough to port without much change. Basically, you just load a table with a single tinyint column with the digits between 0 and 9, and then allow the database to cross join that table 4 times to get 1 resulting rows numbered through . The cross join on this database server executes in around 44ms. -- Create a temporary table containing the digits 0 through 9 CREATE TABLE Digits ( n tinyint NOT NULL PRIMARY KEY CHECK (n BETWEEN 0 AND 9) ) INSERT INTO Digits VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9) -- Cross join the digits table 4 times to load into a table called numbers. SELECT CONVERT(char(1), Thousands.n) + CONVERT(char(1), Hundreds.n) + CONVERT(char(1), Tens.n) + CONVERT(char(1), Ones.n) AS Number INTONumbers FROMDigits AS Thousands, Digits AS Hundreds, Digits AS Tens, Digits AS Ones ORDER BY Thousands.n, Hundreds.n, Tens.n, Ones.n SELECT * FROMNumbers -- Drop the temporary digits table DROP TABLE Digits Andrew Hey Andrew, Interesting idea... I'm so used to doing it all from PHP that I forget a database can be more then just a storage engine sometimes :) I'll definitely give it a try tonight! Thanks Andrew! -- 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] Problem with inserting numbers...
Jason Pruim pru...@gmail.com On Aug 11, 2011, at 11:52 AM, Jim Lucas wrote: On 8/10/2011 6:22 PM, Jason Pruim wrote: So here I am attempting to generate some numbers to be inserted into a database... eventually they will make up a phone number (Which I've emailed about before and know about the bad ideas with it.. But it's the customer :)) Here is the code I am working with: ?PHP function number_pad($number,$n) { return str_pad((int) $number,$n,0,STR_PAD_LEFT); } $SQL = SELECT * FROM Test WHERE `areacode` = '907' AND `prefix` = '200' LIMIT 5; $result = mysql_query($SQL); //$num = ; //foreach ($result as $key = $value) { //echo $key . - . $value . - . number_pad($num, 4) . BR; //$num++; //} while ($num != 1) { while($row = mysql_fetch_assoc($result)) { $padnum = number_pad($num, 4); echo $row['areacode'] . - . $row['prefix'] . - . $padnum . BR; $num++; } } ? basically all I'm trying to do is generate the last 4 digits starting at and going up to . for testing purposes I'm just echoing back but will eventually insert the complete number back into the database as a 7 digit string. The error I'm getting is: Fatal error: Maximum execution time of 30 seconds exceeded in /home/pruimpho/public_html/jason/dev/clients/flewid/Phone/config/phoneareacodes.php on line25 which is where the second while starts... Does anyone know a better way to do this? I'm off to finish searching google while waiting for some good news :) Thanks Everyone! Jason Pruim pru...@gmail.com Jason, Here is my rendition of what you should do. ?PHP $SQL = SELECT areacode, prefix FROMTest WHERE `areacode` = '907' AND `prefix` = '200'; $result = mysql_query($SQL); $values = ''; while( $row = mysql_fetch_assoc($result) ) { foreach ( range(0, ) AS $n ) { $values .= $row['areacode'] . '-' . $row['prefix'] . '-' . str_pad($n, 4, '0', STR_PAD_LEFT); } } echo $values; ? It will be much faster if you build the complete string in memory then echo out the built string. Hey Jim, Would that still hold true with inserting into a database which is the true end of it? This is going to be a one time thing I'm doing and I'm trying to make it a learning experience as I go since that's what everything should be right? Jim Lucas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with inserting numbers...
On 8/11/2011 9:34 AM, Jason Pruim wrote: Hey Jim, Would that still hold true with inserting into a database which is the true end of it? This is going to be a one time thing I'm doing and I'm trying to make it a learning experience as I go since that's what everything should be right? Yes, taking one of your other emails, you would do something like this. ?PHP $SQL = SELECT areacode, prefix FROMTest WHERE `areacode` = '907' AND `prefix` = '200'; $result = mysql_query($SQL); $values = ''; while( $row = mysql_fetch_assoc($result) ) { foreach ( range(0, ) AS $n ) { $values .= VALUES ('. sprintf('%03d-%03d-%04d', $row['areacode'], $row['prefix'], $n) . '); } } echo 'INSERT INTO Test (fullnumber) ' . $values; ? You should see... INSERT INTO Test (fullnumber) VALUES ('907-200-') VALUES ('907-200-0001') VALUES ('907-200-0001') etc... What this allows you to do is have one long string generated in memory then inserted into the DB. If you have any type of indexes on this table/column then it would only require one re-indexing of the table for the single INSERT statement vs 1 re-indexes for 1 separate INSERT statements. Cuts the DB processing time down a lot. Also, just so you know, if you place set_time_limit(0); at the top of the script, it will allow the script to run as long as it needs to. See: http://php.net/manual/en/function.set-time-limit.php Jim Lucas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with inserting numbers...
On Aug 10, 2011, at 9:36 PM, MUAD SHIBANI wrote: Basically you can increase time limit for this file to handle your request by using set_time_limit function ... Hi Maud, Looked into set_time_limit and even tried running it with a value of 120 but it didn't help... I'm affraid I have a problem with the way the 2 while loops are interacting and creating a infinite loop... BUT... I'm thinking there must be a better way... Maybe a while with a foreach? Now I'm just thinking outloud :) Jason Pruim pru...@gmail.com
Re: [PHP] Problem with inserting numbers...
basically all I'm trying to do is generate the last 4 digits starting at and going up to . for testing purposes I'm just echoing back but will eventually insert the complete number back into the database as a 7 digit string. The error I'm getting is: Fatal error: Maximum execution time of 30 seconds exceeded in /home/pruimpho/public_html/jason/dev/clients/flewid/Phone/config/phoneareacodes.php on line25 I'm not sure the to while loops is the best control structure. Why not try the following and see if it gets you the results you want? __untested__ while($row = mysql_fetch_assoc($result)) { if ($num != 1) $padnum = number_pad($num, 4) { echo $row['areacode'] . - . $row['prefix'] . - . $padnum . BR; $num++; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with inserting numbers...
when $num++; executed $num will never be '1'; you may change the while loop to while ($num 1) { while ($row = ... 2011/8/11 Jason Pruim pru...@gmail.com On Aug 10, 2011, at 9:36 PM, MUAD SHIBANI wrote: Basically you can increase time limit for this file to handle your request by using set_time_limit function ... Hi Maud, Looked into set_time_limit and even tried running it with a value of 120 but it didn't help... I'm affraid I have a problem with the way the 2 while loops are interacting and creating a infinite loop... BUT... I'm thinking there must be a better way... Maybe a while with a foreach? Now I'm just thinking outloud :) Jason Pruim pru...@gmail.com
Re: [PHP] Problem with inserting numbers...
At 09:22 PM 8/10/2011, Jason Pruim wrote: So here I am attempting to generate some numbers to be inserted into a database... eventually they will make up a phone number (Which I've emailed about before and know about the bad ideas with it.. But it's the customer :)) Here is the code I am working with: ?PHP function number_pad($number,$n) { return str_pad((int) $number,$n,0,STR_PAD_LEFT); } $SQL = SELECT * FROM Test WHERE `areacode` = '907' AND `prefix` = '200' LIMIT 5; $result = mysql_query($SQL); while ($num != 1) { while($row = mysql_fetch_assoc($result)) { $padnum = number_pad($num, 4); echo $row['areacode'] . - . $row['prefix'] . - . $padnum . BR; $num++; } } ? Try to avoid putting a database query in a loop. In the query only ask for the fields you are going to use, it's faster. Why use your own function to pad a string, when there is a built-in function? Try this code (untested): ?php $nums = range(0,); $q = SELECT areacode, prefix FROM Test WHERE `areacode` = '907' AND `prefix` = '200' LIMIT 5; $rs = mysql_query($q); while ($row = mysql_fetch_assoc($rs)) { foreach ($nums as $n) { echo sprintf('%03d-%03d-%04d',$row['areacode'],$row['prefix'],$n) br\n; } } ? Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem installing CakePHP on Linux
On 8/7/2011 9:53 AM, Negin Nickparsa wrote: Hello List I want to use Cake PHP ,I have downloaded it from it's site,rename the folder to first_app and copied it to /srv/www/htdocs my root is here: /srv/www/htdocs by entering http://localhost/first_app/ it has some errors like these outputs: Warning: _cake_core_ cache was unable to write 'default_en-us' to cache in /srv/www/htdocs/first_app/cake/libs/cache.php on line 295 Warning: _cake_core_ cache was unable to write 'default_en-us' to cache in /srv/www/htdocs/first_app/cake/libs/cache.php on line 295 Warning: /srv/www/htdocs/first_app/app/tmp/cache/persistent/ is not writable in /srv/www/htdocs/first_app/cake/libs/cache/file.php on line 299 Warning: /srv/www/htdocs/first_app/app/tmp/cache/models/ is not writable in /srv/www/htdocs/first_app/cake/libs/cache/file.php on line 299 Try $ chown -R www-data:www-data /srv/www/htdocs/first_app Replace www-data:www-data with what is appropriate on your system. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem installing CakePHP on Linux
Thank you, I found that only the tmp directory must be writable then I used this one: also by right clicking and using wwwrun for user I tried to set them as you told chmod -R 0777 /srv/www/htdocs/first_app/app/tmp/ and the I get fatal Error: http://cakephp.org/changelogs/1.3.6 Fatal error: Class 'Debugger' not found in /srv/www/htdocs/first_app/cake/libs/view/pages/home.ctp on line 26
Re: [PHP] problem installing CakePHP on Linux
I have debugger.php in cake/libs I don't know why it doesn't access to this file and tell me can't find the class
Re: [PHP] problem installing CakePHP on Linux
cool I found this hidden file .htaccess: IfModule mod_rewrite.c RewriteEngine on RewriteRule^$ app/webroot/[L] RewriteRule(.*) app/webroot/$1 [L] /IfModule well I don't know that this apache module is enabled or not I changed the apache2 in /etc/sysconfig and add the rewrite in modules right here: APACHE_MODULES=actions alias auth_basic authn_file authz_host authz_groupfile authz_default authz_user authn_dbm autoindex cgi dir env expires include log_config mime negotiation setenvif ssl suexec userdir php5 rewrite
Re: [PHP] problem installing CakePHP on Linux
Finally I solved my problem! I have downloaded another version of cake that is less than 2 now it works like a charm:)
RE: [PHP] Problem with header(Location: )...
Try lowercase 'http'. Anything in error log? Try turning on display_errors. Cheers, Tamas -Original Message- From: Jason Pruim [mailto:li...@pruimphotography.com] Sent: Sunday, July 31, 2011 8:40 PM To: php-general@lists.php.net Subject: [PHP] Problem with header(Location: )... So I'm attempting to redirect back to the main site of a page after a successful insert into a database... Here's my code: ?PHP if (!$resp-is_valid) { // What happens when the CAPTCHA was entered incorrectly die (The reCAPTCHA wasn't entered correctly. Go back and try it again. . (reCAPTCHA said: . $resp-error . )); } else { $name = mysql_real_escape_string($_POST['txtName']); $comment = mysql_real_escape_string($_POST['areaComment']); $phonelink = mysql_real_escape_string($_POST['phonelink']); $SQL = INSERT INTO comments (name, comment, phonelink) VALUES ('$name', '$comment', '$phonelink'); mysql_query($SQL) or die(Unable to insert at this time. Sorry for the inconvience); //echo Insert successful!; header(Location: HTTP://jason.pruimphotography.com/dev/clients/flewid/Phone/); // Your code here to handle a successful verification } ? The insert happens, BUT it won't redirect back to the site There isn't any reason I should be able to do a header() redirect at that point is there? Or is there a better way to do it? Thanks Everyone! Jason Pruim li...@pruimphotography.com -- 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] Problem with header(Location: )...
Jason Pruim li...@pruimphotography.com On Jul 31, 2011, at 2:50 PM, Dajka Tamas wrote: Try lowercase 'http'. Anything in error log? Try turning on display_errors. Tried both, upper and lower case http nothing changed... And nothing in the error log... I try a simple echo with a link and that works just fine... Starting to get frustrated with it -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with header(Location: )...
On Jul 31, 2011, at 1:40 PM, Jason Pruim wrote: So I'm attempting to redirect back to the main site of a page after a successful insert into a database... Here's my code: ?PHP if (!$resp-is_valid) { // What happens when the CAPTCHA was entered incorrectly die (The reCAPTCHA wasn't entered correctly. Go back and try it again. . (reCAPTCHA said: . $resp-error . )); } else { $name = mysql_real_escape_string($_POST['txtName']); $comment = mysql_real_escape_string($_POST['areaComment']); $phonelink = mysql_real_escape_string($_POST['phonelink']); $SQL = INSERT INTO comments (name, comment, phonelink) VALUES ('$name', '$comment', '$phonelink'); mysql_query($SQL) or die(Unable to insert at this time. Sorry for the inconvience); //echo Insert successful!; header(Location: HTTP://jason.pruimphotography.com/dev/clients/flewid/Phone/ ); // Your code here to handle a successful verification } ? The insert happens, BUT it won't redirect back to the site There isn't any reason I should be able to do a header() redirect at that point is there? Since the echo is commented out, there shouldn't be any output if that is sum total of the code executing on the http request. If this file is called from some other script, you might check to see if any output is sent from there. If display_errors is on, you should be getting something like Unable to send headers after output or some such (I can't offhand think of the actual error message). You can keep the error successful message for verification if you write it directly to the error log, via: error_log(Insert successful.PHP_EOL); Sometimes, it's also nice to insert markers to let you know where the log is emanating from: error_log(__FILE__.'@'.__LINE__.': '.Insert successful.PHP_EOL); Sometimes, a vexing sort of error is a blank line at the top or bottom of a file, outside the ?..? Or is there a better way to do it? Thanks Everyone! Jason Pruim li...@pruimphotography.com -- 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] Problem with header(Location: )...
On Jul 31, 2011, at 6:23 PM, Tamara Temple wrote: On Jul 31, 2011, at 1:40 PM, Jason Pruim wrote: So I'm attempting to redirect back to the main site of a page after a successful insert into a database... Here's my code: ?PHP if (!$resp-is_valid) { // What happens when the CAPTCHA was entered incorrectly die (The reCAPTCHA wasn't entered correctly. Go back and try it again. . (reCAPTCHA said: . $resp-error . )); } else { $name = mysql_real_escape_string($_POST['txtName']); $comment = mysql_real_escape_string($_POST['areaComment']); $phonelink = mysql_real_escape_string($_POST['phonelink']); $SQL = INSERT INTO comments (name, comment, phonelink) VALUES ('$name', '$comment', '$phonelink'); mysql_query($SQL) or die(Unable to insert at this time. Sorry for the inconvience); //echo Insert successful!; header(Location: HTTP://jason.pruimphotography.com/dev/clients/flewid/Phone/); // Your code here to handle a successful verification } ? The insert happens, BUT it won't redirect back to the site There isn't any reason I should be able to do a header() redirect at that point is there? Since the echo is commented out, there shouldn't be any output if that is sum total of the code executing on the http request. If this file is called from some other script, you might check to see if any output is sent from there. If display_errors is on, you should be getting something like Unable to send headers after output or some such (I can't offhand think of the actual error message). You can keep the error successful message for verification if you write it directly to the error log, via: error_log(Insert successful.PHP_EOL); Sometimes, it's also nice to insert markers to let you know where the log is emanating from: error_log(__FILE__.'@'.__LINE__.': '.Insert successful.PHP_EOL); Sometimes, a vexing sort of error is a blank line at the top or bottom of a file, outside the ?..? Just before I got your e-mail, I found there were 3 spaces at the very top of the file in front of my ?PHP I was fit to be tied as they say in the south... But it is up and working properly now! Thank you all for your help with this! :) Jason Pruim li...@pruimphotography.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with PHP 5.3.3 under Debian/Squeeze
On Sunday, 20 March 2011 at 18:38, Michelle Konzack wrote: Hello *, since I have re-installed mail.tamay-dogan.net with Debian/Squeeze on a new machine, my /srv/log/apache/error.log ist arround 450 times bigger then the access.log du to following (and similar) entries [ '/srv/log/apache/error.log' ]- [Thu Mar 17 00:14:16 2011] [error] [client 89.204.153.240] PHP Notice: Use of undefined constant DIR_BASE - assumed 'DIR_BASE' in /srv/htdocs/index.php on line 3 [Thu Mar 17 00:14:16 2011] [error] [client 89.204.153.240] PHP Notice: Use of undefined constant DIR_TOOL - assumed 'DIR_TOOL' in /srv/htdocs/index.php on line 5 [Thu Mar 17 00:14:16 2011] [error] [client 89.204.153.240] PHP Notice: Use of undefined constant DEF_DIR_TOOL - assumed 'DEF_DIR_TOOL' in /srv/tdphp-vserver/includes/00_main.inc on line 42 [Thu Mar 17 00:14:16 2011] [error] [client 89.204.153.240] PHP Notice: Use of undefined constant DEF_DIR_BASE - assumed 'DEF_DIR_BASE' in /srv/tdphp-vserver/includes/00_main.inc on line 65 [Thu Mar 17 00:14:16 2011] [error] [client 89.204.153.240] PHP Notice: Use of undefined constant DIR_HOST - assumed 'DIR_HOST' in /srv/tdphp-vserver/includes/00_main.inc on line 88 [Thu Mar 17 00:14:16 2011] [error] [client 89.204.153.240] PHP Notice: Use of undefined constant SCRIPT_FILENAME - assumed 'SCRIPT_FILENAME' in /srv/tdphp-vserver/includes/00_main.inc on line 88 snip [ '/srv/htdocs/index.php' ]- ?php define(DIR_BASE, /srv); define(DIR_TOOL, /srv/tdphp-vserver); include DIR_TOOL . /includes/00_main.inc; ? Maybe I am sitting on the line? This index.php file and the website is working since ages. The first parameter of the define function should be a string. Whats the name of the error loging setting which produce this and WHY are they now reported? It would appear that your new server has defaulted to logging PHP notices. You can turn this off in your php.ini, or better yet fix the issues that are causing them. In my experience notices can often indicate more serious potential bugs. I have switched off anything but it continue to create more then 46 GByte error files (18) per day. Also I get [ '/srv/log/apache/error.log' ]- [Thu Mar 17 00:14:16 2011] [error] [client 89.204.153.240] PHP Notice: Undefined offset: 1 in /srv/tdphp-vserver/includes/04_l10n.inc on line 56 [Thu Mar 17 00:14:16 2011] [error] [client 89.204.153.240] PHP Notice: Undefined offset: 1 in /srv/tdphp-vserver/includes/04_l10n.inc on line 56 [Thu Mar 17 00:14:16 2011] [error] [client 89.204.153.240] PHP Notice: Undefined offset: 1 in /srv/tdphp-vserver/includes/04_l10n.inc on line 56 [Thu Mar 17 00:14:16 2011] [error] [client 89.204.153.240] PHP Notice: Undefined variable: locale in /srv/tdphp-vserver/includes/04_l10n.inc on line 74 [Thu Mar 17 00:14:16 2011] [error] [client 89.204.153.240] PHP Notice: Undefined index: what in /srv/tdphp-vserver/includes/00_main.inc on line 249 [Thu Mar 17 00:14:16 2011] [error] [client 89.204.153.240] PHP Notice: Undefined index: csslink in /srv/tdphp-vserver/includes/00_main.inc on line 284 [Thu Mar 17 00:14:16 2011] [error] [client 89.204.153.240] PHP Notice: Undefined index: cookie in /srv/tdphp-vserver/includes/00_main.inc on line 298 [ '/srv/tdphp-vserver/includes/04_l10n.inc' ]--- [0051] if ( $_SERVER['HTTP_ACCEPT_LANGUAGE'] != '') { [0052] foreach(explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $ACC1) { [0053] $ACC2=explode(';', $ACC1); [0054] $ACC3=explode('-', $ACC2[0]); [0055] $LL=$ACC3[0]; [0056] $CC=strtoupper($ACC3[1]); [0057] if ( $CC != '') { [0058] $LOC=$LL . _ . $CC; [0059] } else { [0060] $LOC=$LL; [0061] } [0062] if ( stristr( . LOCALES . , $LOC ) ) { [0063] $TMP_FILE=LOCALE_DIR . / . $LOC . /LC_MESSAGES/ . $_SERVER['SERVER_NAME'] . .mo; [0064] if (is_file($TMP_FILE)) { [0065] $locale=$LOC; [0066] break; [0067] } [0068] } [0069] } [0070] } else { [0071] $locale=(isset($_GET['lang']))? $_GET['lang'] : DEFAULT_LOCALE; [0072] } [0073] [0074] T_setlocale(LC_MESSAGES, $locale); [0075] $domain=$_SERVER['SERVER_NAME']; [0076] T_bind_textdomain_codeset($domain, $encoding); [0077] T_bindtextdomain($domain, LOCALE_DIR); [0078] T_textdomain($domain); [0079] /* *** END gettext stuff *** */ [0080] ? - Have a look at what $_SERVER['HTTP_ACCEPT_LANGUAGE'] is set to because it's clearly not in the format this code is expecting. [ '/srv/tdphp-vserver/includes/00_main.inc'
Re: [PHP] problem with if and exact match
strpos example is much faster though On Tue, Mar 15, 2011 at 7:20 AM, Jack jacklistm...@gmail.com wrote: Thanks everyone... great examples...works ( both methods ) Thanks! Jack -Original Message- From: Alexis Antonakis [mailto:ad...@antonakis.co.uk] Sent: Tuesday, March 15, 2011 1:10 AM To: Jack Subject: Re: [PHP] problem with if and exact match http://php.net/manual/en/function.preg-match.php On 14/03/11 23:02, Jack wrote: I want to be able to match if a string is contained within the string I am evaluating. I know that if ( $name == xxjacksonxx); based on the below would be true. But I want to be able to say if jackson is contained within $name that it's a match. I tried the below without success.. Not getting the operand properly.. ? $name = xxjacksonxx; if ( preg_match($name, jackson)) { print true; } else { print false; } ? Thanks! Jack -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] problem with if and exact match
On Tue, 2011-03-15 at 01:20 -0400, Jack wrote: Thanks everyone... great examples...works ( both methods ) Thanks! Jack -Original Message- From: Alexis Antonakis [mailto:ad...@antonakis.co.uk] Sent: Tuesday, March 15, 2011 1:10 AM To: Jack Subject: Re: [PHP] problem with if and exact match http://php.net/manual/en/function.preg-match.php On 14/03/11 23:02, Jack wrote: I want to be able to match if a string is contained within the string I am evaluating. I know that if ( $name == xxjacksonxx); based on the below would be true. But I want to be able to say if jackson is contained within $name that it's a match. I tried the below without success.. Not getting the operand properly.. ? $name = xxjacksonxx; if ( preg_match($name, jackson)) { print true; } else { print false; } ? Thanks! Jack Wouldn't this be better to use, as it is meant to search for the string inside the string? (use use regex) if(stristr($name, 'Jackson')) { echo String is in String; } else { echo Failed; } http://ca.php.net/manual/en/function.strstr.php (case sensative) http://ca.php.net/manual/en/function.stristr.php (case insensative) Steve. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with if and exact match
On 03/15/2011 07:30 AM, Steve Staples wrote: Wouldn't this be better to use, as it is meant to search for the string inside the string? (use use regex) if(stristr($name, 'Jackson')) { echo String is in String; } else { echo Failed; } http://ca.php.net/manual/en/function.strstr.php (case sensative) http://ca.php.net/manual/en/function.stristr.php (case insensative) Steve. From your link: Note: If you only want to determine if a particular needle occurs within haystack, use the faster and less memory intensive function strpos() instead. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with if and exact match
Try If(preg_match(/Jackson/i, $name)) {echo 'match'; }else{ echo 'fail'; } Richard Buskirk Sent from my iPhone On Mar 15, 2011, at 1:02 AM, Jack jacklistm...@gmail.com wrote: I want to be able to match if a string is contained within the string I am evaluating. I know that if ( $name == xxjacksonxx); based on the below would be true. But I want to be able to say if jackson is contained within $name that it's a match. I tried the below without success.. Not getting the operand properly.. ? $name = xxjacksonxx; if ( preg_match($name, jackson)) { print true; } else { print false; } ? Thanks! Jack -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with if and exact match
On 15/03/2011, at 6:02 PM, Jack wrote: I want to be able to match if a string is contained within the string I am evaluating. I know that if ( $name == xxjacksonxx); based on the below would be true. But I want to be able to say if jackson is contained within $name that it's a match. I tried the below without success.. Not getting the operand properly.. ? $name = xxjacksonxx; if ( preg_match($name, jackson)) { print true; } else { print false; } ? Thanks! Jack if(strpos($name, 'jackson') !== false) { true } You can use stripos for case-insentive matching. Using regex functions when you don't need the power is overkill and slower. Your call to preg_match wasn't working because you need your search term first, and it needs proper delimiters. --- Simon Welsh Admin of http://simon.geek.nz/ Who said Microsoft never created a bug-free program? The blue screen never, ever crashes! http://www.thinkgeek.com/brain/gimme.cgi?wid=81d520e5e -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] problem with if and exact match
Thanks everyone... great examples...works ( both methods ) Thanks! Jack -Original Message- From: Alexis Antonakis [mailto:ad...@antonakis.co.uk] Sent: Tuesday, March 15, 2011 1:10 AM To: Jack Subject: Re: [PHP] problem with if and exact match http://php.net/manual/en/function.preg-match.php On 14/03/11 23:02, Jack wrote: I want to be able to match if a string is contained within the string I am evaluating. I know that if ( $name == xxjacksonxx); based on the below would be true. But I want to be able to say if jackson is contained within $name that it's a match. I tried the below without success.. Not getting the operand properly.. ? $name = xxjacksonxx; if ( preg_match($name, jackson)) { print true; } else { print false; } ? Thanks! Jack -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with Include
On Tue, Dec 21, 2010 at 2:48 AM, Ravi Gehlot r...@ravigehlot.net wrote: My point is that you tried to Not me personally. take code from one page and put it all organized in another page and the include that page of includes back into the pages that you want it to feed off from. If stuff works the way that it does then there a reason for it to have been done that way. By the original designer, but maybe not the OP. That's why documenting code is so important. 99% doesn't do it (including me). For you, others, and for self, it's more than important, it can be essential, especially if you're trying to keep up with multiple languages, OS's, and platforms. Ravi. On Tue, Dec 21, 2010 at 2:35 AM, David Hutto smokefl...@gmail.com wrote: On Tue, Dec 21, 2010 at 2:29 AM, Ravi Gehlot r...@ravigehlot.net wrote: Why mess with something that is already working? If you are trying to make it pretty then you are not solving a problem. You are creating one. Define working. I've had programs 'work', but more experienced would say it's flawed in some respect. Does it perform the immediate task? Now define pretty. Is it aesthetically pleasing to you, or to someone else with less, or maybe more experience. By defining the two above, you then define whether it's a problem. To you, or to them, or to the original designer? Ravi. On Mon, Dec 20, 2010 at 7:40 AM, Daniel P. Brown daniel.br...@parasane.netwrote: On Mon, Dec 20, 2010 at 02:49, Simcha Younger sim...@syounger.com wrote: Since it is being included by PHP, and not served by Apache, the extension is not important. Correct, but keep in mind that it will likely be served as plain text if accessed directly, if the web server is not properly configured (which, by default, it isn't). -- /Daniel P. Brown Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-4321 http://www.parasane.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- They're installing the breathalyzer on my email account next week. -- They're installing the breathalyzer on my email account next week. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with Include
On Tue, Dec 21, 2010 at 02:48, Ravi Gehlot r...@ravigehlot.net wrote: My point is that you tried to take code from one page and put it all organized in another page and the include that page of includes back into the pages that you want it to feed off from. If stuff works the way that it does then there a reason for it to have been done that way. So you think no one should ever do that because it's only making it look pretty? Ever hear of maintainability? That's why documenting code is so important. 99% doesn't do it (including me). Please cite your source. -- /Daniel P. Brown Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-4321 http://www.parasane.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with Include
On Tue, Dec 21, 2010 at 9:50 AM, Daniel P. Brown daniel.br...@parasane.net wrote: On Tue, Dec 21, 2010 at 02:48, Ravi Gehlot r...@ravigehlot.net wrote: My point is that you tried to take code from one page and put it all organized in another page and the include that page of includes back into the pages that you want it to feed off from. If stuff works the way that it does then there a reason for it to have been done that way. So you think no one should ever do that because it's only making it look pretty? Ever hear of maintainability? That's why documenting code is so important. 99% doesn't do it (including me). Please cite your source. Personally, I'd even have to admit mine was less than 99% compatible with what I'd like it to be. -- /Daniel P. Brown Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-4321 http://www.parasane.net/ -- They're installing the breathalyzer on my email account next week. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with Include
On Tue, Dec 21, 2010 at 9:54 AM, David Hutto smokefl...@gmail.com wrote: On Tue, Dec 21, 2010 at 9:50 AM, Daniel P. Brown daniel.br...@parasane.net wrote: On Tue, Dec 21, 2010 at 02:48, Ravi Gehlot r...@ravigehlot.net wrote: My point is that you tried to take code from one page and put it all organized in another page and the include that page of includes back into the pages that you want it to feed off from. If stuff works the way that it does then there a reason for it to have been done that way. So you think no one should ever do that because it's only making it look pretty? Ever hear of maintainability? That's why documenting code is so important. 99% doesn't do it (including me). Please cite your source. Personally, I'd even have to admit mine was(and is) less than 99% compatible with what I'd like it to be. -- /Daniel P. Brown Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-4321 http://www.parasane.net/ -- They're installing the breathalyzer on my email account next week. -- They're installing the breathalyzer on my email account next week. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with Include
On Tue, Dec 21, 2010 at 02:35:33AM -0500, David Hutto wrote: On Tue, Dec 21, 2010 at 2:29 AM, Ravi Gehlot r...@ravigehlot.net wrote: Why mess with something that is already working? If you are trying to make it pretty then you are not solving a problem. You are creating one. Define working. I've had programs 'work', but more experienced would say it's flawed in some respect. Does it perform the immediate task? Now define pretty. Is it aesthetically pleasing to you, or to someone else with less, or maybe more experience. By defining the two above, you then define whether it's a problem. To you, or to them, or to the original designer? Beware of more experienced programmers. I recently talked to an ex-boss of mine who had a programmer flake out on him. One of his customers threatened to take this flaky code to another company and get their opinion about whether it was good code or not. My ex-boss explained that, of course, they'd shoot it down. Because that's what programmers do-- they complain about other programmers' code. I'd never heard that idea expressed aloud. But when I thought about it, I realized it was true. Hell, look at the content of this list. ;-} Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with Include
If something is working and you don't know exactly whats under the hood then you are wasting your time in trying to re-invent your own wheel and waste your time and resources to modify something that isn't needed to be touched. Good programmers make good use of their time as well. We need to keep in check with new technology, learn new trends and also master our weakness. If we keep changing this or that or moving that or this then oh well...there goes 1 day worth of work to figure stuff out. Just my take on this. If you think different, then no problems. Regards, Ravi. On Tue, Dec 21, 2010 at 10:23 AM, Paul M Foster pa...@quillandmouse.comwrote: On Tue, Dec 21, 2010 at 02:35:33AM -0500, David Hutto wrote: On Tue, Dec 21, 2010 at 2:29 AM, Ravi Gehlot r...@ravigehlot.net wrote: Why mess with something that is already working? If you are trying to make it pretty then you are not solving a problem. You are creating one. Define working. I've had programs 'work', but more experienced would say it's flawed in some respect. Does it perform the immediate task? Now define pretty. Is it aesthetically pleasing to you, or to someone else with less, or maybe more experience. By defining the two above, you then define whether it's a problem. To you, or to them, or to the original designer? Beware of more experienced programmers. I recently talked to an ex-boss of mine who had a programmer flake out on him. One of his customers threatened to take this flaky code to another company and get their opinion about whether it was good code or not. My ex-boss explained that, of course, they'd shoot it down. Because that's what programmers do-- they complain about other programmers' code. I'd never heard that idea expressed aloud. But when I thought about it, I realized it was true. Hell, look at the content of this list. ;-} Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with Include
(Apologies for top posting; on my mobile just now.) Not true. Refactoring code is one of the main tasks of a developer. None of us produce perfect code, and some code is less perfect than other code. It's instinct to want to fix bad code when we're maintaining it or having to add new features to it. For the same reason car enthusiasts tinker with and tune their cars, good developers will do the same with code, be it in the form of consolidating common code to include files or other ways. To not do so seems to me to avoid ones nature really! Thanks, Ash http://www.ashleysheridan.co.uk - Reply message - From: Ravi Gehlot r...@ravigehlot.net Date: Tue, Dec 21, 2010 18:12 Subject: [PHP] Problem with Include To: Paul M Foster pa...@quillandmouse.com Cc: php-general@lists.php.net If something is working and you don't know exactly whats under the hood then you are wasting your time in trying to re-invent your own wheel and waste your time and resources to modify something that isn't needed to be touched. Good programmers make good use of their time as well. We need to keep in check with new technology, learn new trends and also master our weakness. If we keep changing this or that or moving that or this then oh well...there goes 1 day worth of work to figure stuff out. Just my take on this. If you think different, then no problems. Regards, Ravi. On Tue, Dec 21, 2010 at 10:23 AM, Paul M Foster pa...@quillandmouse.comwrote: On Tue, Dec 21, 2010 at 02:35:33AM -0500, David Hutto wrote: On Tue, Dec 21, 2010 at 2:29 AM, Ravi Gehlot r...@ravigehlot.net wrote: Why mess with something that is already working? If you are trying to make it pretty then you are not solving a problem. You are creating one. Define working. I've had programs 'work', but more experienced would say it's flawed in some respect. Does it perform the immediate task? Now define pretty. Is it aesthetically pleasing to you, or to someone else with less, or maybe more experience. By defining the two above, you then define whether it's a problem. To you, or to them, or to the original designer? Beware of more experienced programmers. I recently talked to an ex-boss of mine who had a programmer flake out on him. One of his customers threatened to take this flaky code to another company and get their opinion about whether it was good code or not. My ex-boss explained that, of course, they'd shoot it down. Because that's what programmers do-- they complain about other programmers' code. I'd never heard that idea expressed aloud. But when I thought about it, I realized it was true. Hell, look at the content of this list. ;-} Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with Include
Hello, Good points. If you are getting paid to do that then fine. There is a difference between enhancing code and wasting time. I do my best to come up with the best I can. I always take notes to perform better in upcoming projects. It is imperative to make good use of time. Unless it is a security issue, no need to waste time. Again, if you are getting paid for it then fine. People tune cars for a reason, they want the attention or the thrill. If you want to tune your code for fun then nobody is against that either :) Ravi. On Tue, Dec 21, 2010 at 1:28 PM, a...@ashleysheridan.co.uk a...@ashleysheridan.co.uk wrote: (Apologies for top posting; on my mobile just now.) Not true. Refactoring code is one of the main tasks of a developer. None of us produce perfect code, and some code is less perfect than other code. It's instinct to want to fix bad code when we're maintaining it or having to add new features to it. For the same reason car enthusiasts tinker with and tune their cars, good developers will do the same with code, be it in the form of consolidating common code to include files or other ways. To not do so seems to me to avoid ones nature really! Thanks, Ash http://www.ashleysheridan.co.uk - Reply message - From: Ravi Gehlot r...@ravigehlot.net Date: Tue, Dec 21, 2010 18:12 Subject: [PHP] Problem with Include To: Paul M Foster pa...@quillandmouse.com Cc: php-general@lists.php.net If something is working and you don't know exactly whats under the hood then you are wasting your time in trying to re-invent your own wheel and waste your time and resources to modify something that isn't needed to be touched. Good programmers make good use of their time as well. We need to keep in check with new technology, learn new trends and also master our weakness. If we keep changing this or that or moving that or this then oh well...there goes 1 day worth of work to figure stuff out. Just my take on this. If you think different, then no problems. Regards, Ravi. On Tue, Dec 21, 2010 at 10:23 AM, Paul M Foster pa...@quillandmouse.com wrote: On Tue, Dec 21, 2010 at 02:35:33AM -0500, David Hutto wrote: On Tue, Dec 21, 2010 at 2:29 AM, Ravi Gehlot r...@ravigehlot.net wrote: Why mess with something that is already working? If you are trying to make it pretty then you are not solving a problem. You are creating one. Define working. I've had programs 'work', but more experienced would say it's flawed in some respect. Does it perform the immediate task? Now define pretty. Is it aesthetically pleasing to you, or to someone else with less, or maybe more experience. By defining the two above, you then define whether it's a problem. To you, or to them, or to the original designer? Beware of more experienced programmers. I recently talked to an ex-boss of mine who had a programmer flake out on him. One of his customers threatened to take this flaky code to another company and get their opinion about whether it was good code or not. My ex-boss explained that, of course, they'd shoot it down. Because that's what programmers do-- they complain about other programmers' code. I'd never heard that idea expressed aloud. But when I thought about it, I realized it was true. Hell, look at the content of this list. ;-} Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with Include
On Tue, Dec 21, 2010 at 1:28 PM, a...@ashleysheridan.co.uk a...@ashleysheridan.co.uk wrote: (Apologies for top posting; on my mobile just now.) Not true. Refactoring code is one of the main tasks of a developer. None of us produce perfect code, and some code is less perfect than other code. It's instinct to want to fix bad code when we're maintaining it or having to add new features to it. For the same reason car enthusiasts tinker with and tune their cars, good developers will do the same with code, be it in the form of consolidating common code to include files or other ways. To not do so seems to me to avoid ones nature really! Thanks, Ash http://www.ashleysheridan.co.uk - Reply message - From: Ravi Gehlot r...@ravigehlot.net Date: Tue, Dec 21, 2010 18:12 Subject: [PHP] Problem with Include To: Paul M Foster pa...@quillandmouse.com Cc: php-general@lists.php.net If something is working and you don't know exactly whats under the hood then you are wasting your time in trying to re-invent your own wheel and waste your time and resources to modify something that isn't needed to be touched. Good programmers make good use of their time as well. We need to keep in check with new technology, learn new trends and also master our weakness. If we keep changing this or that or moving that or this then oh well...there goes 1 day worth of work to figure stuff out. Just my take on this. If you think different, then no problems. Regards, Ravi. On Tue, Dec 21, 2010 at 10:23 AM, Paul M Foster pa...@quillandmouse.comwrote: On Tue, Dec 21, 2010 at 02:35:33AM -0500, David Hutto wrote: On Tue, Dec 21, 2010 at 2:29 AM, Ravi Gehlot r...@ravigehlot.net wrote: Why mess with something that is already working? If you are trying to make it pretty then you are not solving a problem. You are creating one. Define working. I've had programs 'work', but more experienced would say it's flawed in some respect. Does it perform the immediate task? Now define pretty. Is it aesthetically pleasing to you, or to someone else with less, or maybe more experience. By defining the two above, you then define whether it's a problem. To you, or to them, or to the original designer? Beware of more experienced programmers. I recently talked to an ex-boss of mine who had a programmer flake out on him. One of his customers threatened to take this flaky code to another company and get their opinion about whether it was good code or not. My ex-boss explained that, of course, they'd shoot it down. Because that's what programmers do-- they complain about other programmers' code. I'd never heard that idea expressed aloud. But when I thought about it, I realized it was true. Hell, look at the content of this list. ;-} Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php +1 -- 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] Problem with Include
On Mon, Dec 20, 2010 at 02:49, Simcha Younger sim...@syounger.com wrote: Since it is being included by PHP, and not served by Apache, the extension is not important. Correct, but keep in mind that it will likely be served as plain text if accessed directly, if the web server is not properly configured (which, by default, it isn't). -- /Daniel P. Brown Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-4321 http://www.parasane.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with Include
Why mess with something that is already working? If you are trying to make it pretty then you are not solving a problem. You are creating one. Ravi. On Mon, Dec 20, 2010 at 7:40 AM, Daniel P. Brown daniel.br...@parasane.netwrote: On Mon, Dec 20, 2010 at 02:49, Simcha Younger sim...@syounger.com wrote: Since it is being included by PHP, and not served by Apache, the extension is not important. Correct, but keep in mind that it will likely be served as plain text if accessed directly, if the web server is not properly configured (which, by default, it isn't). -- /Daniel P. Brown Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-4321 http://www.parasane.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with Include
On Tue, Dec 21, 2010 at 2:29 AM, Ravi Gehlot r...@ravigehlot.net wrote: Why mess with something that is already working? If you are trying to make it pretty then you are not solving a problem. You are creating one. Define working. I've had programs 'work', but more experienced would say it's flawed in some respect. Does it perform the immediate task? Now define pretty. Is it aesthetically pleasing to you, or to someone else with less, or maybe more experience. By defining the two above, you then define whether it's a problem. To you, or to them, or to the original designer? Ravi. On Mon, Dec 20, 2010 at 7:40 AM, Daniel P. Brown daniel.br...@parasane.netwrote: On Mon, Dec 20, 2010 at 02:49, Simcha Younger sim...@syounger.com wrote: Since it is being included by PHP, and not served by Apache, the extension is not important. Correct, but keep in mind that it will likely be served as plain text if accessed directly, if the web server is not properly configured (which, by default, it isn't). -- /Daniel P. Brown Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-4321 http://www.parasane.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- They're installing the breathalyzer on my email account next week. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with Include
My point is that you tried to take code from one page and put it all organized in another page and the include that page of includes back into the pages that you want it to feed off from. If stuff works the way that it does then there a reason for it to have been done that way. That's why documenting code is so important. 99% doesn't do it (including me). Ravi. On Tue, Dec 21, 2010 at 2:35 AM, David Hutto smokefl...@gmail.com wrote: On Tue, Dec 21, 2010 at 2:29 AM, Ravi Gehlot r...@ravigehlot.net wrote: Why mess with something that is already working? If you are trying to make it pretty then you are not solving a problem. You are creating one. Define working. I've had programs 'work', but more experienced would say it's flawed in some respect. Does it perform the immediate task? Now define pretty. Is it aesthetically pleasing to you, or to someone else with less, or maybe more experience. By defining the two above, you then define whether it's a problem. To you, or to them, or to the original designer? Ravi. On Mon, Dec 20, 2010 at 7:40 AM, Daniel P. Brown daniel.br...@parasane.netwrote: On Mon, Dec 20, 2010 at 02:49, Simcha Younger sim...@syounger.com wrote: Since it is being included by PHP, and not served by Apache, the extension is not important. Correct, but keep in mind that it will likely be served as plain text if accessed directly, if the web server is not properly configured (which, by default, it isn't). -- /Daniel P. Brown Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-4321 http://www.parasane.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- They're installing the breathalyzer on my email account next week.
Re: [PHP] Problem with Include
$file_name= basename($_SERVER['PHP_SELF']); $last_modified = filemtime($file_name); print(This page last modified ); print(date(m/j/y, $last_modified)); you need to wrap the contents ^^^ of the include file with ? php ? Govinda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with Include
On Dec 19, 2010, at 10:43 AM, Bill Guion wrote: In an effort to clean up some code, I tried taking four lines out of 6 or 7 programs and putting them into an include file. The file structure is Root data clubs.php include fmt.inc Originally, clubs.php had the following code: ?PHP $file_name= basename($_SERVER['PHP_SELF']); $last_modified = filemtime($file_name); print(This page last modified ); print(date(m/j/y, $last_modified)); ? This code works - on the web page I get This page last modified 12/18/2010 which is correct. So then I did the following: Create an include file, fmt.inc with the following code: $file_name= basename($_SERVER['PHP_SELF']); $last_modified = filemtime($file_name); print(This page last modified ); print(date(m/j/y, $last_modified)); and then in the original file, I have ?PHP include ../include/fmt.inc; ? On my web page, I then get $file_name= basename($_SERVER['PHP_SELF']);$last_modified = filemtime($file_name);print(This page last modified ); print(date(m/j/y, $last_modified)); (all on one line). I would really like to understand why the include construct doesn't give the same results as the original? -= Bill =- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Whenever you see PHP code emitted to the web page, it means it wasn't wrapped in ?php..?. If your include file above is complete, it's missing these tags. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with Include
Is your server even set up to recognise .inc files as php? You can't just put any old extension on and expect the server to know what to do with it. Thanks, Ash http://www.ashleysheridan.co.uk - Reply message - From: Tamara Temple tamouse.li...@gmail.com Date: Sun, Dec 19, 2010 17:07 Subject: [PHP] Problem with Include To: Bill Guion bgu...@comcast.net Cc: php-general@lists.php.net On Dec 19, 2010, at 10:43 AM, Bill Guion wrote: In an effort to clean up some code, I tried taking four lines out of 6 or 7 programs and putting them into an include file. The file structure is Root data clubs.php include fmt.inc Originally, clubs.php had the following code: ?PHP $file_name= basename($_SERVER['PHP_SELF']); $last_modified = filemtime($file_name); print(This page last modified ); print(date(m/j/y, $last_modified)); ? This code works - on the web page I get This page last modified 12/18/2010 which is correct. So then I did the following: Create an include file, fmt.inc with the following code: $file_name= basename($_SERVER['PHP_SELF']); $last_modified = filemtime($file_name); print(This page last modified ); print(date(m/j/y, $last_modified)); and then in the original file, I have ?PHP include ../include/fmt.inc; ? On my web page, I then get $file_name= basename($_SERVER['PHP_SELF']);$last_modified = filemtime($file_name);print(This page last modified ); print(date(m/j/y, $last_modified)); (all on one line). I would really like to understand why the include construct doesn't give the same results as the original? -= Bill =- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Whenever you see PHP code emitted to the web page, it means it wasn't wrapped in ?php..?. If your include file above is complete, it's missing these tags. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with Include
On Sun, 19 Dec 2010 17:41:20 + a...@ashleysheridan.co.uk a...@ashleysheridan.co.uk wrote: Is your server even set up to recognise .inc files as php? You can't just put any old extension on and expect the server to know what to do with it. Thanks, Ash http://www.ashleysheridan.co.uk Since it is being included by PHP, and not served by Apache, the extension is not important. -- Simcha Younger sim...@syounger.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with shell_exec
Hello, i am sorry for it took ridiculously long for me to respond, but i have been struggling with the issue ever since. I still don't really know what the problem was, but i have managed to solve it through a shortcut. I have tried everything recommended from you. In php.ini the shell_exec wasn't listed under disabled functions. I have tried adding a new user with the (i presume) right permissions and starting the server through it. I have tried busybox httpd and lighttpd with the new user, as well as with the old nobody. I have installed bash (instead of busyboxs' shell) and even tried installing it in the root server folder (/var/www)- still the problem persisted. What i have done today is compiling php through buildroot and than copy over the binary php-cgi to the embedded system. It worked like a charm- out of the box, without the adjustments i made previously. So it seems- to me- that this was a cross- compiling issue on my side. I don't know what have i done wrong with the compilation, but right now i don't have much time to look it up- i must proceed with the project. If i find out what was causing the problem, i will be sure to post a solution here. So- thank you very much. Your help is indeed appreciated. Yours, Boyan 1. On Sun, Oct 31, 2010 at 11:24 PM, ad...@buskirkgraphics.com wrote: After going over this a thousand times in my head and on sever. Here are a few reasons why a shell_exec will not function. First I tested the PHP CLI Can I see my version of php. $output = shell_exec('php -v'); Echo $output; If I am not getting the information about the php version. Is shell_exec for php and http on? In your php.ini file there will be a section called disable_functions. If you are sure that shell_exec is not in the list. If neither of these are an issue for you, It has to be a permissions issue. I do not claim to be an expert in the shell_exec area of php, I cannot duplicate your error. Richard L. Buskirk -Original Message- From: Boyan Penev [mailto:boyan...@googlemail.com] Sent: Sunday, October 31, 2010 12:26 PM To: ad...@buskirkgraphics.com Cc: php-general@lists.php.net Subject: Re: [PHP] Problem with shell_exec Hello Richard, thank you for the prompt reply. I just tried to follow your suggestion, but i couldn't solve my problem: 1. I have started the server with user nobody. All the binaries i was trying to execute(e.g. /bin/ls) were chown-ed to the user nobody Problem presisted. Than i chown -ed /var/www to the user nobody. Than the php and php-cgi interpreters as well- same thing. I tried the same with users adm and even root 2. I than gave the executables all the permissions possible(777- i know it is dangerous, but i am just testing)- still nothing. I copied the binaries from /bin to /var/www and tried to execute them with all kinds of permissions and chown's- didn't work 3. Than i moved to the command line interpreter: i tried to execute it in /var/www and in the home folder. The permissions were also adjusted. I executed it with root privileges- i always get Segmentation fault. One more thing- if i omit the arguments in shell_exec( $output = shell_exec();) i get Missing parameters but no Segmentation fault Boyan On Sun, Oct 31, 2010 at 4:34 PM, ad...@buskirkgraphics.com wrote: It seems most probably a permission problem. If I were you I would check the permissions on the bin directory and the files in it. PHP will probably run under the uid of the webserver, which, on most systems is either apache or nobody depending on the configuration. Richard L. Buskirk -Original Message- From: Boyan Penev [mailto:boyan...@googlemail.com] Sent: Sunday, October 31, 2010 11:16 AM To: php-general@lists.php.net Subject: [PHP] Problem with shell_exec Hello, i have installed php 5.2.14 on an embedded system. I have run a couple of test scripts and everything works fine, but i can't get shell_exec to work. When i invoke shell_exec, the script doesn't get interpreted, instead i get prompted to download the whole .php file. I have tried both /bin/php and /bin/php-cgi- same problem. When i try to execute it per command line instead of web server, with both php and php-cgi i get Segmentation fault and nothing happens. I use busybox http as a web server, if it's relevant. Does anybody have an idea what the problem might be? Any help would be appreciated. Best regards, Boyan
Re: [PHP] Problem with RegEx for BBCode
On 27 November 2010 13:57, Asmann, Roland roland.asm...@adesso.at wrote: Hi all, I am playing around with PHP and BBCodes and have found some regex's that should transform my BBCode into correct HTML when rendering. However, I have found that if the BBCode is not correct (eg missing closing tag), the regex completely eats my input and my page is empty! The regex I'm using is: /\[i\]((\s|.)+?)\[\/i\]/ And with an input like: This is [i]italic. I get nothing back. What I would like is that when no closing tag is found, the opening tag should just be shown as-is. Anybody have any idea how I can do this? Thanks! -- Roland Asmann Senior Software Engineer adesso Austria GmbH Floridotower 26. Stock T +43 1 2198790-27 Floridsdorfer Hauptstr. 1 F +43 1 2198790-927 A-1210 Wien M +43 664 88657566 E roland.asm...@adesso.at W www.adesso.at - business. people. technology. - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I think this is a common issue with regex. Trying to use Regex as a parser is no good. At best, regex can be used as a tokenizer. It has limited ability to handle the nesting. The input you gave has no closing [/i], so the regex can't match the string, so nothing is returned. -- Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with RegEx for BBCode
On 27-11-10 18:44, Asmann, Roland wrote: On 27-11-10 17:24, Daniel P. Brown wrote: On Sat, Nov 27, 2010 at 08:57, Asmann, Roland roland.asm...@adesso.at wrote: Hi all, I am playing around with PHP and BBCodes and have found some regex's that should transform my BBCode into correct HTML when rendering. However, I have found that if the BBCode is not correct (eg missing closing tag), the regex completely eats my input and my page is empty! [snip!] What I would like is that when no closing tag is found, the opening tag should just be shown as-is. Anybody have any idea how I can do this? Have you checked into the built-in BBCode library? http://php.net/bbcode I'm afraid that is not an option, I don't have that package installed and am not allowed to install anything on the server either... Besides, what I don't really understand is WHY does this happen? Any other language that has RegEx doesn't match a thing in my example and just returns the original input. Why is PHP different in this regard? -- Roland Asmann Senior Software Engineer adesso Austria GmbH Floridotower 26. Stock T +43 1 2198790-27 Floridsdorfer Hauptstr. 1 F +43 1 2198790-927 A-1210 Wien M +43 664 88657566 E roland.asm...@adesso.at W www.adesso.at - business. people. technology. - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with RegEx for BBCode
On Sat, Nov 27, 2010 at 12:50, Asmann, Roland roland.asm...@adesso.at wrote: Besides, what I don't really understand is WHY does this happen? Any other language that has RegEx doesn't match a thing in my example and just returns the original input. Why is PHP different in this regard? All we've seen is your regexp, not your code - not even which regexp library you're using. So that's a pretty ambiguous question, really. -- /Daniel P. Brown Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-4321 http://www.parasane.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with RegEx for BBCode
Please be sure to hit Reply-All so that the list is CC'd on each response as well. On Sat, Nov 27, 2010 at 13:55, Asmann, Roland roland.asm...@adesso.at wrote: I'm currently running this on a default XAMPP installation on my PC, because I was told something similar is running on the server. I thought this had a default RegEx lib, or does it have something extra for that? No, I mistyped, it's not your fault. I meant: which function are you using to execute the regexp? As for the code, here's the part that I think *should* work, but doesn't do the trick for me: $s = preg_replace(/\[i\]((\s|.)+?)\[\/i\]/, i\\1/i, $s); This is exactly what I meant when I erroneously said, library. -- /Daniel P. Brown Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-4321 http://www.parasane.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with functions and arrays...
On Nov 21, 2010, at 4:57 PM, Tamara Temple wrote: On Nov 20, 2010, at 5:31 PM, Jason Pruim wrote: ?PHP function ddbYear($name, $message, $_POST, $option){ Maybe it's just me, but using the name of a global as a function parameter just seems like a bad idea. Yes, you can do it. Should you? I think not. Especially, as, you are passing it a scalar below and treating it here like the global array. It was there as a hold over from when I originally made the functions which just had to deal with getting variables from the $_POST global. //Make sure to post form start/stop OUTSIDE of this function... //It's not meant to be a one size fits all function! echo NAME: . $name . BR; echo MESSAGE: . $message . BR; echo POST: . $_POST . BR; echo OPTION: . $option . BR; $sticky = ''; if(isset($_POST['submit'])) { Check the error messages -- since you're passing in $startYear as a scalar below, you shouldn't be able to access $_POST as an associative array. ini_set(display_errors, 1); error_reporting(-1); were both on and were not complaining about anything... $sticky = $_POST[{$name}]; echo STICKY: . $sticky; } //echo OPTION: ; //print_r($option); echo HTML select name={$name} option value=0{$message}/option HTML; foreach ($option as $key = $value){ if($key == $sticky) { echo 'option value=' . $key .' selected' . $value . '/option'; }else{ echo 'option value=' . $key .'' . $value . '/option'; } } echo HTML /select HTML; unset($value); return; } ? One for Month, Day Year... All the same exact code... When I get brave I'll combine it into 1 functions :) Now... What it's trying to do.. It's on a update form on my website. Basically pulls the info from the database and displays it in the form again so it can be edited and resubmitted... As I'm sure you can tell from the function it checks to see if the a value has been selected in the drop down box and if it has then set the drop down box to that value. I call the function like this: ?PHP $startYear = date(Y, $row['startdate']); //Actual DBValue: 1265000400 You're setting $startYear as a scalar value here. $optionYear = array(2010 = 2010, 2011 = 2011, 2012 = 2012, 2013 = 2013, 2014 = 2014); ddbYear(startYear, Select Year, $startYear, $optionYear); And passing it in to the $_POST variable in your function. Then you treat the $_POST variable as an associative array (seemingly much like the global $_POST array). ? The output I'm getting is: THESE ARE THE ACTUAL UNPROCESSED (OTHER THEN SEPARATING) VALUES FROM THE DATABASE startmonth: 2 startday: 1 startYear: 2010 endmonth: 11 endDay: 30 endYear: 1999 THESE ARE THE VALUES INSIDE THE FUNCTION NAME: startYear MESSAGE: Select Year POST: 2010 OPTION: Array STICKY: 2 Now... The problem is that $sticky get set to 2 instead of 2010... But I can't figure out why... Anyone have any ideas? And just incase I didn't provide enough info here's a link that shows it happening: HTTP://jason.pruimphotography.com/dev/cms2/events/update_form.php?id=62 Again, I will reiterate that taking the name of a global variable and using it as a parameter in a function is a bad idea. It can be done, and my in some cases have some uses, but I don't think the way you're using it is a good idea, and looks wrong to me as well. Turns out it was a conflict with the $_POST global.. Or my misunderstanding inside the functions... I changed that to another name and now it works fine... Thanks Tamara! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with functions and arrays...
On Nov 20, 2010, at 5:31 PM, Jason Pruim wrote: ?PHP function ddbYear($name, $message, $_POST, $option){ Maybe it's just me, but using the name of a global as a function parameter just seems like a bad idea. Yes, you can do it. Should you? I think not. Especially, as, you are passing it a scalar below and treating it here like the global array. //Make sure to post form start/stop OUTSIDE of this function... //It's not meant to be a one size fits all function! echo NAME: . $name . BR; echo MESSAGE: . $message . BR; echo POST: . $_POST . BR; echo OPTION: . $option . BR; $sticky = ''; if(isset($_POST['submit'])) { Check the error messages -- since you're passing in $startYear as a scalar below, you shouldn't be able to access $_POST as an associative array. $sticky = $_POST[{$name}]; echo STICKY: . $sticky; } //echo OPTION: ; //print_r($option); echo HTML select name={$name} option value=0{$message}/option HTML; foreach ($option as $key = $value){ if($key == $sticky) { echo 'option value=' . $key .' selected' . $value . '/option'; }else{ echo 'option value=' . $key .'' . $value . '/option'; } } echo HTML /select HTML; unset($value); return; } ? One for Month, Day Year... All the same exact code... When I get brave I'll combine it into 1 functions :) Now... What it's trying to do.. It's on a update form on my website. Basically pulls the info from the database and displays it in the form again so it can be edited and resubmitted... As I'm sure you can tell from the function it checks to see if the a value has been selected in the drop down box and if it has then set the drop down box to that value. I call the function like this: ?PHP $startYear = date(Y, $row['startdate']); //Actual DBValue: 1265000400 You're setting $startYear as a scalar value here. $optionYear = array(2010 = 2010, 2011 = 2011, 2012 = 2012, 2013 = 2013, 2014 = 2014); ddbYear(startYear, Select Year, $startYear, $optionYear); And passing it in to the $_POST variable in your function. Then you treat the $_POST variable as an associative array (seemingly much like the global $_POST array). ? The output I'm getting is: THESE ARE THE ACTUAL UNPROCESSED (OTHER THEN SEPARATING) VALUES FROM THE DATABASE startmonth: 2 startday: 1 startYear: 2010 endmonth: 11 endDay: 30 endYear: 1999 THESE ARE THE VALUES INSIDE THE FUNCTION NAME: startYear MESSAGE: Select Year POST: 2010 OPTION: Array STICKY: 2 Now... The problem is that $sticky get set to 2 instead of 2010... But I can't figure out why... Anyone have any ideas? And just incase I didn't provide enough info here's a link that shows it happening: HTTP://jason.pruimphotography.com/dev/cms2/events/update_form.php? id=62 Again, I will reiterate that taking the name of a global variable and using it as a parameter in a function is a bad idea. It can be done, and my in some cases have some uses, but I don't think the way you're using it is a good idea, and looks wrong to me as well. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with shell_exec
It seems most probably a permission problem. If I were you I would check the permissions on the bin directory and the files in it. PHP will probably run under the uid of the webserver, which, on most systems is either apache or nobody depending on the configuration. Richard L. Buskirk -Original Message- From: Boyan Penev [mailto:boyan...@googlemail.com] Sent: Sunday, October 31, 2010 11:16 AM To: php-general@lists.php.net Subject: [PHP] Problem with shell_exec Hello, i have installed php 5.2.14 on an embedded system. I have run a couple of test scripts and everything works fine, but i can't get shell_exec to work. When i invoke shell_exec, the script doesn't get interpreted, instead i get prompted to download the whole .php file. I have tried both /bin/php and /bin/php-cgi- same problem. When i try to execute it per command line instead of web server, with both php and php-cgi i get Segmentation fault and nothing happens. I use busybox http as a web server, if it's relevant. Does anybody have an idea what the problem might be? Any help would be appreciated. Best regards, Boyan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with shell_exec
Hello Richard, thank you for the prompt reply. I just tried to follow your suggestion, but i couldn't solve my problem: 1. I have started the server with user nobody. All the binaries i was trying to execute(e.g. /bin/ls) were chown-ed to the user nobody Problem presisted. Than i chown -ed /var/www to the user nobody. Than the php and php-cgi interpreters as well- same thing. I tried the same with users adm and even root 2. I than gave the executables all the permissions possible(777- i know it is dangerous, but i am just testing)- still nothing. I copied the binaries from /bin to /var/www and tried to execute them with all kinds of permissions and chown's- didn't work 3. Than i moved to the command line interpreter: i tried to execute it in /var/www and in the home folder. The permissions were also adjusted. I executed it with root privileges- i always get Segmentation fault. One more thing- if i omit the arguments in shell_exec( $output = shell_exec();) i get Missing parameters but no Segmentation fault Boyan On Sun, Oct 31, 2010 at 4:34 PM, ad...@buskirkgraphics.com wrote: It seems most probably a permission problem. If I were you I would check the permissions on the bin directory and the files in it. PHP will probably run under the uid of the webserver, which, on most systems is either apache or nobody depending on the configuration. Richard L. Buskirk -Original Message- From: Boyan Penev [mailto:boyan...@googlemail.com] Sent: Sunday, October 31, 2010 11:16 AM To: php-general@lists.php.net Subject: [PHP] Problem with shell_exec Hello, i have installed php 5.2.14 on an embedded system. I have run a couple of test scripts and everything works fine, but i can't get shell_exec to work. When i invoke shell_exec, the script doesn't get interpreted, instead i get prompted to download the whole .php file. I have tried both /bin/php and /bin/php-cgi- same problem. When i try to execute it per command line instead of web server, with both php and php-cgi i get Segmentation fault and nothing happens. I use busybox http as a web server, if it's relevant. Does anybody have an idea what the problem might be? Any help would be appreciated. Best regards, Boyan
RE: [PHP] Problem with shell_exec
After going over this a thousand times in my head and on sever. Here are a few reasons why a shell_exec will not function. First I tested the PHP CLI Can I see my version of php. $output = shell_exec('php -v'); Echo $output; If I am not getting the information about the php version. Is shell_exec for php and http on? In your php.ini file there will be a section called disable_functions. If you are sure that shell_exec is not in the list. If neither of these are an issue for you, It has to be a permissions issue. I do not claim to be an expert in the shell_exec area of php, I cannot duplicate your error. Richard L. Buskirk -Original Message- From: Boyan Penev [mailto:boyan...@googlemail.com] Sent: Sunday, October 31, 2010 12:26 PM To: ad...@buskirkgraphics.com Cc: php-general@lists.php.net Subject: Re: [PHP] Problem with shell_exec Hello Richard, thank you for the prompt reply. I just tried to follow your suggestion, but i couldn't solve my problem: 1. I have started the server with user nobody. All the binaries i was trying to execute(e.g. /bin/ls) were chown-ed to the user nobody Problem presisted. Than i chown -ed /var/www to the user nobody. Than the php and php-cgi interpreters as well- same thing. I tried the same with users adm and even root 2. I than gave the executables all the permissions possible(777- i know it is dangerous, but i am just testing)- still nothing. I copied the binaries from /bin to /var/www and tried to execute them with all kinds of permissions and chown's- didn't work 3. Than i moved to the command line interpreter: i tried to execute it in /var/www and in the home folder. The permissions were also adjusted. I executed it with root privileges- i always get Segmentation fault. One more thing- if i omit the arguments in shell_exec( $output = shell_exec();) i get Missing parameters but no Segmentation fault Boyan On Sun, Oct 31, 2010 at 4:34 PM, ad...@buskirkgraphics.com wrote: It seems most probably a permission problem. If I were you I would check the permissions on the bin directory and the files in it. PHP will probably run under the uid of the webserver, which, on most systems is either apache or nobody depending on the configuration. Richard L. Buskirk -Original Message- From: Boyan Penev [mailto:boyan...@googlemail.com] Sent: Sunday, October 31, 2010 11:16 AM To: php-general@lists.php.net Subject: [PHP] Problem with shell_exec Hello, i have installed php 5.2.14 on an embedded system. I have run a couple of test scripts and everything works fine, but i can't get shell_exec to work. When i invoke shell_exec, the script doesn't get interpreted, instead i get prompted to download the whole .php file. I have tried both /bin/php and /bin/php-cgi- same problem. When i try to execute it per command line instead of web server, with both php and php-cgi i get Segmentation fault and nothing happens. I use busybox http as a web server, if it's relevant. Does anybody have an idea what the problem might be? Any help would be appreciated. Best regards, Boyan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with DATE 2010-10-31
On 12/10/2010 11:52, Rado Oršula wrote: I do not know good English. In the attached source code. Here is erroneous statement: date: 2010-10-31 00:00:00 date+*0*h: 2010-10-31 *00*:00:00 date+*1*h: 2010-10-31 *01*:00:00 *date+2h: 2010-10-31 02:00:00 date+3h: 2010-10-31 02:00:00 * date+*4*h: 2010-10-31 *03*:00:00 [snip] probably at that time the Daylight Savings Time change kicks in ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with DATE 2010-10-31
On 12 October 2010 10:52, Rado Oršula rado.ors...@gmail.com wrote: I do not know good English. In the attached source code. Here is erroneous statement: date: 2010-10-31 00:00:00 date+0h: 2010-10-31 00:00:00 date+1h: 2010-10-31 01:00:00 date+2h: 2010-10-31 02:00:00 date+3h: 2010-10-31 02:00:00 date+4h: 2010-10-31 03:00:00 date+5h: 2010-10-31 04:00:00 date+6h: 2010-10-31 05:00:00 date+7h: 2010-10-31 06:00:00 date+8h: 2010-10-31 07:00:00 date+9h: 2010-10-31 08:00:00 date+10h: 2010-10-31 09:00:00 date+11h: 2010-10-31 10:00:00 date+12h: 2010-10-31 11:00:00 date+13h: 2010-10-31 12:00:00 date+14h: 2010-10-31 13:00:00 date+15h: 2010-10-31 14:00:00 date+16h: 2010-10-31 15:00:00 date+17h: 2010-10-31 16:00:00 date+18h: 2010-10-31 17:00:00 date+19h: 2010-10-31 18:00:00 date+20h: 2010-10-31 19:00:00 date+21h: 2010-10-31 20:00:00 date+22h: 2010-10-31 21:00:00 date+23h: 2010-10-31 22:00:00 date+24h: 2010-10-31 23:00:00 What timezone are you in? In the UK GMT's BST is about to end and revert to standard GMT (If D.R. reads this I apologize for the wishy washy explanation). So, if you were to include the DST, the output would look right. date+0h: 2010-10-31 00:00:00 BST date+1h: 2010-10-31 01:00:00 BST date+2h: 2010-10-31 02:00:00 BST date+3h: 2010-10-31 02:00:00 GMT date+4h: 2010-10-31 03:00:00 GMT date+5h: 2010-10-31 04:00:00 GMT date+6h: 2010-10-31 05:00:00 GMT -- Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem retrieving variables.
Paul Halliday wrote: I think I just might be missing the logic here. I have a page that is created and within this page, I include an iframe like this: $qp = urlencode($when $wFilter $aFilter); echo \rtrtd id=links colspan=2 style=\display:none; padding-left: 12px;\ \rIFRAME id=\links-frame\ name=\links-frame\ src=\edv.php?qp=$qp\ width=100% height=1000 frameborder=0 scrolling=no/IFRAME \r/td \r/tr; When I call edv.php though, I can't $qp = $_REQUEST['qp']; What am I missing? Thanks. Just below your urlencode() call in the parent script place echo $qp; to see if the value is what you expect? Then within edv.php add this var_dump($_REQUEST); and see if $_REQUEST['qp'] is there, and what it is. Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem retrieving variables.
On Thu, Sep 2, 2010 at 5:43 PM, Jim Lucas li...@cmsws.com wrote: Paul Halliday wrote: I think I just might be missing the logic here. I have a page that is created and within this page, I include an iframe like this: $qp = urlencode($when $wFilter $aFilter); echo \rtrtd id=links colspan=2 style=\display:none; padding-left: 12px;\ \rIFRAME id=\links-frame\ name=\links-frame\ src=\edv.php?qp=$qp\ width=100% height=1000 frameborder=0 scrolling=no/IFRAME \r/td \r/tr; When I call edv.php though, I can't $qp = $_REQUEST['qp']; What am I missing? Thanks. Just below your urlencode() call in the parent script place echo $qp; to see if the value is what you expect? Then within edv.php add this var_dump($_REQUEST); and see if $_REQUEST['qp'] is there, and what it is. Jim I think I see what I am doing wrong.. ... createlink function up here then... ?php $qp = $_REQUEST['qp'];? html body form id=edv method=post action=edv.php table width=100% border=0 cellpadding=1 cellspacing=0trtd align=left input onMouseOver=style.backgroundColor='#ff'; onMouseOut=style.backgroundColor='#DD'; id=links name=links type=submit value=create link graph style=font-size: 9px; border: none; border: .5pt solid #00; background:#DD; /td ?php echo $qp; if ($_REQUEST['links']) { CreateLink($qp); } ? /form /body /html I can't do what I am trying to do. Do I need to put it in a hidden field within the form and then re-request? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem when adding special characters to an XML file
Hi again, Now I download the editing XML file and open it in windows with notepad and save with utf-8 encode, then upload the file again and can see the correct characters, what's the problem? I'm specifying the correct encoding when process the form and editing the XML file: $XML = new DOMDocument('1.0', 'UTF-8'); Any idea please... Thanks, te0
Re: [PHP] Problem when adding special characters to an XML file
On 15 July 2010 12:01, te0t3l te0...@gmail.com wrote: Hi again, Now I download the editing XML file and open it in windows with notepad and save with utf-8 encode, then upload the file again and can see the correct characters, what's the problem? I'm specifying the correct encoding when process the form and editing the XML file: $XML = new DOMDocument('1.0', 'UTF-8'); Any idea please... Thanks, te0 Can you do a binary comparison between the 2 files (assuming you have an original). FC file1.xml file2.xml /b Or can you zip them both and I can take a look at them for you (email me directly). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem when adding special characters to an XML file
Thanks for your offer Richard, but I solved the problem deleting the UTF-8 encoding label in the XML file like this: before: ?xml version=1.0 encoding=utf-8? label/label after: ?xml version=1.0?
Re: [PHP] Problem with SOAP and authentication? SoapFault exception: [HTTP] Unauthorized
On 28 June 2010 22:37, robert mena robert.m...@gmail.com wrote: Hi, I'll have a look. I am using Zend Framework's Zend_Soap_Client which in turn uses SoapClient. I'll try to use SoapClient directly. I am not using https and I am not going through a proxy (using a non standard port). I've tested with another SOAP client (a standalone application called SoapUI) without a problem. Is there anyone using SoapClient (or Zend_Soap_Client) with auth with success? What other library (that does not use SoapClient) could I try? On Mon, Jun 28, 2010 at 6:27 AM, Richard Quadling rquadl...@gmail.com wrote: On 26 June 2010 23:46, robert mena robert.m...@gmail.com wrote: Hi, I am trying to access a webservice using php's soapclient but I keep getting the error SoapFault exception: [HTTP] Unauthorized If I try using a web browser I can authenticate using the same credentials used by the php code. I've searched but the only mention that I found led to a 'won't fix' bug registered to php 5.1.6. I am using 5.2.10. Any ideas of what may be causing this? Is there a workaround? Regards. Can you show the SoapClient construction you are using? The documentation says that you can supply HTTP authentication [1] ... For HTTP authentication, the login and password options can be used to supply credentials. For making an HTTP connection through a proxy server, the options proxy_host, proxy_port, proxy_login and proxy_password are also available. For HTTPS client certificate authentication use local_cert and passphrase options. An authentication may be supplied in the authentication option. The authentication method may be either SOAP_AUTHENTICATION_BASIC (default) or SOAP_AUTHENTICATION_DIGEST. There was recent activity on a Soap Authorisation Header bug [2]. If this issue is appropriate, you can try a building your code code from SVN (no win32 snapshots for a LONG time now). Regards, Richard. [1] http://docs.php.net/manual/en/soapclient.soapclient.php [2] http://bugs.php.net/bug.php?id=50976 -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling If you have got a working setup, then use a tool like WireShark to watch what is happening on the wire. You'll be able to see the exact conversation and see what headers are being sent and received. Ideally the requests should be as identical as possible (same criteria, security, etc.) to make the comparison easier. Richard. -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php