OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
php-general Digest 30 Apr 2008 19:45:34 -0000 Issue 5433

php-general-digest-helplists.php.net
Date: Wed Apr 30 2008 - 14:45:34 CDT


php-general Digest 30 Apr 2008 19:45:34 -0000 Issue 5433

Topics (messages 273722 through 273737):

Graphical Site Map
        273722 by: John Comerford

Sending data to PS
        273723 by: Richard Luckhurst

Re: web based chat app
        273724 by: paragasu
        273725 by: paragasu

Re: PHP debugger
        273726 by: J. Manuel Velasco - UBILIBET

Re: Best practices for using MySQL index
        273727 by: Aschwin Wesselius
        273728 by: Shelley
        273729 by: Aschwin Wesselius
        273735 by: Robert Cummings

Re: Fun with SOAP.
        273730 by: Eric Butera
        273731 by: Eric Butera
        273732 by: Eric Butera

Re: Xampp question, pretty much 0T
        273733 by: Ryan S
        273734 by: Wolf
        273736 by: Daevid Vincent

php 5 and mysql failure
        273737 by: Yehudi Alexis Garrett

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


Hi Folks,

Does anybody know of a product (php or otherwise) that enables the
creation of a graphical site map ? I have had a shimmy around the web
but just keep finding classes to create the .xml format site maps.

TIA,
  JC

attached mail follows:


Hi List

In Perl it is possible to use the syntax

 $0 = "$LISTENER: accepting connections on $SERVER_PORT";

to set a meaningful test string for ps.

Is such a thing, or anything similar, available for PHP?
  

Regards,
Richard Luckhurst

attached mail follows:


>
> You want light outta it? use the jabber2 server as a backend. It'll be
> done
> serving while you try to access the database. No need to do a square
> wheel,
> when a round one is invented

is there any free jabber2 server i can use?

attached mail follows:


On Wed, Apr 30, 2008 at 4:28 PM, paragasu <paragasugmail.com> wrote:

> You want light outta it? use the jabber2 server as a backend. It'll be
> > done
> > serving while you try to access the database. No need to do a square
> > wheel,
> > when a round one is invented
>
>
> is there any free jabber2 server i can use?
>
>
i found the jabber2 main project website. but it is not suitable for what i
wan't coz i want
to integrate the chat to my website. so online member can chat to each
other. i see a perl
implementation but no php..

attached mail follows:


NOTE: If you are interesting in PHP Debuggers, this is not the mail,
check the start of the thread since after I decided to try JasonPruim
Debug :p we are trying to solve one specific problem.

Now, to who is following the thread ... don't hung me, but i think the
problem was there was because there was no permission to write in a logfile.

---> BEGIN failed--compilation aborted at /home/httpd/bin/esnic/whois.pl
line 9.
line9 = use EPP::Client;
right at Client.pm there is the declaration og the log file.

My inexcusable big mistake, don't check the logs before, in fact i saw
it yesterday looking for other thing. But since running the sccript from
command line there was no error... I didn't realise to check them :-/

Now it works :)

Thank you very much for following and assistance.

Edward Kay escribió:
>> -----Original Message-----
>> From: Jason Pruim [mailto:japruimraoset.com]
>>
>
>
>> Morning,
>>
>> So looking at those scripts I realized that perl is nothing like php ;)
>>
>> Is there other info that the different places need? or is it just a
>> different URL?
>>
>> I'm wondering why you could do something like:
>>
>> <?PHP
>>
>> switch(strtolower($ext)) {
>> case 'es';
>> case 'com.es';
>> case 'org.es';
>> case 'edu.es';
>> case 'gob.es';
>> $cmd = HTTP://www.myCool.es/?query="$nom.$ext";
>> break;
>> case 'eu';
>> $cmd = HTTP://www.myCool.eu/?query="$nom.ext";
>> break;
>> default;
>> $cmd = HTTP://www.whois.com/?query="$nom.ext";
>> break;
>> }
>> ?>
>>
>> instead of calling out to a different script?
>>
>> Also, I noticed that in your script where you have "default:" in your
>> switch, you have a : instead of a ;
>>
>>
>
> Actually, the colon is correct: http://uk.php.net/switch
>
> You also need to enclose your string declarations correctly and add the $
> before ext, e.g.
> $cmd = "http://www.whois.com/?query=$nom.$ext";
> or
> $cmd = 'http://www.whois.com/?query='.$nom.'.'.$ext;
>
> Edward
>
>
>

