php-general Digest 6 Dec 2005 15:19:17 -0000 Issue 3835

Topics (messages 226905 through 226932):

Re: GD Graph tutorial?
        226905 by: Gustavo Narea
        226915 by: Shaun

memory leaks with 5.1 and osx
        226906 by: Dan Rossi

configuring the CLI version of PHP
        226907 by: jonathan
        226908 by: Marco Kaiser

Unnecessary if statement? Programming technique
        226909 by: Steve McGill

help with preg_replace only part of the string
        226910 by: Georgi Ivanov
        226911 by: David Grant
        226912 by: Richard Heyes
        226916 by: Miles Thompson

what is better for performance?
        226913 by: Karel Kozlik

working
        226914 by: Roman Duriancik
        226917 by: Jay Blanchard

HTTP User Authentication Problems
        226918 by: Rahul S. Johari
        226929 by: Steve McGill

What software do you use for writing PHP?
        226919 by: Jeff McKeon
        226920 by: Jay Blanchard
        226921 by: David Grant
        226922 by: Michael Crute
        226923 by: David Grant
        226924 by: Torgny Bjers
        226925 by: £ukasz Hejnak
        226926 by: Chris Boget
        226927 by: Jeff McKeon
        226928 by: George Pitcher
        226930 by: Joe Harman
        226931 by: Gustavo Narea
        226932 by: John Nichel

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 ---
Hello, Ashley.

Ashley M. Kirchner wrote:
   Does anyone know of a good GD tutorial for creating graphs?

I like this one: http://www.nyphp.org/content/presentations/GDintro/

Regards.

--
Gustavo Narea.
PHP Documentation - Spanish Translation Team.
Valencia, Venezuela.

--- End Message ---
--- Begin Message ---
"Gustavo Narea" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hello, Ashley.
>
> Ashley M. Kirchner wrote:
>>    Does anyone know of a good GD tutorial for creating graphs?
>
> I like this one: http://www.nyphp.org/content/presentations/GDintro/
>
> Regards.
>
> -- 
> Gustavo Narea.
> PHP Documentation - Spanish Translation Team.
> Valencia, Venezuela.

Try this one:

http://www.maani.us/charts/index.php

I have used it and would recommend it. 

--- End Message ---
--- Begin Message --- Ive discovered these errors in the apache error logs, is this anything serious ? Is there hardlinks to the source ?

/usr/share/sources/php/php-5.1.1/Zend/zend_compile.c(1862) : Freeing 0x021B4E78 (140 bytes), script=thescript.php /usr/share/sources/php/php-5.1.1/Zend/zend_hash.c(248) : Actual location (location was relayed)

=== Total 5027 memory leaks detected ===

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

I'm not a sysadmin so I'm sorry if this sounds like a dumb question:

I have a powerbook running 10.4 which has php installed correctly for the webserver. However, for the CLI version, it is 4.3.11. How best could I specify the correct version of php for the CLI (either switching via configuration file or at runtime of the script)?

When I do  "sudo find / -name php -print" , I get the following:

/usr/bin/php
/usr/include/php
/usr/lib/php

How would I know which version in which?

-jon

--- End Message ---
--- Begin Message ---
Hi Jonathan,

/usr/bin/php
> /usr/include/php
> /usr/lib/php
>
> How would I know which version in which?


"which php" should tell where your phpcli binary are.
php -v should tell you which php version you are running.


--
Marco Kaiser

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

Quick question:

If I have such a loop:

<?
for($i=0;$i<1000000;$i++) {
  if($i==100) {
    // do something special for this occurence
  }
  // do something standard
}
?>

In this case it seems such a waste that the if() statement is done 999999 
times when it's not needed. Is there any obvious trick that I am missing? 
I'm not sure how taxing a simple if() statement is on a server, maybe it's 
negligible, or is it something to worry about?

Something which I'd prefer NOT to do:

<?
for($i=0;$i<100;$i++) {
  // do something standard
}

// do something special for $i = 100

for($i=101;$i<1000000;$i++) {
  // do something standard
}
?>

as I would have have to either keep two copies of the code or write a 
function just for this purpose, which hardly seems worth it.

Thanks to anyone who takes the time to think about my question and/or 
respond.

Best wishes,

Steve McGill 

--- End Message ---
--- Begin Message ---
Hi,
I want to replace the content of html links : <a href="foo" 
name="bla">REPLACETHIS</a>.

$html=preg_replace("/(<a.*name=.*>)(.*)<\/a>/isU",$link,$html,1);
This generally works but removes <a>,</a> tags too.
How to make it work without removing anything else than (.*) in the middle of 
<a>.*</a>

Thanks in advance.

--- End Message ---
--- Begin Message ---
Replace the middle (.*) with ([^<]*).  This tells the regex engine to
ignore new opening tags.

