[PHP] Creating my own External Module for PHP

2002-12-24 Thread Leon Mergen
Hello,

I have a little question to which I hope to find an anwser in here.
Currently, I have a big script which receives approx 1.5 million hits every
day. Since this script does some common calculations that underlying scripts
use, I want to rewrite this into C and initially make it an external module
for beta testing and then eventually compile it directly into PHP.

Now, I got this really good book, Web Application Development with PHP by
Ratschiller and Gerken. It has a complete chapter devoted to "hacking the
core of PHP" which shows how to create extensions.

Now, they describe 2 common ways of hacking the core... making a shared
object (which is what I want at this point) , or compiling the extension
right into the core. They decribe how to make your extension with
~/ext/ext_skel , but they don't describe which steps to take when you only
want to make a shared object... the only thing they say is "at this point,
you should have a new PHP binary or a .so file" ... but they never gave any
indication how to chose... they just asume you want a new php binary or sth.

Now, can anyone provide me with a few brief description (a few steps) how to
make your own dynamically loadable module in PHP?

Thanks in advance.

Regards,

Leon Mergen



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




Re: [PHP] Creating my own External Module for PHP

2002-12-24 Thread Leon Mergen
Hey! That worked!

Thanks Rasmus!

Grtz,

Leon Mergen

"Rasmus Lerdorf" <[EMAIL PROTECTED]> schreef in bericht
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Just run phpize in your directory and then do a ./configure && make
> If your config.m4 was correct you should now have a modules/foo.so in your
> dir.
>
> -Rasmus
>
> On Tue, 24 Dec 2002, Leon Mergen wrote:
>
> > Hello,
> >
> > I have a little question to which I hope to find an anwser in here.
> > Currently, I have a big script which receives approx 1.5 million hits
every
> > day. Since this script does some common calculations that underlying
scripts
> > use, I want to rewrite this into C and initially make it an external
module
> > for beta testing and then eventually compile it directly into PHP.
> >
> > Now, I got this really good book, Web Application Development with PHP
by
> > Ratschiller and Gerken. It has a complete chapter devoted to "hacking
the
> > core of PHP" which shows how to create extensions.
> >
> > Now, they describe 2 common ways of hacking the core... making a shared
> > object (which is what I want at this point) , or compiling the extension
> > right into the core. They decribe how to make your extension with
> > ~/ext/ext_skel , but they don't describe which steps to take when you
only
> > want to make a shared object... the only thing they say is "at this
point,
> > you should have a new PHP binary or a .so file" ... but they never gave
any
> > indication how to chose... they just asume you want a new php binary or
sth.
> >
> > Now, can anyone provide me with a few brief description (a few steps)
how to
> > make your own dynamically loadable module in PHP?
> >
> > Thanks in advance.
> >
> > Regards,
> >
> > Leon Mergen
> >
> >
> >
> > --
> > 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] How To Get Last Item Of An Array?

2002-12-25 Thread Leon Mergen

"John W. Holmes" <[EMAIL PROTECTED]> schreef in bericht
000401c2ac54$142032c0$7c02a8c0@coconut">news:000401c2ac54$142032c0$7c02a8c0@coconut...
> Kind of begs the question of why can't you just select what you need
> with the proper query, instead of loading everything into an array...

Yeah, just add limit 0,1 desc to the query



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




[PHP] Re: ImageCreateFromPNG

2003-01-03 Thread Leon Mergen
You haven't compiled PHP with png support.

"Roy Van Arem" <[EMAIL PROTECTED]> schreef in bericht
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> ImageCreateFromPNG does not work ...
> I use php4.3 on win2000 and ImageCreateFromPNG give an error...
> undefined function... how is that possible... can someone help me



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




[PHP] Re: include/require vs performance

2003-01-03 Thread Leon Mergen