--

attached mail follows:


Shelley wrote:
> Hi all,
>
> I am currently responsible for a subscription module and need to design the
> DB tables and write code.
>
> I have described my table design and queries in the post:
> http://phparch.cn/index.php/mysql/38-MySQL-configuration/152-best-practices-for-using-mysql-index
>
> The problem is, in a short time the table will hold millions of records.
> So the query and index optimization is very important.
>
> Any suggestion will be greatly appreciated.
Hi,

While this is not a MySQL mailing list, I try to give you some hints and
keep it short.

Index on most integer fields only. Text fields can be indexed, but is
not important when you design your DB well.

Don't index just all integer fields. Keep track of the cardinality of a
column. If you expect a field to have 100.000 records, but with only 500
distinct values it has no use to put an index on that column. A full
record search is quicker.

Put the columns with the highest cardinality as the first keys, since
MySQL will find these if no index is explicitly given.

You can look at an index with "SHOW INDEX FROM table" and this gives you
a column "cardinality".

Try out your select statements and use "EXPLAIN SELECT <whatever> FROM
table" and use some joins on other tables. This will show you which
possible indexes are found and which one is being used for that query.
You can sometimes force or ignore an index being used like this "SELECT
<whatever> FROM table USE INDEX (userID)". Try the MySQL manual for more
options. But do use the "EXPLAIN" statement to have a close look on the
use of indexes and the use of sorting methods. Because both are
important. Having a good index, but a slow sorting method won't get you
good results.

I hope this is a good short hint on using indexes. But becoming a master
does not come over night. Try the website www.mysqlperformanceblog.com
for more good solid tips on these topics.

Aschwin Wesselius

attached mail follows:


On Wed, Apr 30, 2008 at 5:14 PM, Aschwin Wesselius <aschwinilluminated.nl>
wrote:

> Shelley wrote:
>
> > Hi all,
> >
> > I am currently responsible for a subscription module and need to design
> > the
> > DB tables and write code.
> >
> > I have described my table design and queries in the post:
> >
> > http://phparch.cn/index.php/mysql/38-MySQL-configuration/152-best-practices-for-using-mysql-index
> >
> > The problem is, in a short time the table will hold millions of records.
> > So the query and index optimization is very important.
> >
> > Any suggestion will be greatly appreciated.
> >
> Hi,
>
> While this is not a MySQL mailing list, I try to give you some hints and
> keep it short.
>
> Index on most integer fields only. Text fields can be indexed, but is not
> important when you design your DB well.
>
> Don't index just all integer fields. Keep track of the cardinality of a
> column. If you expect a field to have 100.000 records, but with only 500
> distinct values it has no use to put an index on that column. A full record
> search is quicker.

   Hmmm... That's new. :)

>
>
> Put the columns with the highest cardinality as the first keys, since
> MySQL will find these if no index is explicitly given.
>
> You can look at an index with "SHOW INDEX FROM table" and this gives you a
> column "cardinality".
>
> Try out your select statements and use "EXPLAIN SELECT <whatever> FROM
> table" and use some joins on other tables. This will show you which possible
> indexes are found and which one is being used for that query. You can
> sometimes force or ignore an index being used like this "SELECT <whatever>
> FROM table USE INDEX (userID)". Try the MySQL manual for more options. But
> do use the "EXPLAIN" statement to have a close look on the use of indexes
> and the use of sorting methods. Because both are important. Having a good
> index, but a slow sorting method won't get you good results.
>
> I hope this is a good short hint on using indexes.

Yes. It is.

> But becoming a master does not come over night. Try the website
> www.mysqlperformanceblog.com for more good solid tips on these topics.

Good link. Thanks.

>
>
> Aschwin Wesselius
>

--
Regards,
Shelley

attached mail follows:


Shelley wrote:
>> Don't index just all integer fields. Keep track of the cardinality of a
>> column. If you expect a field to have 100.000 records, but with only 500
>> distinct values it has no use to put an index on that column. A full record
>> search is quicker.
>>
>
> Hmmm... That's new. :)

Well, to give you a good measure: keep the cardinality between 30 to
70-80 percent of your total records in a column. But sometimes your
field is NULL or empty, so it really depends. You can't just put it into
a standard configuration. And it also really depends on how many records
a table contains etc.

Besides that, benchmarking your development environment (you do have one
do you?) can gives you a good idea on how your hardware and setup performs.

Aschwin Wesselius

attached mail follows:


On Wed, 2008-04-30 at 11:14 +0200, Aschwin Wesselius wrote:
> Shelley wrote:
> > Hi all,
> >
> > I am currently responsible for a subscription module and need to design the
> > DB tables and write code.
> >
> > I have described my table design and queries in the post:
> > http://phparch.cn/index.php/mysql/38-MySQL-configuration/152-best-practices-for-using-mysql-index
> >
> > The problem is, in a short time the table will hold millions of records.
> > So the query and index optimization is very important.
> >
> > Any suggestion will be greatly appreciated.
> Hi,
>
> While this is not a MySQL mailing list, I try to give you some hints and
> keep it short.
>
> Index on most integer fields only. Text fields can be indexed, but is
> not important when you design your DB well.

Could you describe a well designed DB that contains searchable text that
doesn't contain a text index... fulltext or otherwise.

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

attached mail follows:


On Tue, Apr 29, 2008 at 5:07 PM, Nathan Nobbe <quickshiftingmail.com> wrote:
> i know this has nothing to do w/ getting it to work w/ php, eric, but have
> you tried hitting the service w/ soap ui?
> http://www.soapui.org/
>
> although its written in java, its an indispensable testing tool, imho, and i
> always give it a shot when im having soap troubles. i might try to see if
> you can get a successful response from the service w/ it.
>
> -nathan

Hi Nathan!

Thanks for the reply. I'm download it as we speak. Hopefully it'll
give me some sort of answer as to what is going on. I really haven't
found out enough about the SOAP "standard" enough to know what is
expected behavior, etc. I know I can see all of the raw data there,
just ext/soap doesn't seem to like the multi-part. Maybe soapUI will
give me some sort of answer for this.

attached mail follows:


On Wed, Apr 30, 2008 at 2:53 AM, Warren Vail <warrenvailtech.net> wrote:
> You should be able to parse it manually in PHP, but probably not with a XML
> parser or reader. Simply var_dump() the responses you are getting and write
> the code to break it up into values you can use. In some respects I've
> found this easier than XML, which tends at times to be somebody else's idea
> of a standard XML response ;-).
>
> Warren

I hear that! I had a thought of creating a subclass for the SOAP
client to pre-filter the results for document fetching so that I can
just grab the last multipart chunk myself & use SimpleXML on it. I
was just hoping there was some way of getting ext/soap to understand
that it is a multipart response and somehow tell it to use part 3.

Thank you for your reply!

attached mail follows:


On Wed, Apr 30, 2008 at 7:35 AM, Eric Butera <eric.buteragmail.com> wrote:
> On Tue, Apr 29, 2008 at 5:07 PM, Nathan Nobbe <quickshiftingmail.com> wrote:
> > i know this has nothing to do w/ getting it to work w/ php, eric, but have
> > you tried hitting the service w/ soap ui?
> > http://www.soapui.org/
> >
> > although its written in java, its an indispensable testing tool, imho, and i
> > always give it a shot when im having soap troubles. i might try to see if
> > you can get a successful response from the service w/ it.
> >
> > -nathan
>
> Hi Nathan!
>
> Thanks for the reply. I'm download it as we speak. Hopefully it'll
> give me some sort of answer as to what is going on. I really haven't
> found out enough about the SOAP "standard" enough to know what is
> expected behavior, etc. I know I can see all of the raw data there,
> just ext/soap doesn't seem to like the multi-part. Maybe soapUI will
> give me some sort of answer for this.
>

After using soapUI I've determined that the SOAP response gives back
an envelope and has one attachment. Does anyone know if the SOAP
extension can handle attachments? I'd really rather not mess around
with nusoap or the pear soap package. I don't see anywhere on the
manual where it is possible to download attachments. Hopefully
someone else has dealt with this before.