Cheers,

David

Georgi Ivanov wrote:
> Hi,
> I want to replace the content of html links : <a href="foo" 
> name="bla">REPLACETHIS</a>.
> 
> $html=preg_replace("/(<a.*name=.*>)(.*)<\/a>/isU",$link,$html,1);
> This generally works but removes <a>,</a> tags too.
> How to make it work without removing anything else than (.*) in the middle of 
> <a>.*</a>
> 
> Thanks in advance.
> 


-- 
David Grant
http://www.grant.org.uk/

--- End Message ---
--- Begin Message ---
Georgi Ivanov wrote:
Hi,
I want to replace the content of html links : <a href="foo" name="bla">REPLACETHIS</a>.

$html=preg_replace("/(<a.*name=.*>)(.*)<\/a>/isU",$link,$html,1);
This generally works but removes <a>,</a> tags too.
How to make it work without removing anything else than (.*) in the middle of <a>.*</a>

$html = preg_replace("/(<a.*name=.*>)(.*)<\/a>/isU", '\1' . $link . '</a>', $html, 1);

--
Richard Heyes
http://www.phpguru.org

--- End Message ---
--- Begin Message ---
At 07:06 AM 12/6/2005, Richard Heyes wrote:
Georgi Ivanov wrote:
Hi,
I want to replace the content of html links : <a href="foo" name="bla">REPLACETHIS</a>.
$html=preg_replace("/(<a.*name=.*>)(.*)<\/a>/isU",$link,$html,1);
This generally works but removes <a>,</a> tags too.
How to make it work without removing anything else than (.*) in the middle of <a>.*</a>

$html = preg_replace("/(<a.*name=.*>)(.*)<\/a>/isU", '\1' . $link . '</a>', $html, 1);

--
Richard Heyes
http://www.phpguru.org

If you know what you are replacing, i.e. REPLACETHIS is a placeholder, str_replace() or substr_replace() are much simpler.

Miles Thompson

--- End Message ---
--- Begin Message ---
 Hi,
I am just thinking about that what is better for storeing structured variables in point of view of performance.

Is better store structured variables in associative array, for example:

$person['first_name'] = 'Karel';
$person['last_name'] = 'Kozlik';
$person['address'] = 'somewhere on Earth';

or in object like this:

$person->first_name = 'Karel';
$person->last_name = 'Kozlik';
$person->address = 'somewhere on Earth';

I feel that objects are better for performance, but work with associative arrays is pleasanter for me. May be the diference in performance measurable? (in heavy loaded environment)

thanks Karel

--- End Message ---
--- Begin Message --- Does it this forum exist ? Because i haven't any comunications from this forum last 6 days.
roman

--- End Message ---
--- Begin Message ---
it is working just fine