"Radek Zajkowski" <[EMAIL PROTECTED]> schreef in bericht
news:[EMAIL PROTECTED]...
> Is there, was there ever issue around including a lot files via
> include(). I am running things on a local server so it's hard to gauge.

I think that the only source that could cause any problems with too many
files included will be your operating system (since that thing has certain
limitations on a max number of locked files for example) . Other than that,
I don't think so. I myself include about 15 files on certain pages. But it
is easy to make a test or anything...

Just make a PHP script that generates like 1000 php scripts called
"include.test.x.php" , where x is is a number, then the contents of those
scripts should by "" or
something like that...

Then you are for sure, and you immediately also know how much performance is
lost for including 1000 files :)



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




Re: [PHP] Re: include/require vs performance

2003-01-03 Thread Leon Mergen

"Stephan Seidt" <[EMAIL PROTECTED]> schreef in bericht
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I guess that PHP will close file 1 before it opens
> file 2 and so on.. For example :
>
> include 'foo';
> include 'bar';
>
> When bar is being opened foo is already closed.

Hmmm, i think the parser is built recursive, so at the moment it sees an
"include 'foo';" , it will look in foo, parse that one, and after it has
finished foo, it will continue with the main script...



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




[PHP] Re: PHP vs. ASP

2003-01-04 Thread Leon Mergen

"Anthony Rodriguez" <[EMAIL PROTECTED]> schreef in bericht
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> How does PHP differs from ASP?

search google on "php vs asp" ...



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




[PHP] Re: Text editors

2003-01-07 Thread Leon Mergen
www.editplus.com


"Karl James" <[EMAIL PROTECTED]> wrote in message
007f01c2b633$7b746c50$cc6c2f04@karle8hnwwmn0f">news:007f01c2b633$7b746c50$cc6c2f04@karle8hnwwmn0f...
Hello guys,
Right now im using dreamweaver mx

I was wondering if anyone knew of any good free text editors that has
line counts
And is good for php….

Thanks
karl

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.434 / Virus Database: 243 - Release Date: 12/25/2002





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




[PHP] Re: difference between shared and /usr/bin/mysql

2003-01-15 Thread Leon Mergen

"Gamin" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> ./configure --with-mysql=shared
> ./configure --with-mysql=/usr/bin/mysql
> What are the advantages/disadvatages of using either.

Somebody correct me if I'm wrong, but from what I know is that when using
shared it is compiled as a shared object and only loaded when needed. This
decreases ram usage (which is good) , but increases load (which is bad) .

If you have a few spare kb's of ram, I wouldn't recommend using shared...



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




[PHP] Re: All Request to the same script

2003-01-15 Thread Leon Mergen

<[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]..
.
> Is it possible to send all incoming requests to the same script within
> PHP?
> In other words: How can I get http://mysite/script.php to point to the
> same script as http://mysite/anotherscript.php ? And is it possible to do
> send a request like
> http://mysite/someextrapathinfo to the same php script?
> The background behind it is to create a controler that handles all
> incoming requests and dispatches them to different worker scripts as
> nessecary.

If you're using unix, use ln... type "man ln" for a manual...



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




[PHP] Re: Ever complained about lousy PHP programmers?

2003-01-16 Thread Leon Mergen

"Peter Hutnick" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'm soliciting comments on style, technique, etc.  Be brutal, but don't
> get your feelings hurt if I don't take your comments as gospel.
> References will help me take comments to heart.

Heck, I don't have anything better to do at the moment anyway. All I can say
in first, I will not judge your style - it's all up to you.

Now, first of all, why did you this:

"); ?>

and not just:



? Less parsing for PHP :P

But other than that, I couldn't find anything very wrong about it... only
that I personally prefer to call a print() statement for everything, and
don't use PHP as an embedded language but just as a normal programming
language... But that's just me :P

Hope this helps you a little bit...

Regards,

Leon Mergen
http://www.antrophia.com/




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




Re: [PHP] How know how many sessions are active?