attached mail follows:


<clip>
> After reading a bit I see that if I just copy the "data" directory in the mySql directory, I can restore it from there? any idea if I have that wrong?

Hmm I guess, but I'd take the safer road and open a console and run:

mysqldump.exe -u <username> -p --all-databases --add-drop-database --opt
> mysql.database.dump

so you have an sql file you can restore if necessary.

Adjust paths/files/usernames/passwords as necessary.

</clip>

Hey!
Thanks for replying.

I decided to try something else while waiting for a response (still nothing from the main XAMPP forums though) and this is what worked for me, am posting it here so maybe it will help someone else in future (via the archives) facing the same problems that I faced , I dont know if this is a temp fix, I dont think so and it works perfectly for now.

Downloaded XAMPP again, installed it in c:/xampp2 (original version was in c:/xampp)
copied over all the files needed from the htdocs to c:/xampp2's htdocs
in the MySql folder, go into the "data" folder and just copy the files with the DB names that you created, leave all other files alone, paste these files into the c:/xampp2/mysql/data folder... do not overwrite anything, and if you have done this correctly you should _not_ get the overwrite prompt
Go to xampp's security page and redo the security including putting the password for root..

I am a bit of a paranoid dude, so i did a complete backup of all myfiles in htdocs and the mySql data folder and burnt it to DVD, you might consider doing thesame...just in case.

Thats it! Remember to edit the paths in your scripts for those that need it from xampp to xampp2.
A slight hassle, but not one that cant be done in 3-10 mins including copy time.

Thanks again Chris for your replies to this thread.

Cheers!
R

      ____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

attached mail follows:


Top posting from my cell...

1. Format hard drive
2. Install redhat fc8 or Ubuntu 8.04
3. Load the new MySQL installation with your backup file

If you really have to stay with windoze, remove and re-install apache. Look at the system log files as they SHOULD tell you what was causing the crash.

-----Original Message-----
From: Ryan S <genphpyahoo.com>
Sent: Tuesday, April 29, 2008 6:26 PM
To: php php <php-generallists.php.net>
Subject: [PHP] Xampp question, pretty much 0T

 Hello!

I have been using XAMPP for quite some time now (thanks to the recommendations from this list) without any real complaints...
and the only reason I am writing here is because i am sure a lot of you guys run the same thing considering the amount of people who recommended it to me when I asked for an easy install of AMP.
It was easy to install and has given me months of hassle free use... but today i have started facing some strange problems of everytime I start Apache.. it crashes my laptop, anybody else run into this?
I use this only for PHP, no perl.

My config:
Win Vista home premium with all updates and patches (genuine, not pirate copy)
core2 duo 2ghz
2 gigs ram

Nothing installed today for it to be acting up so.

Do you suggest I reinstall? or can I just reinstall Apache in some way? If i have to reinstall is there an easy way of backing up my stuff and then reinstalling then putting my stuff back? (I know i can just copy the files that were in the htdocs... but am talking about an easy way to copy the files and the DBs and put them back... or is that just wishful thinking?

TIA,
Ryan

------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!

attached mail follows:


Alternatively, I suggest you look into VMWare. There are several free
versions (player, server, etc) if you don't want Workstation (which I
absolutely love!) Workstation will give you such life-savers as multiple
Snapshots amongst other things.

http://www.vmware.com/products/player/
http://www.vmware.com/products/ws/
http://www.vmware.com/products/server/