-----Original Message-----
From: Roman Duriancik [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 06, 2005 7:12 AM
To: [email protected]
Subject: [PHP] working


Does it this forum  exist ? Because i haven't any comunications from 
this forum last 6 days.
roman

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

--- End Message ---
--- Begin Message ---
Ave,

I¹m trying to run this very simple HTTP user authentication script:

<?php
  if (!isset($_SERVER['PHP_AUTH_USER'])) {
    header('WWW-Authenticate: Basic realm="Private"');
    header('HTTP/1.0 401 Unauthorized');
    echo 'Unauthorized';
    exit;
  } else {
    
    if(($_SERVER['PHP_AUTH_USER']=="try") &&
($_SERVER['PHP_AUTH_PW']=="try")) {
    ?>

<HTML>
<HEAD></HEAD>
<BODY>
My Stuff Goes Here!
</BODY>
</HTML>

    
    <?
    }
    else {
    echo "Access Denied";
    }
  }
?>

The problem is, this script runs perfectly fine on my localhost machine at
home, however it¹s not working on my web server (purchased webhosting). When
I open this page on my web site, it does bring up the popup box asking for
Username & Password ­ the problem is, even if I type the correct user/pass,
it won¹t accept it. It keeps asking me for user/pass again and again and
finally brings up the ³Unauthorized² text on the page.

Why won¹t it allow the correct user/pass to login? I don¹t understand.

The only difference between the PHP on my localhost and the PHP on my
webhost server is that my local machine is running PHP 5 and the webhost
server is running PHP 4.4.1

Thanks,

Rahul S. Johari
Coordinator, Internet & Administration
Informed Marketing Services Inc.
251 River Street
Troy, NY 12180

Tel: (518) 266-0909 x154
Fax: (518) 266-0909
Email: [EMAIL PROTECTED]
http://www.informed-sources.com



--- End Message ---
--- Begin Message ---
Hi Rahul,

Try doing a print_r($_SERVER) to see if the variables are being set.

If they aren't, take a look at the phpinfo(); -> chances are your host is 
using a CGI binary version of PHP to use together with a security wrapper 
like suPHP or phpSuExec, which might throw away the variables that you 
require.

Steve

""Rahul S. Johari"" <[EMAIL PROTECTED]> schreef in bericht 
news:[EMAIL PROTECTED]

Ave,

I¹m trying to run this very simple HTTP user authentication script:

<?php
  if (!isset($_SERVER['PHP_AUTH_USER'])) {
    header('WWW-Authenticate: Basic realm="Private"');
    header('HTTP/1.0 401 Unauthorized');
    echo 'Unauthorized';
    exit;
  } else {

    if(($_SERVER['PHP_AUTH_USER']=="try") &&
($_SERVER['PHP_AUTH_PW']=="try")) {
    ?>

<HTML>
<HEAD></HEAD>
<BODY>
My Stuff Goes Here!
</BODY>
</HTML>


    <?
    }
    else {
    echo "Access Denied";
    }
  }
?>

The problem is, this script runs perfectly fine on my localhost machine at
home, however it¹s not working on my web server (purchased webhosting). When
I open this page on my web site, it does bring up the popup box asking for
Username & Password ­ the problem is, even if I type the correct user/pass,
it won¹t accept it. It keeps asking me for user/pass again and again and
finally brings up the ³Unauthorized² text on the page.

Why won¹t it allow the correct user/pass to login? I don¹t understand.

The only difference between the PHP on my localhost and the PHP on my
webhost server is that my local machine is running PHP 5 and the webhost
server is running PHP 4.4.1 

--- End Message ---
--- Begin Message ---
Hey all,

Forever now I've been using Frontpage for all my web work including php.
I'm sure there's better software out there that is more suited to
writing and editing PHP pages.  What do you all use?

Thanks,

Jeff

--- End Message ---
--- Begin Message ---
[snip]
Forever now I've been using Frontpage for all my web work including php.
I'm sure there's better software out there that is more suited to
writing and editing PHP pages.  What do you all use?
[/snip]

I use Eclipse and HTML-Kit

--- End Message ---
--- Begin Message ---
Jeff,

Jeff McKeon wrote:
> Forever now I've been using Frontpage for all my web work including php.
> I'm sure there's better software out there that is more suited to
> writing and editing PHP pages.  What do you all use?

I use Zend Studio 5, but there are plenty of other (cheaper) options.
Take a look at the following link for a list of editors with reviews.

http://www.php-editors.com/review/

Cheers,

David Grant
-- 
David Grant
http://www.grant.org.uk/

--- End Message ---
--- Begin Message ---
On 12/6/05, Jeff McKeon <[EMAIL PROTECTED]> wrote:
> Hey all,
>
> Forever now I've been using Frontpage for all my web work including php.
> I'm sure there's better software out there that is more suited to
> writing and editing PHP pages.  What do you all use?
>
> Thanks,
>
> Jeff

Actually, there isn't much WORSE than FrontPage for any kind of
coding. My personal favorite for projects at work is Eclipse with
phpEclipse plugin and at home I use vim almost exclusively.

-Mike

--
________________________________
Michael E. Crute
Software Developer
SoftGroup Development Corporation

Linux takes junk and turns it into something useful.
Windows takes something useful and turns it into junk.

--- End Message ---
--- Begin Message ---
Hi Jeff,

Jeff McKeon wrote:
> What is it you like about Zend Studio?

* Code completion
* Syntax highlighting for PHP, HTML and CSS
* Manual pages
* Debugging
* Code examination
* PHPDoc
* CVS & SVN support

Cheers,

David
-- 
David Grant
http://www.grant.org.uk/

--- End Message ---
--- Begin Message ---
Quoting Michael Crute <[EMAIL PROTECTED]>:

On 12/6/05, Jeff McKeon <[EMAIL PROTECTED]> wrote:
Hey all,

Forever now I've been using Frontpage for all my web work including php.
I'm sure there's better software out there that is more suited to
writing and editing PHP pages.  What do you all use?

Thanks,

Jeff

Actually, there isn't much WORSE than FrontPage for any kind of
coding. My personal favorite for projects at work is Eclipse with
phpEclipse plugin and at home I use vim almost exclusively.

I recommend Zend Studio if you can afford it since it has a GUI for both Windows
and Linux, and it runs fairly fast for being a Java application. ;)

I agree with Mike, pretty much anything is better than FrontPage for editing web
pages.  If you're going to be changing both HTML and PHP, Zend works fine, but
if you want something with less features but with all the important stuff such
as syntax highlighting, multiple window buffers, and all that shebang, go for
EditPlus www.editplus.com or UltraEdit www.ultraedit.com, I prefer EditPlus
over most such "simpler" editors on Windows, and on Linux I use Jed, which has
good menu handling and Windows-like shortcuts that speed up the work. I tend to
get slightly confused when working 95% in Windows and then having to edit
something in vim or emacs.