2003-01-19 Thread Leon Mergen

To help even more, if you're on a dedicated, this shell command will provide
you the amount of sessions active:

"ls -l /tmp/sess* | wc -l"

HTH

"Justin French" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
If you're on a dedicated server (no other sites on the server), you could
just count the session files in /tmp.

Otherwise, the general consensus seems to be that you need to decide how
long a user is "active" for (say a minute, or 3, or an hour?), and save (eg)
the SID and timestamp in a file or MySQL table.

In theory, you then count the number of sessions that were created or
reactivated (restamped) within your definition of "active" time (eg 3 mins).


This has been discussed waaay too many time on the list... do a search on
the archives for 'active users', perhaps also try a search with the word
"ASP" too :)


Justin


on 19/01/03 10:27 PM, Jeremías Grunge ([EMAIL PROTECTED]) wrote:

> Sorry I'm novice.
>
> There is a way to know how many sessions are active and to get variables
or
> the id of them?
>
> Thanks
>
>




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




Re: [PHP] Input field array ends up as "Array" string

2003-01-21 Thread Leon Mergen

"Rick Emery" <[EMAIL PROTECTED]> wrote in message
024801c2c15b$1a770e70$0500a8c0@honeybee">news:024801c2c15b$1a770e70$0500a8c0@honeybee...
> show us code

Learn how to quote. :)



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




[PHP] Re: question about taking post to session

2002-09-21 Thread Leon Mergen


"Randy Johnson" <[EMAIL PROTECTED]> wrote in message
000901c2613d$e9223e30$c100a8c0@rjmarket">news:000901c2613d$e9223e30$c100a8c0@rjmarket...
> how could i take all the variables in $_POST[""] and move them to
> $_SESSION[""]?

If I understand correct, you will want something like this:



And now, in all the scripts on your site, when you execute the
session_start() function, $_SESSION["var"] contains the original contents of
$_POST["var"] .

Grtz,

Leon



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




[PHP] Re: $_SESSION[] and register_globals=on

2002-09-27 Thread Leon Mergen


"Andre Dubuc" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> A short question:
>
> My IP informed me that they have register_globals=on in their php.ini. Is
> this going to cause problems with my scripts that were written  using
$_POST,
> $_SESSION, etc?

No, if everything is setup correctly both will work now. Otherwise, a lot of
websites would have many many problems with the transition phase between
register_globals = on and register_globals = off.

Grtz,

Leon



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




[PHP] Array into database

2002-06-11 Thread Leon Mergen

Hello,

I would like to know wether it's possible to put an array into a database?
If not, what is the best way to archieve something like that?

Thanks in advance,

Leon Mergen



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




Re: [PHP] Array into database

2002-06-11 Thread Leon Mergen

So this would handle 2-demensional arrays too?

So, if I have

$array = (
"foo" => "bar",
"wom" => "bat"
);


it would work?

And darn, that I didn't come up with this (I'm familliar with Java, and they
use Serializable) ...

"Stuart Dallas" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Tuesday, June 11, 2002 at 10:25:36 PM, you wrote:
> > I would like to know wether it's possible to put an array into a
database?
> > If not, what is the best way to archieve something like that?
>
> Yes it is. See http://www.php.net/serialize
>
> --
> Stuart
>



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




Re: [PHP] Array into database

2002-06-11 Thread Leon Mergen


"Stuart Dallas" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> As far as I know, serialize will handle multi-dimensional arrays. If I
were you
> I would suck it and see.

And how should I store a serialized variable in my database? As String or as
Blob?



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




[PHP] Array questions...

2002-06-12 Thread Leon Mergen

Hello,

Assume I have the following array:

$array = array (
 "apple" => "cherry",
 "foo" => "bar",
 "wom" => "bat"
);

How could I easy remove the key and the value of the key "foo" from that
array?

Also, what is the best (and quickest) way to add a key with a value to the
end of this array?

