php-general Digest 1 Jan 2006 14:29:26 -0000 Issue 3881

Topics (messages 228059 through 228068):

Re: Location ....
        228059 by: zerof

ternary operator in heredoc string
        228060 by: dev lamp
        228063 by: M. Sokolewicz

Re: unable to load perl extension
        228061 by: dev lamp

Re: php / mysql / js search result question
        228062 by: Drew Butler

COM Dlls not unbinding
        228064 by: Alex Turner

COM dlls not unbinding at script end
        228065 by: Alex Turner

Re: Managing upload files in multiple servers(pawns)
        228066 by: Srinadh Sannidhanam
        228067 by: Alex Turner

Re: HAPPY NEW YEAR!!
        228068 by: Julio B.

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:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Christian Ista escreveu:
Hello,

Could you tell me a efficient solution for change page (new location) in
PHP? I tried this code : header("Location: mypage.php");

-----
If you are at Apache environment, the best choice is to redirect 301 our 302 via .htaccess.

redirect 301 -> for pages/files permanently moved.
redirect 302 -> for pages/files temporaly moved.

Create one .htaccess ( or edit existing one ) at your root server.

Place the code line in the .htacess:


redirect 301 /folder_to/old_file.html http://www.yoursite.com/new_file.html

For a new redirect, skip one line.

Upload the .htaccess and try to reach the old file via browser.

----
zerof

--- End Message ---
--- Begin Message ---
Hi

I am trying to use the ternary operator inside heredoc string
to select the bgcolor based on the flag value, but it
does not seem to work.

$summary=<<<STR
<table width=100%>
<tr>
<td bgcolor={$reqstat ? green : red;}>$reqno</td>
</tr>
</table>
STR;

I looked up php documentation but could not find any details.

What would be an optimal way to write the code for the above situation ?

thanks
Dev.

--- End Message ---
--- Begin Message ---
dev lamp wrote:
Hi

I am trying to use the ternary operator inside heredoc string
to select the bgcolor based on the flag value, but it
does not seem to work.

$summary=<<<STR
<table width=100%>
<tr>
<td bgcolor={$reqstat ? green : red;}>$reqno</td>
</tr>
</table>
STR;

I looked up php documentation but could not find any details.

What would be an optimal way to write the code for the above situation ?

thanks
Dev.
$gr = $reqstat ? 'green' : 'red';
$summary=<<<STR
<table width=100%>
<tr>
<td bgcolor=$gr>$reqno</td>
</tr>
</table>
STR;

--- End Message ---
--- Begin Message ---
On 12/31/05, Richard Lynch <[EMAIL PROTECTED]> wrote:
> On Thu, December 29, 2005 9:17 am, dev lamp wrote:
> > Scenario 2:
> > the perl extension does not get loaded and the PHP script crashes.
>
> Define "crashes"...
>
> Does it literally crash the PHP/Apache process, or does it just print
> out "Not loaded"?
>

It just prints "Not loaded".

> Either way, crank up your error settings to E_ALL and check your
> Apache error log to find out *WHY* it's not getting loaded.
>
> Could you live with:
> <?php
>   exec("/usr/local/bin/perl script.pl", $output, $error);
>   $output = implode("<br />\n", $output);
>   if ($error) die("OS Error: $error<br />\n$output");
>   echo $output; //probably do something more interesting here
> ?>
>

Well, I would like to avoid this, since the PERL objects have to be used
and want to invoke methods.

thanks for your time.

thanks
Dev.

--- End Message ---
--- Begin Message ---
You're right when you say this has nothing to do with PHP. Well, mostly
right. I don't believe he is looking for a select box solution. I believe
what is being looked for is a Google Suggest style input box auto-complete
solution. Now you were right to say this is heavily dependant on JavaScript
or Flash (though flash would be a very bad soultion for this).

Check out this link: http://www.papermountain.org/demos/live/

It contains a tutorial for developing a JavaScript XMLHTTPRequest style
auto-complete input box. In fact, the liveUpdater tool that he uses is so
good that I ended up using it as a model for my own AJAX toolkit.