Then you can setup a LAMP VM with your favorite distro (I use Gentoo myself,
but don't recommend it for a VM as the compilation all the time is painful).

You can download some already setup and ready to go.
http://www.vmware.com/appliances/directory/cat/53

This is how I do all my development. I run XP as my host OS. VMware is NAT.
Setup SAMBA & ssh on the VM and don't forget to edit your
"C:\WINDOWS\system32\drivers\etc\hosts" with an entry to point to your VM's
virtual host(s):

192.168.222.128 askeet
192.168.222.128 askeet.LAMP.com

And your /etc/apache2/vhosts.d/askeet.conf

<VirtualHost *:80>
    DocumentRoot "/home/sfprojects/askeet/web"
    ServerName askeet.LAMP.com
    ServerAlias askeet.LAMP.com askeet
    ErrorLog logs/askeet-error_log
    CustomLog logs/askeet-access_log common

    DirectoryIndex index.php

  Alias /sf /usr/share/php/data/symfony/web/sf
  <Directory "/usr/share/php/data/symfony/web">
    AllowOverride All
    Options FollowSymLinks +Indexes
    Order allow,deny
    Allow from all
  </Directory>

  <Directory "/home/sfprojects/askeet/web">
    AllowOverride All
    Options FollowSymLinks +Indexes
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

Then you just go to http://askeet.LAMP.com in your XP host and you're
hitting your VM LAMP virtual host.

Add this to your /etc/samba/smb.conf file:

[askeet]
   comment = askeet symphony development VMWare
   path = /home/sfprojects/askeet
   read only = no
   public = yes
   create mode = 0666
   directory mode = 0777
   force user = daevid

WIN+R and \\askeet and you'll connect to that directory to start coding in
your favorite PHP editor.

Works like a f'n champ! :D

I'll also suggest SQLYog and SecureCRT as my two other tools I just can't do
without.

Daevid Vincent
http://daevid.com

> -----Original Message-----
> From: Wolf [mailto:lonewolfnc.rr.com]
> Sent: Wednesday, April 30, 2008 6:06 AM
> To: Ryan S; php php
> Subject: RE: [PHP] Xampp question, pretty much 0T
>
> Top posting from my cell...
>
> 1. Format hard drive
> 2. Install redhat fc8 or Ubuntu 8.04
> 3. Load the new MySQL installation with your backup file
>
> If you really have to stay with windoze, remove and re-install apache.
> Look at the system log files as they SHOULD tell you what was causing
> the crash.
>
> -----Original Message-----
> From: Ryan S <genphpyahoo.com>
> Sent: Tuesday, April 29, 2008 6:26 PM
> To: php php <php-generallists.php.net>
> Subject: [PHP] Xampp question, pretty much 0T
>
>
> Hello!
>
> I have been using XAMPP for quite some time now (thanks to the
> recommendations from this list) without any real complaints...
> and the only reason I am writing here is because i am sure a lot of you
> guys run the same thing considering the amount of people who
> recommended it to me when I asked for an easy install of AMP.
> It was easy to install and has given me months of hassle free use...
> but today i have started facing some strange problems of everytime I
> start Apache.. it crashes my laptop, anybody else run into this?
> I use this only for PHP, no perl.
>
> My config:
> Win Vista home premium with all updates and patches (genuine, not
> pirate copy)
> core2 duo 2ghz
> 2 gigs ram
>
> Nothing installed today for it to be acting up so.
>
> Do you suggest I reinstall? or can I just reinstall Apache in some way?
> If i have to reinstall is there an easy way of backing up my stuff and
> then reinstalling then putting my stuff back? (I know i can just copy
> the files that were in the htdocs... but am talking about an easy way
> to copy the files and the DBs and put them back... or is that just
> wishful thinking?
>
> TIA,
> Ryan
>
>
>
>
> ------
> - The faulty interface lies between the chair and the keyboard.
> - Creativity is great, but plagiarism is faster!
>
>
> [The entire original message is not included]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

attached mail follows:


I'm using a php script which performs three xml queries to other three
servers to retrieve a set of ids and after I do a query to mysql of the
kind
SELECT * FROM table WHERE id IN ('set of ids');
Although I'm sure the connection to the database is ok, I sometimes get
an error of this kind:
*Warning*: mysql_fetch_object(): supplied argument is not a valid MySQL
result resource in ...
This does not happen every time i run the script, only sometimes.
If I echo the query, copy and paste in phpmyadmin, or if I perform the
same query in a script that does only the query without the rest it works!
After troubleshooting this issue I noticed that it usually failed when I
had a big set of ids (positive response from more than one server). This
means that the script used a bigger amount of memory and probably more
resources, but I did not get an "out of memory error", I got the one
described bfore.
My question is, is there any kind of limit somewhere in php5 or in mysql?
Thanks for help,

YEHUDI GARRETT