Thanks in advance,

Leon Mergen



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




[PHP] Re: sending 1000 emails to subscribed members via php?

2002-06-12 Thread Leon Mergen


"Andy" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Anyway what do I do if I would have 1 members. This might take lots
of
> > cpu?! So I would like to keep it via my webinterface, but be able to
email
> > to all members.

Hello Andy,

My suggestion is to just make a HTML file, do an auto-refresh or sth to the
url with a variable ?start=$x , and make that refresh after 2 seconds...
your php script sends emails to 25 people per cycle, and you just walk away
from your computer and let it run for a few minutes...

I do that for my mailing list which is over 30,000 people large...

If you don't have the time to build something like that, there's always the
BCC option ;)

Hope this helps you.

Regards,

Leon Mergen



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




[PHP] unset($array[value]) does not work?

2002-06-12 Thread Leon Mergen

Hello,

I am currently testing out some things with removing elements from arrays,
and I find it strange that the following statement does not work for me:

unset($array['element'])

I wrote a little test script, you can see the source at
http://www.antrophia.com/test.txt and the executable at
http://www.antrophia.com/test.php ... Now, if you look at the last part:

unset ($unserialized['foo']);
if (key_exists("foo", $unserialized)) { echo "foo exists!\n"; }
if (key_exists("wom", $unserialized)) { echo "wom exists!\n\n"; }

You will see that $unserialized['foo'] still exists! Can anyone explain me
what I'm doing wrong?

Thanks in advance,

Leon Mergen



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




[PHP] Re: Querying for MAX

2002-06-12 Thread Leon Mergen

select max(id) as amount from table

"César aracena" <[EMAIL PROTECTED]> wrote in message
003301c21240$0cdcf790$89c405c8@gateway">news:003301c21240$0cdcf790$89c405c8@gateway...
I'm sorry if this mensaje is posted twice. I sent it yesterdays, but
then my ISP had problems with e-mail and I lost dozens of them and don't
know if sent OK.


Hi all,

What I'm trying to do here is not inside PHP nor MySQL books I have. I
need to query the DB to look the max result in a column. That is, if I
have affiliate members with ID going from 1 to 10, get the query to know
that the last member added was 10 so I can add member 11 without using
auto_increment, because I need to insert old members too which already
have ID numbers. Is that possible?

Thanks in advance,


Cesar Aracena 
CE / MCSE+I
Neuquen, Argentina
+54.299.6356688
+54.299.4466621






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




[PHP] Re: php-speed

2002-06-13 Thread Leon Mergen


"Philipp Melab" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> - embedding PHP in HTML
> - or printing HTML via PHP

With embedding PHP in HTML, do you mean using server side includes or do you
mean by having a .php file and having a layout like this:









Regards,

Leon Mergen



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




[PHP] Re: php-speed

2002-06-13 Thread Leon Mergen


"Philipp Melab" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Yes, Ithought that embedding must be faster too. But I was confused
because
> in nearly every PHP-Beginner Tutorial/Book I've seen the Hello-World
> Example looks like this:
>
>  echo "";
> echo "";
> echo "...";
> echo "";
>
> echo "";
> echo "Hello World!";
> echo "";
> echo "";
> ?>

Hello Philipp,

I think that must be because it's the most easy to explain... It's very easy
for people having experience with Perl, since Perl works that way...

I personally only use templates (I even wrote a caching template engine) ,
so that would be the last step in layout I think ;)

Regards,

Leon Mergen



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




[PHP] Strange url include problem

2002-07-01 Thread Leon Mergen

Hello,

I'm having a little bit problems with including an url into my page...

When I do this:

include ("http://www.google.com/search?q=test&ie=UTF-8&oe=UTF8&hl=nl&lr=";);

PHP returns an error:

Warning: Failed opening
'http://www.google.com/search?q=test&ie=UTF-8&oe=UTF8&hl=nl&lr=' for
inclusion (include_path='.:/php/includes:/usr/share/php') in
/home/virtual/site6/fst/var/www/html/search/reply.php on line 64

This certainly makes me wonder, since that page loads perfectly in my
browser, and http://www.google.com/ works perfectly... anyone knows what I'm
doing wrong?

Thanks in advance,

Leon Mergen



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




[PHP] Compiling PHP

2002-07-06 Thread Leon Mergen

Hello,

I'm currently camping with a problem... I have written a PHP application for
a client of mine, however, I do not want have him seeing the source code. I
know Zend has the Zend Encoder, however, this piece of software costs $2400
and since this is a one-time encoding request, I think this is a bit too
much ...

I want to know if anyone else knows another less expensive option to do
this.

Thanks in advance,

Leon  Mergen



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




[PHP] Safe mode?

2001-03-02 Thread Leon Mergen

How can I turn off safe_mode using php.ini with php4.0.3pl1? All this doesn't work:

safe_mode="off"
safe_mode=off
safe_mode="0"
safe_mode=0
safe_mode="Off"
safe_mode=Off

Anyone has an idea?


Leon Mergen
[EMAIL PROTECTED]
President of Technical Operations
BlazeBox, Inc.
ICQ: 55677353



[PHP] Regex problem

2001-10-25 Thread Leon Mergen

Hi there,

I am camping with a little regular expressions problem...

Problem: I want to check if $variable begins with a * (star), and it doesn't matter if 
it starts with plenty of spaces...

My solution:
ereg("^[:space:]*\*",$variable)

But, it doesn't seem to work with the space part... The regex:

ereg("^\*",$variable)

does work, but that doesn't include spaces at the start... How can I extend this one 
so that it doesn't matter if there are a lot of spaces at the begin?

Thanks in advance,

Leon Mergen



[PHP] MySQL4

2001-10-25 Thread Leon Mergen

Hello,

Just curious, before I get into the heat, but did anyone who already has installed 
MySQL 4 had any problems compiling PHP?

Thanks in advance,

Leon Mergen



[PHP] Regular expression question

2001-11-09 Thread Leon Mergen

Hello,

I have a little question regarding regular expressions... I want to check
for the pattern

$num::

But, $num may not be started with another number (assume the number will be
51 , 1 will also match (the pattern 1:: is available in 51::) ... Currently,
my regular expression is:

eregi("([^0-9]$num::)", $string);

But that doesn't seem to work... The other option, the start of a line or a
: also didn't work:

eregi("([^|:]$sess_id::)", $string);

Anyone can help me with this?

Thanks in advance,

Leon Mergen


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] No character set?

2001-04-06 Thread Leon Mergen

Hello all,

Today, I compiled my PHP as CGI, since I want to use some PHP scripts in cron jobs. 
Shouldn't be too hard, I tought, and compiled with

./configure --with-mysql

For some strange reason, it does not work. Look at this:

[root@blazebox cron]# php ./missiles.php
File 'NONEXISTENT/charsets/?.conf' not found (Errcode: 2)
Character set '#7' is not a compiled character set and is not specified in the 
'NONEXISTENT/charsets/Index' file
X-Powered-By: PHP/4.0.4pl1
Content-type: text/html


Warning:  MySQL Connection Failed: Can't initialize character set 7 (path: 
default)
 in ./missiles.php on line 5
[root@blazebox cron]#

Anyone has any idea what is causing this problem, and if/how I can fix it?

Thanks in advance,

_________
Leon Mergen
[EMAIL PROTECTED]
President of Operations
BlazeBox, Inc.
ICQ: 55677353



[PHP] strange error

2001-01-12 Thread Leon Mergen, BlazeNetwork

  Warning: REG_EPAREN in /home/coolguest/html/db/functions.php3 on line 13
   

What does this mean? The statement that is located there, is:

 $string = eregi_replace(">:(","