On 12/30/05, Richard Lynch <[EMAIL PROTECTED]> wrote:
>
> On Tue, December 27, 2005 2:03 am, Dave Carrera wrote:
> > I have a very long list of customer names which i know is easy to get
> > from a mysql result using php, no prob there.
>
> How long is very long?...
>
> > But what i would like to do is offer input box and when the user
> > enters
> > a letter, i think this will require client side onchange(), the full
> > list, i think might be in an iframe, will move to the first instance
> > of
> > user input.
> >
> > Example:
> >
> > 1 Alpha Customer
> > 2 Apple Customer
> > 3 Beta Customer
> > 4 Crazy customer
> > 5 Doppy customer
> >
> > User input is "a" so the list moves to first instance of "a".  User
> > continues to input "ap" so the list moves to "2 Apple Customer" and so
> > on.
>
> *IF* your visitor is using a decent browser and OS, then that's
> EXACTLY how this works:
>
> <select size="10">
>   <option>Alpha Customer</option>
>   <option>Apple Customer</option>
>   .
>   .
>   .
> </select>
>
> On crappy systems, only the FIRST letter they type "counts".  So they
> can jump to "A" but not to "Ap" for Apple.  Ugh.
>
> But you should not be dumping a VERY long list to the browser --
> Anything more than a few hundred (and that's pushing it) should
> probably not be in a list of choices.
>
> I've got one such list with 2000 in it, but ONLY for an Intranet where
> I know it's always high-bandwidth and trusted/trained users.
>
> At any rate, this is all browser side, and so it has NOTHING to do
> with PHP.
>
> You'll need to research JavaScript and Flash choices to get on to the
> browser side of things.
>
> I've also had good luck with giving an 'a b c d e ... z' and paging
> navigation for larger sets.  Up to a point.
>
> At some point, you really do need to have a search input box and go
> from there.
>
> --
> Like Music?
> http://l-i-e.com/artists.htm
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
Hi All,

I am doing a lot of PHP work with COM.  The system uses php 4.3.3.3 and php is 
being driven via FCGI from our own web server (TAG).

We create an instance of an in-process COM server using the following technique:

 function GetFactory()
 {
  static $obj;
  static $objSet = 0;
  if($objSet==0)
  {
   $obj=new COM("TPN_Obj.JDCom_Factory");
   $objSet=-1;
  }
  return $obj;
 }

The returned COM object is then used as a factory to all our other COM objects.

The snag is that the binding to the COM dll is not being released at the end of 
script execution.  This is visible using ProcessExplorer from SysInternals.

If I call com_release the returned ref-count is zero.  To ensure that php's 
garbage collector was not the culprit, I tried repeatedly calling com_release 
at the end of the script - no change.

The upshot of this issue is that each PHP process in the FCGI process pool 
gradually gets bigger as more and more dlls are bound :-(

Any ideas are welcome; I have gone through the php source but cannot quite 
figure the problem. Changing the C code is OK for our application.

Thanks!

 
Dr Alexander J Turner
Project Network
+44 (0) 7917 065072
Con Call: 0870 241 3425/3342654# 

--- End Message ---
--- Begin Message --- I am doing a lot of PHP work with COM. The system uses php 4.3.3.3 and php is being driven via FCGI from our own web server (TAG).

We create an instance of an in-process COM server using the following technique:

 function GetFactory()
 {
  static $obj;
  static $objSet = 0;
  if($objSet==0)
  {
   $obj=new COM("TPN_Obj.JDCom_Factory");
   $objSet=-1;
  }
  return $obj;
 }

The returned COM object is then used as a factory to all our other COM objects.

The snag is that the binding to the COM dll is not being released at the end of script execution. This is visible using ProcessExplorer from SysInternals.

If I call com_release the returned ref-count is zero. To ensure that php's garbage collector was not the culprit, I tried repeatedly calling com_release at the end of the script - no change.

The upshot of this issue is that each PHP process in the FCGI process pool gradually gets bigger as more and more dlls are bound :-(

Any ideas are welcome, I have gone through the php source but cannot quite figure the problem. As we are going over to our own build of 4.4.1
asap, a C level fix would be great :-)

Thanks!

--- End Message ---
--- Begin Message ---
Thanks Duncan,

 thanks for the suggestions, I will try them and come back..

 Please suggest me if you know any file synchronization tools over different
servers other than rsync. I like if syncronization triggers immediately
after uploading the file automatically rather than using cron.

Thanks,
S.Srinadh.

On 12/31/05, Duncan Hill <[EMAIL PROTECTED]> wrote:
>
> On Saturday 31 December 2005 02:06, Srinadh Sannidhanam wrote:
> > Hi All,
> >
> > We have a site in php and two web servers(pawns) to balance the load.
> > There is a page in the site through which user can upload images.
> >
> > When a user uploads an image, the request goes to only one of the two
> > servers.
> > So the image will be uploaded to only one server.
>
> Use a shared file system such as NFS for upload storage.
>
> Use some form of session management/balancing that ensures a client
> browser
> that upload ends up on the same server immediately afterwards, and use
> something like rsync to keep the image area in sync.
>
> Shared storage is probably the better bet - perhaps with clever code that
> tries a local disk first, then the shared storage if not found on
> local.  If
> found shared and not local, pull to local.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message --- Why not use php to copy the file over to the other box? You could do this either by ftp, nfs etc, or by making a the php script communicate with the upload script on the other box as though it was a client.

Cheers

AJ

Srinadh Sannidhanam wrote:
Thanks Duncan,

 thanks for the suggestions, I will try them and come back..

 Please suggest me if you know any file synchronization tools over different
servers other than rsync. I like if syncronization triggers immediately
after uploading the file automatically rather than using cron.

Thanks,
S.Srinadh.

On 12/31/05, Duncan Hill <[EMAIL PROTECTED]> wrote:
On Saturday 31 December 2005 02:06, Srinadh Sannidhanam wrote:
Hi All,

We have a site in php and two web servers(pawns) to balance the load.
There is a page in the site through which user can upload images.

When a user uploads an image, the request goes to only one of the two
servers.
So the image will be uploaded to only one server.
Use a shared file system such as NFS for upload storage.

Use some form of session management/balancing that ensures a client
browser
that upload ends up on the same server immediately afterwards, and use
something like rsync to keep the image area in sync.

Shared storage is probably the better bet - perhaps with clever code that
tries a local disk first, then the shared storage if not found on
local.  If
found shared and not local, pull to local.

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




--- End Message ---
--- Begin Message ---
Feliz año nuevo.

Saludos,

Julio Barroso

""Jesús Alain Rodríguez Santos"" <[EMAIL PROTECTED]> escribió en el 
mensaje news:[EMAIL PROTECTED]
Happy New Year for all.
I weish you the best in this new 2006.
Regards. Alain
-- 
Este mensaje ha sido analizado por MailScanner
en busca de virus y otros contenidos peligrosos,
y se considera que está limpio.

--- End Message ---

Reply via email to