php-general Digest 15 Dec 2004 13:28:01 -0000 Issue 3171
Topics (messages 204371 through 204392):
Re: Good and free encoder for PHP5
204371 by: Octavian Rasnita
204376 by: Jon Drukman
Getting mail() to return false/0
204372 by: Paul Reinheimer
204375 by: Paul Reinheimer
204377 by: Travis Conway
204379 by: Paul Reinheimer
204382 by: Manuel Lemos
Re: PHP cross platform IDE
204373 by: Rory Browne
getting name of class from a parent
204374 by: Rory Browne
204385 by: Chris
Re: Loops (Thank you very much!)
204378 by: Steve Marquez
Re: php mysql codes insertion error.
204380 by: Jonathan
Re: scripting with php
204381 by: Matthew Weier O'Phinney
File locking & file_[get|put]_contents
204383 by: Gerard Samuel
Output buffering - saving + echoing
204384 by: Lorderon
register_user_func and register_shutdown_func
204386 by: Bostjan Skufca . domenca.com
204389 by: Bostjan Skufca . domenca.com
HTML_Template_Flexy or Smarty
204387 by: electroteque
Problem with PHP5, CGI and Session
204388 by: Markus Fischer
Re: Turn off "out of offfice" messages for the list, please
204390 by: Richard Davey
php graph?
204391 by: Jonathan
cURL FTP
204392 by: Lowell Allen
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Oh yeah but probably the problem is that it wasn't updated in order to work
with PHP 5.
Or does it does?
Teddy
----- Original Message -----
From: "Manuel Lemos" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, December 15, 2004 1:16 AM
Subject: [PHP] Re: Good and free encoder for PHP5
Hello,
M�rio gamito said the following on 12/14/2004 08:51 AM:
> Does anyone around here knows a *good* and *free* encoder for PHP5 ?
> I used to run Turck, but it seems that somehow it has been discontinued.
> (At least, the last release occured about a year ago).
Did it stop working? My Turck copy still works. ;-)
--
--- End Message ---
--- Begin Message ---
Octavian Rasnita wrote:
Does anyone around here knows a *good* and *free* encoder for PHP5 ?
I used to run Turck, but it seems that somehow it has been discontinued.
(At least, the last release occured about a year ago).
Did it stop working? My Turck copy still works. ;-)
turck never worked for me. in our very high traffic web environment
(hundreds of requests per second) turck would leak memory like crazy
until it eventually killed all the servers. i gave up on it. would
love to find a reliable replacement that can handle millions of requests
per day.
-jsd-
--- End Message ---
--- Begin Message ---
Hi,
I was working with the mail function today to experiment with sending
a few messages, and threw in the apropriate checks so when mail()
can't send the message the apropriate errors were raised, however, I
discovered I couldn't actually get mail() to return 0. Take the
following call:
mail("dude", "Daily Feed Update", "body");
When I run that exact call (well, I prepend echo, but you get the
idea) it returns 1. I can't for the life of me understand why my MTA
would accept an email with a destination of 'dude'.
Any thoughts?
paul
--
Paul Reinheimer
--- End Message ---
--- Begin Message ---
In the continuing trend of responding to my own messages.... Perhapps
the issue is with how I am interpreting the docs, which state:
mail() returns TRUE if the mail was successfully accepted for
delivery, FALSE otherwise.
I read that as, mail() will return true if PHP is able to connect to
the MTA, pass the message, and the MTA responds that the message was
accepted.
My understanding (or assumption) of how the MTA operates is that it
would not accept a message it did not know how to deliver, ie one with
an invalid destination address.
That being said, there is an article on builder.com with regards to
mail and PHP which states:
The mail() function will return true as long as it connects to the
specified SMTP server. This does not mean that the mail successfully
reached its intended recipient. The mail() function does not wait for
or report success/error codes from the SMTP server
Which contridicts my understanding of what the docs state, but
explains my predicament.
paul
On Tue, 14 Dec 2004 20:05:41 -0500, Paul Reinheimer
<[EMAIL PROTECTED]> wrote:
> Hi,
>
> I was working with the mail function today to experiment with sending
> a few messages, and threw in the apropriate checks so when mail()
> can't send the message the apropriate errors were raised, however, I
> discovered I couldn't actually get mail() to return 0. Take the
> following call:
> mail("dude", "Daily Feed Update", "body");
>
> When I run that exact call (well, I prepend echo, but you get the
> idea) it returns 1. I can't for the life of me understand why my MTA
> would accept an email with a destination of 'dude'.
>
> Any thoughts?
>
> paul
> --
> Paul Reinheimer
>
--
Paul Reinheimer
Zend Certified Engineer
--- End Message ---
--- Begin Message ---
----- Original Message -----
From: "Paul Reinheimer" <[EMAIL PROTECTED]>
Hi,
I was working with the mail function today to experiment with sending
a few messages, and threw in the apropriate checks so when mail()
can't send the message the apropriate errors were raised, however, I
discovered I couldn't actually get mail() to return 0. Take the
following call:
mail("dude", "Daily Feed Update", "body");
I assume "dude" is a local user you are mailing to? Make sure you also give
a FROM address. Try this:
mail("[EMAIL PROTECTED]", "Daily Feed Update", "body", "From:
[EMAIL PROTECTED]")
-Trav
When I run that exact call (well, I prepend echo, but you get the
idea) it returns 1. I can't for the life of me understand why my MTA
would accept an email with a destination of 'dude'.
Any thoughts?
paul
--
Paul Reinheimer
--- End Message ---
--- Begin Message ---
'dude' is in fact not a user on my box, I was in fact something I
choose trying to use as an example of something that was not valid.
Running it again against "asdadasdsadasdadsad" returns the same
result.
When I do send mail that matters I include a From header, I was just
trying to stick with as simple an example of what I expected not to
work as possible.
Ramil: I am surprised to hear that, as it directly contridicts what is
in the builder.com article, but supports my reading of the manual.
Hmm.
paul
On Tue, 14 Dec 2004 20:53:37 -0600, Travis Conway
<[EMAIL PROTECTED]> wrote:
>
> ----- Original Message -----
> From: "Paul Reinheimer" <[EMAIL PROTECTED]>
>
> > Hi,
> >
> > I was working with the mail function today to experiment with sending
> > a few messages, and threw in the apropriate checks so when mail()
> > can't send the message the apropriate errors were raised, however, I
> > discovered I couldn't actually get mail() to return 0. Take the
> > following call:
> > mail("dude", "Daily Feed Update", "body");
>
> I assume "dude" is a local user you are mailing to? Make sure you also give
> a FROM address. Try this:
>
> mail("[EMAIL PROTECTED]", "Daily Feed Update", "body", "From:
> [EMAIL PROTECTED]")
>
> -Trav
>
> >
> > When I run that exact call (well, I prepend echo, but you get the
> > idea) it returns 1. I can't for the life of me understand why my MTA
> > would accept an email with a destination of 'dude'.
> >
> > Any thoughts?
> >
> >
> >
> > paul
> > --
> > Paul Reinheimer
>
>
--
Paul Reinheimer
Zend Certified Engineer
--- End Message ---
--- Begin Message ---
Hello,
Paul Reinheimer said the following on 12/14/2004 11:49 PM:
I read that as, mail() will return true if PHP is able to connect to
the MTA, pass the message, and the MTA responds that the message was
accepted.
My understanding (or assumption) of how the MTA operates is that it
would not accept a message it did not know how to deliver, ie one with
an invalid destination address.
That being said, there is an article on builder.com with regards to
mail and PHP which states:
The mail() function will return true as long as it connects to the
specified SMTP server. This does not mean that the mail successfully
reached its intended recipient. The mail() function does not wait for
or report success/error codes from the SMTP server
This is not true under Unix/Linux as PHP does not establish an SMTP
connection. It only pipes the message to the sendmail program (or an
emulation). Sendmail may even try to deliver the message immediately but
if it fails it may retry later or the message bounces to the return
address, but the mail() function still returns true.
The mail function only returns false under Windows when the SMTP server
does not accept the message for relay for a variety of possible reasons.
Once the message is accepted for relay, even if the recipient address is
invalid, the message may end up bouncing later, but the mail function
still returns true.
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--- End Message ---
--- Begin Message ---
I use kdevelop. I'm not sure how cross-platform it is, since I've
never tried to get it working on a non-linux machine, but it should
run anywhere KDE will run. I'm not sure what you'd need to do to get
it running on Windows.
Vim is a text editor, albeit a very good one, but Not an IDE, even
though it has many IDE features.
I haven't used the Eclipse plugin yet. What's it like?
On Tue, 14 Dec 2004 16:51:06 -0600, Greg Donald <[EMAIL PROTECTED]> wrote:
> On Tue, 14 Dec 2004 22:17:57 +0100, Daniel Schierbeck <[EMAIL PROTECTED]>
> wrote:
> > And hey, Eclipse is free!
>
> So is vim.
>
> PHP explodes right on the screen for me, an IDE is so not required.
>
> --
> Greg Donald
> Zend Certified Engineer
> http://gdconsultants.com/
> http://destiney.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
Hi
I need a way to create an instance of a class, from a parent of that class.
Lets say I have the following code:
<?php
class base_class{
static function get_instance(){
// code I need goes here
}
}
class utility_class {
}
$instance = utility_class::get_instance()
?>
You may be wondering why I don't just " $instance = new utility_class
" - the reason is that I want to only create one of these instances. I
don't want any more than one instance of utility_class at any one
time.
I can't use get_class($this) either, because, there is no $this when
I'm accessing the method staticly.
Any suggestions?
--- End Message ---
--- Begin Message ---
I'm not sure I'm quite clear on what you want, ...
<?php
class base_class{
static function get_instance(){
static $oUtility = new utility_class();
return $oUtility;
}
}
class utility_class {
}
$instance = utility_class::get_instance()
?>
That should create an instance of utility_class the first time
::get_instance() is called, and just return it afterwards. I'm not
positive it will work, the relationship between the two objects, with
the parent instantiating it's own child, is quite complex.
Hope this was of some help.
Chris
Rory Browne wrote:
Hi
I need a way to create an instance of a class, from a parent of that class.
Lets say I have the following code:
<?php
class base_class{
static function get_instance(){
// code I need goes here
}
}
class utility_class {
}
$instance = utility_class::get_instance()
?>
You may be wondering why I don't just " $instance = new utility_class
" - the reason is that I want to only create one of these instances. I
don't want any more than one instance of utility_class at any one
time.
I can't use get_class($this) either, because, there is no $this when
I'm accessing the method staticly.
Any suggestions?
--- End Message ---
--- Begin Message ---
This is the code I went with and it works like a charm! Thank you very much
M. Sokolewicz!
echo "{$row['name']}<br />{$row['description']}";
would work, just like all of the following would also:
echo "$row[name]<br />$row[description]";
echo $row['name']."<br />".$row['description'];
and a couple of others
--
Steve Marquez
--- End Message ---
--- Begin Message ---
Found the problem.
I set ( default_charset = "iso-8859-1" ) in php.ini and it solve the
problem.
Just in case anyone want to know.
"Jonathan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> I have encounter something rather weird. In my development server,
>
> when I insert a string contain '&*%$, I got this in my mysql server '&*%$
> (i.e. the same)
>
> but in my application server, I got this �?T&*%$ in my mysql server (i.e.
'
> ==> �?T)
>
> anyone know how to resolve this? When I use the string to send out the
> email, I got the funny characters instead.
>
> Version Running
>
> development server
> mysql-server-3.23.58-9
> php-4.3.4
>
> application server:
> mysql-server-3.23.58-9
> php-4.3.8-2.1
--- End Message ---
--- Begin Message ---
* Bruno Santos <[EMAIL PROTECTED]>:
> since my first page, ive used php as a server side language, embebed in
> html pages. now, i need to develop a small script to run as stand alone.
> how can i do it ?
>
> just like bourn shell, ive used #!/usr/bin/php -q, but it apears is not
> working ...
Did you make the script executable...? Is the path to PHP correct? Did
you enclose all PHP commands within <?php ... ?> directives?
--
Matthew Weier O'Phinney | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
--- End Message ---
--- Begin Message ---
I was wondering.
Does file_get_contents() or file_put_contents() utilise
any kind of file locking?
Thanks
--- End Message ---
--- Begin Message ---
Hi,
When using ob_start(), the output is buffered and not sent till
ob_end_flush() is called or got to end of the script. Also before flushing
you can get the buffer contents by ob_get_contents().
<?
//start buffering, from now on no output.
//NEED: start buffering, but output imediatly when echo.
ob_start();
//this is not echoed now.
//NEED: echo this now, but still buffer it too.
echo "Hello, World!";
//getting the buffer contents.
//NEED: getting the buffer contents.
$buf=ob_get_contents();
//the buffer is echoed just now.
//NEED: stop the buffering, and not output all the buffer now.
ob_end_flush();
?>
What I want to do is "catch" the output buffer, but do not delay the buffer
to be sent. How is it done?
thanks in advance,
Lorderon.
--- End Message ---
--- Begin Message ---
Hi all,
is there any internal difference between following calls (they occur inside
some class)?
#1 register_shutdown_function(array($this, 'myfunc'));
#2 register_shutdown_function(array(&$this, 'myfunc'));
(note the reference operator in #2)
Or is parameter "$this" in example #1 forced to be taken as reference
internally, which makes both calls basically identical?
Thank you for your kind response.
Best regards,
Bostjan Skufca
--- End Message ---
--- Begin Message ---
It's ok,
I discovered that object (if not passed by reference explicitly) is first
duplicated (internally) and only then the method is called.
Proof code:
<?php
class myCls
{
var $myVar;
function myCls() { $this->myVar = 1; }
function myInc() { $this->myVar++; }
function myEcho() { echo "$this->myVar "; }
}
$myObj = new myCls();
$myObj->myEcho();
$myObj->myInc();
$myObj->myEcho();
call_user_func(array($myObj, 'myInc'));
$myObj->myEcho();
unset($myObj);
echo "\n";
$myObj = new myCls();
$myObj->myEcho();
$myObj->myInc();
$myObj->myEcho();
call_user_func(array(&$myObj, 'myInc'));
$myObj->myEcho();
?>
produces output:
1 2 2
1 2 3
On Wednesday 15 December 2004 08:28, Bostjan Skufca @ domenca.com wrote:
> Hi all,
>
> is there any internal difference between following calls (they occur inside
> some class)?
>
> #1 register_shutdown_function(array($this, 'myfunc'));
> #2 register_shutdown_function(array(&$this, 'myfunc'));
> (note the reference operator in #2)
>
> Or is parameter "$this" in example #1 forced to be taken as reference
> internally, which makes both calls basically identical?
>
>
> Thank you for your kind response.
>
>
> Best regards,
> Bostjan Skufca
--
Best regards,
Bostjan Skufca
system administrator
Domenca d.o.o.
Phone: +386 4 5835444
Fax: +386 4 5831999
http://www.domenca.com
--- End Message ---
--- Begin Message ---
hi there I am trying to choose between the two, which one is efficient,
but is also html programmer friendly and can still do template block
style templating like fasttemplate or phemplate. I am trying to move
people who have been using fasttemplate to a more efficient system,
although these two systems have logic inside the templating.
Let me know.
--- End Message ---
--- Begin Message ---
Hi,
I'm expiriencing a problem when I use my application with PHP5 as a CGI module
(this is due to my provider). I've developed and tested the application on two
servers, both using PHP5 as module, without problems.
It seems that the session gets malformed somehow during the first reuqest.
1) On the first request, the session itself is empty:
array(0) { }
2) On the second request, using session cookies, I see the initialized session
array:
array(1) { ["fru"]=> &array(1) { ["cache"]=> array(0) { } } }
But only as long as I'm in my applications constructor.
But as soon as my class' constructor returns, the session suddenly contains
another value:
object(Application)#1 (4) {
["db:protected"]=>
object(TsMySQLConnection)#2 (4) {
["conRes:private"]=>
[......]
The simplified code-flow is:
session.php
class MySession {
function __construct() {
session_start();
$_SESSION['app']['cache'] = array();
}
}
application.php
class Application {
protected $session;
function __construct() {
$this->session = new MySession();
}
}
index.php
require_once 'application.php';
$app = new Application;
# here, var_dump($_SESSION['fru']) outputs suddenly the
Application-class, instead of the empty array
$app->main();
I'm unable to find out the problem. It seems that after return from the
constructor the _SESSION is messed up and contains the object which I just
created newly.
Anyone expiriencing similiar problems?
regards,
- Markus
--- End Message ---
--- Begin Message ---
Hello John,
Wednesday, December 15, 2004, 12:43:43 AM, you wrote:
JH> I'm sure many of us will be taking some time off for the holidays (if
JH> you aren't already). Just a friendly reminder to either 1) unsubscribe
JH> while you're gone (you won't miss much, trust me) or 2) set your notice
Goodness me, next you'll be hoping people don't top-post above a stack
of quoted rubbish :)
Best regards,
Richard Davey
--
http://www.launchcode.co.uk - PHP Development Services
"I am not young enough to know everything." - Oscar Wilde
--- End Message ---
--- Begin Message ---
Hi,
Me new to PHP.
Is there any good and free php graph scripts/class that I can use to
generate graph like bar chart, pie chart and plots.
If you have any good recommendation, can email me at
[EMAIL PROTECTED]
Thanks.
Jonathan
--- End Message ---
--- Begin Message ---
I'm trying to FTP a text file from a commercial hosting server, but the
file isn't being transferred and I'm not getting any feedback from the
script. Here's the code:
$username = "whatever";
$password = "somepassword";
$remote_domain = "somedomain.com";
$remote_file_location = "/upload/testtransfer.txt";
$c =
curl_init("ftp://
$username:[EMAIL PROTECTED]");
$fh = fopen("test.txt", "r") or die($php_errormsg);
curl_setopt($c, CURL_UPLOAD, TRUE);
curl_setopt($c, CURL_TRANSFERTEXT, TRUE);
curl_setopt($c, CURL_INFILE, $fh);
curl_setopt($c, CURL_RETURNTRANSFER, TRUE);
$result = curl_exec($c);
curl_close($c);
echo("<p>".$result."</p>\n");
Running this produces nothing -- $result has no value and no file is
transferred. cURL is available on the server I'm sending from because I
use it successfully for a couple scripts. The "upload" directory has
permissions set to 777. The server I'm attempting to upload to runs in
a shared hosting environment. I've read what I think are the relevant
sections of the manual.
I'd appreciate info or links to info on setting up cURL to do an FTP
transfer and return the success or failure of the operation. Thanks.
--
Lowell Allen
--- End Message ---