Just my two cents...


--- End Message ---
--- Begin Message ---
Jeff McKeon napisał(a):
Hey all,

Forever now I've been using Frontpage for all my web work including php.
I'm sure there's better software out there that is more suited to
writing and editing PHP pages.  What do you all use?

I use Bluefish, it's a very nice GTK+ based editor, with all types of code highlightning (html, php, c/c++, pascal, java, python are just a part of it). And that's pretty much all the features of it I use, maybe also the well written replace method. Besides that I use it as a typical text editor, I'm not too keen on template's.

--
Best wishes
Łukasz Hejnak

--- End Message ---
--- Begin Message ---
Forever now I've been using Frontpage for all my web work including php.
I'm sure there's better software out there that is more suited to
writing and editing PHP pages.  What do you all use?

I use Visual SlickEdit.  You should check it out; it's a very powerful IDE.
http://www.slickedit.com

thnx,
Chris

--- End Message ---
--- Begin Message ---
What is it you like about Zend Studio?

Jeff

> -----Original Message-----
> From: David Grant [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, December 06, 2005 09:19
> To: Jeff McKeon
> Cc: php
> Subject: Re: [PHP] What software do you use for writing PHP?
> 
> 
> Jeff,
> 
> Jeff McKeon wrote:
> > Forever now I've been using Frontpage for all my web work including 
> > php. I'm sure there's better software out there that is 
> more suited to 
> > writing and editing PHP pages.  What do you all use?
> 
> I use Zend Studio 5, but there are plenty of other (cheaper) 
> options. Take a look at the following link for a list of 
> editors with reviews.
> 
http://www.php-editors.com/review/

Cheers,

David Grant
-- 

David Grant
http://www.grant.org.uk/

--- End Message ---
--- Begin Message ---
I've used Dreamweaver MX, working with 9 remote sites, shared between IIS
and Apache.

George

> -----Original Message-----
> From: Jeff McKeon [mailto:[EMAIL PROTECTED]
> Sent: 6 December 2005 2:15 pm
> To: php
> Subject: [PHP] What software do you use for writing PHP?
>
>
> Hey all,
>
> Forever now I've been using Frontpage for all my web work including php.
> I'm sure there's better software out there that is more suited to
> writing and editing PHP pages.  What do you all use?
>
> Thanks,
>
> Jeff
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
I have to say Dreamweaver MX also.... it's a great all around tool for
developing sites... while it may not have all the features and be as
PHP specific  as Zend it gets the job done. I've learned that it's
just a personal preference.... the best coder i've ever met used note
pad.... LOL

Joe


On 12/6/05, George Pitcher <[EMAIL PROTECTED]> wrote:
> I've used Dreamweaver MX, working with 9 remote sites, shared between IIS
> and Apache.
>
> George
>
> > -----Original Message-----
> > From: Jeff McKeon [mailto:[EMAIL PROTECTED]
> > Sent: 6 December 2005 2:15 pm
> > To: php
> > Subject: [PHP] What software do you use for writing PHP?
> >
> >
> > Hey all,
> >
> > Forever now I've been using Frontpage for all my web work including php.
> > I'm sure there's better software out there that is more suited to
> > writing and editing PHP pages.  What do you all use?
> >
> > Thanks,
> >
> > Jeff
> >
> > --
> > 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
>
>


--
Joe Harman
---------
* My programs never have bugs, they just develop random features.

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

£ukasz Hejnak wrote:
I use Bluefish, it's a very nice GTK+ based editor, with all types of code highlightning (html, php, c/c++, pascal, java, python are just a part of it). And that's pretty much all the features of it I use, maybe also the well written replace method. Besides that I use it as a typical text editor, I'm not too keen on template's.

I use Bluefish too and I like it, but I admit that the syntax highlighting cannot be worst: I have to press F5 when I type quotation marks in PHP.

I think I'll switch to eclipse.

If you're using Windows, I suggest you to use Macromedia Dreamweaver.

Cheers.

--
Gustavo Narea.
PHP Documentation - Spanish Translation Team.
Valencia, Venezuela.

--- End Message ---
--- Begin Message ---
Jeff McKeon wrote:
Hey all,

Forever now I've been using Frontpage for all my web work including php.
I'm sure there's better software out there that is more suited to
writing and editing PHP pages.  What do you all use?

Now: Zend Studio
In The Past : Quanta, Komodo

When I Still In Hell (Like Jay is now) : UltraEdit32

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

--- End Message ---

Reply via email to