php-general Digest 24 Jan 2006 14:35:15 -0000 Issue 3924

Topics (messages 229147 through 229166):

Re: Reference Notices -- Urgent
        229147 by: Richard Correia
        229149 by: Todd Brown

Re: Can't printout class variable
        229148 by: Sumeet
        229161 by: Scott Gunn

Help with getting PHP to see Pear.
        229150 by: Payne
        229151 by: Payne
        229152 by: Albert
        229153 by: Sumeet
        229157 by: Jesús Fernández

How would u strip the path?
        229154 by: Nicholas Couloute
        229155 by: Paul Scott

Re: [SOLVED] How would u strip the path?
        229156 by: Nicholas Couloute

Announcement: PHP-Qt
        229158 by: Thomas Moenicke

Book Sample Code Help
        229159 by: Poppy Alexandra
        229160 by: David Grant
        229162 by: Jochem Maas
        229163 by: Poppy Alexandra
        229164 by: Poppy Alexandra
        229165 by: Jochem Maas

XML-RPC and comment spam...
        229166 by: Russell Jones

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 ---
Hey Todd,

You need to check the setting of error reporting in php.ini file.
http://www.weberdev.com/Manuals/PHP/ref.errorfunc.html

Thanks
Richard



On 1/24/06, Todd Brown <[EMAIL PROTECTED]> wrote:
>
> I'm getting the following notices:
>
> Notice: Only variables should be assigned by reference in ....
> Notice: Only variable references should be returned by reference in ....
>
> The code in question comes from PayPal (their CC processing API,) so
> modifying it to correct the reference issues is *not* an option.
>
> On the actual implementation server (PHP 4.4.1), I am not receiving
> these errors.  On my test server (also 4.4.1), I am.  I have run
> phpinfo() on both servers and carefully compared the output; as far as I
> can tell they are configured identically.  I really need to be able to
>

--- End Message ---
--- Begin Message --- Thanks, Richard, that solved the problem. I knew it was something like that, but was just running out of time! I appreciate your help.

                Cheers,
                  Todd

Richard Correia wrote:
Hey Todd,

You need to check the setting of error reporting in php.ini file.
http://www.weberdev.com/Manuals/PHP/ref.errorfunc.html

Thanks
Richard



On 1/24/06, Todd Brown <[EMAIL PROTECTED]> wrote:
I'm getting the following notices:

Notice: Only variables should be assigned by reference in ....
Notice: Only variable references should be returned by reference in ....

The code in question comes from PayPal (their CC processing API,) so
modifying it to correct the reference issues is *not* an option.

On the actual implementation server (PHP 4.4.1), I am not receiving
these errors.  On my test server (also 4.4.1), I am.  I have run
phpinfo() on both servers and carefully compared the output; as far as I
can tell they are configured identically.  I really need to be able to



--- End Message ---
--- Begin Message ---
Scott Gunn wrote:
This should be simple.  What am I doing wrong?

Here is the code that is failing:

    $user = $_SESSION['user'];
    print_r($user);
    echo "Welcome " . $user->firstName;

The print_r command prints out:

__PHP_Incomplete_Class Object ( [__PHP_Incomplete_Class_Name] => User [isLoggedIn] => 1 [lastName] => Gunn [firstName] => Scott )


try
$user = (User)$_SESSION['user'];
rest remains the same.

--
Sumeet Shroff
http://www.prateeksha.com
Web Design and Ecommerce Development, Mumbai India

--- End Message ---
--- Begin Message --- You led me down the right path. I wasn't including the class definition file before adding the object to the session.

Thanks.

Sumeet wrote:
Scott Gunn wrote:
This should be simple.  What am I doing wrong?

Here is the code that is failing:

    $user = $_SESSION['user'];
    print_r($user);
    echo "Welcome " . $user->firstName;

The print_r command prints out:

__PHP_Incomplete_Class Object ( [__PHP_Incomplete_Class_Name] => User [isLoggedIn] => 1 [lastName] => Gunn [firstName] => Scott )


try
$user = (User)$_SESSION['user'];
rest remains the same.


--- End Message ---
--- Begin Message --- Hi, I just installed SuSE 10 and I am having a problem with my phpnuke site and my maia site. PHPNUKE gives me this error...

*Warning*: main(db/mysql.php): failed to open stream: No such file or directory in */srv/www/htdocs/bse/db/db.php* on line *53*

*Warning*: main(): Failed opening 'db/mysql.php' for inclusion (include_path='/usr/share/php') in */srv/www/htdocs/bse/db/db.php* on line *53*

*Fatal error*: Cannot instantiate non-existent class: sql_db in */srv/www/htdocs/bse/db/db.php* on line *86

But if I copy my old php.ini from 9.1 it works just fine.

One maia, it says that it not install, I took a look at my phpinfo and I did see this....

*'./configure' '--prefix=/usr' '--datadir=/usr/share/php' '--mandir=/usr/share/man' '--bindir=/usr/bin' '--libdir=/usr/share' '--includedir=/usr/include' '--sysconfdir=/etc' '--with-_lib=lib' '--with-config-file-path=/etc' '--with-exec-dir=/usr/lib/php/bin' '--disable-debug' '--enable-inline-optimization' '--enable-memory-limit' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sigchild' '--disable-ctype' '--disable-session' '--without-mysql' '--disable-cli' '--without-pear' '--with-openssl' '--with-apxs2=/usr/sbin/apxs2-prefork' 'i586-suse-linux'

How can I get php to see pear, it is installed. I have install modules with pear for maia and horde but neither seem to see pear.

Also I know that since 4.4.0 BC Math library is included, maia saying it not.


Payne

PEAR *FAILED*: Not installed. The PEAR extension is required by several other PHP extensions that Maia needs. See this page <http://pear.php.net/> for more information about downloading and installing PEAR.
PEAR::Mail_Mime     *SKIPPED*: Requires PEAR
PEAR::DB     *SKIPPED*: Requires PEAR
PEAR::DB_Pager     *SKIPPED*: Requires PEAR
PEAR::Net_Socket     *SKIPPED*: Requires PEAR
PEAR::Net_SMTP     *SKIPPED*: Requires PEAR
PEAR::Auth_SASL     *SKIPPED*: Requires PEAR
PEAR::Net_IMAP     *SKIPPED*: Requires PEAR
PEAR::Net_POP3     *SKIPPED*: Requires PEAR
PEAR::Log     *SKIPPED*: Requires PEAR
IMAP library     *OK*: 2004
LDAP library     *OK*
MCrypt library     *OK*: >= 2.4.x with Blowfish and CBC
BC math library *FAILED*: Not installed. This PHP extension is required in order to decode certain types of URLs. See this page <http://www.php.net/bc/> for more information about recompiling PHP with the --enable-bcmath flag.
gd graphics library     *OK*: 2.0 or higher

--- End Message ---
--- Begin Message --- Hi, I just installed SuSE 10 and I am having a problem with my phpnuke site and my maia site. PHPNUKE gives me this error...

*Warning*: main(db/mysql.php): failed to open stream: No such file or directory in */srv/www/htdocs/bse/db/db.php* on line *53*

*Warning*: main(): Failed opening 'db/mysql.php' for inclusion (include_path='/usr/share/php') in */srv/www/htdocs/bse/db/db.php* on line *53*

*Fatal error*: Cannot instantiate non-existent class: sql_db in */srv/www/htdocs/bse/db/db.php* on line *86

But if I copy my old php.ini from 9.1 it works just fine.

One maia, it says that it not install, I took a look at my phpinfo and I did see this....

*'./configure' '--prefix=/usr' '--datadir=/usr/share/php' '--mandir=/usr/share/man' '--bindir=/usr/bin' '--libdir=/usr/share' '--includedir=/usr/include' '--sysconfdir=/etc' '--with-_lib=lib' '--with-config-file-path=/etc' '--with-exec-dir=/usr/lib/php/bin' '--disable-debug' '--enable-inline-optimization' '--enable-memory-limit' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sigchild' '--disable-ctype' '--disable-session' '--without-mysql' '--disable-cli' '--without-pear' '--with-openssl' '--with-apxs2=/usr/sbin/apxs2-prefork' 'i586-suse-linux'

How can I get php to see pear, it is installed. I have install modules with pear for maia and horde but neither seem to see pear.

Also I know that since 4.4.0 BC Math library is included, maia saying it not.


Payne

        
PEAR *FAILED*: Not installed. The PEAR extension is required by several other PHP extensions that Maia needs. See this page <http://pear.php.net/> for more information about downloading and installing PEAR.
PEAR::Mail_Mime         *SKIPPED*: Requires PEAR
PEAR::DB        *SKIPPED*: Requires PEAR
PEAR::DB_Pager  *SKIPPED*: Requires PEAR
PEAR::Net_Socket        *SKIPPED*: Requires PEAR
PEAR::Net_SMTP  *SKIPPED*: Requires PEAR
PEAR::Auth_SASL         *SKIPPED*: Requires PEAR
PEAR::Net_IMAP  *SKIPPED*: Requires PEAR
PEAR::Net_POP3  *SKIPPED*: Requires PEAR
PEAR::Log       *SKIPPED*: Requires PEAR
IMAP library    *OK*: 2004
LDAP library    *OK*
MCrypt library  *OK*: >= 2.4.x with Blowfish and CBC
BC math library *FAILED*: Not installed. This PHP extension is required in order to decode certain types of URLs. See this page <http://www.php.net/bc/> for more information about recompiling PHP with the --enable-bcmath flag.
gd graphics library     *OK*: 2.0 or higher

--- End Message ---
--- Begin Message ---
Payne wrote:
> How can I get php to see pear, it is installed.  I have install modules 
> with pear for maia and horde but neither seem to see pear.

I'm running SuSE 9.3 and had to add /usr/share/php to the include path in
/etc/php.ini to be able to use the installed PEAR extensions.

To enable bcmath I had to uncomment the extension=bcmath.so line in
/etc/php.ini 

Check that phpinfo() outputs bcmath.

Albert

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.14.22/238 - Release Date: 2006/01/23
 

--- End Message ---
--- Begin Message ---
Payne wrote:
Hi, I just installed SuSE 10 and I am having a problem with my phpnuke site and my maia site. PHPNUKE gives me this error...

*Warning*: main(db/mysql.php): failed to open stream: No such file or directory in */srv/www/htdocs/bse/db/db.php* on line *53*

*Warning*: main(): Failed opening 'db/mysql.php' for inclusion (include_path='/usr/share/php') in */srv/www/htdocs/bse/db/db.php* on line *53*


i think it has to do with the 'include_path' set in php.ini

include_path = 'your_path';


--
Sumeet Shroff
http://www.prateeksha.com
Web Design and Ecommerce Development, Mumbai India

--- End Message ---
--- Begin Message ---
if you look to your phpinfo it says:

'--without-pear'

Maybe you'll need to install it with pear support or is it right just to add
pear to the include_path?


--
Esú - http://esu.proyectoanonimo.com
http://www.proyectoanonimo.com

--- End Message ---
--- Begin Message ---
how would u strip the path off of a variable? say that:
$bob = "/home/s2music/b/bob.mp3";
I want bob just to be "bob.mp3"!
how would I do that?
~Nick Couloute
co-owner/Web Designer
Sidekick2Music.Com

--- End Message ---
--- Begin Message ---
On Tue, 2006-01-24 at 04:01 -0500, Nicholas Couloute wrote:
> how would u strip the path off of a variable? say that:

http://za2.php.net/manual/en/function.basename.php

basename it!

--Paul

--- End Message ---
--- Begin Message ---
Thanks that is just what I needed!

On Tue, 24 Jan 2006 4:08 am, Paul Scott wrote:
On Tue, 2006-01-24 at 04:01 -0500, Nicholas Couloute wrote:
 how would u strip the path off of a variable? say that:

http://za2.php.net/manual/en/function.basename.php

basename it!

--Paul
~Nick Couloute
co-owner/Web Designer
Sidekick2Music.Com

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

The second release of PHP-Qt is now available. PHP-Qt provides an 
object-oriented interface to the Qt4 Framework and allows to write Qt 
applications in the PHP language. 
PHP-Qt is alpha software and still in a prototype stage, but the first 6 
tutorials from Qt documentation are working. I have ported these tutorials to 
PHP-Qt, and they are available in the tarball. 
For more information, visit http://php-qt.berlios.de/ .

-- 
Thomas

--- End Message ---
--- Begin Message --- Hi all. I am trying to run some PHP code I got from the O'Reilly book Spidering Hacks and it doesn't seem to be working. Please note, the functions were not inculded in the code, I had to copy it from the book so I might have made mistake. I thought perhaps an experienced PHP programmer might be able to pick the error. Does the code work for anyone else?

Thank you. Poppy

The error, and code are listed below:

phpserver$ php -q book-1.php
Parse error: parse error in book-1.php on line 90
phpserver$

#!/usr/bin/php -q

<?php

/* include the scraping functions script:
include( "scrape_func.php" );
I commented this out and included in this file for clarity
*/

function getURL( $pURL ) {
        $_data = null;
        if( $_http = fopen( $pURL, "r" ) ) {
                while( !feof( $_http ) ) {
                        $_data .= fgets( $_http, 1024 );
                }
                fclose( $_http );
        }
        return( $_data );
}

function cleanString( $pString ) {
$_data = str_replace( array( chr(10), chr(13), chr(9) ), chr(32), $pString );
                while( strpos( $_data, str_repeat( chr(32), 2 ), 0 ) != false ) 
{
                        $_data = str_replace( str_repeat( chr(32), 2 ), 
chr(32), $_data );
                }
                return( trim( $_data ) );
}

function getBlock( $pStart, $pStop, $pSource, $pPrefix = true ) {
        $_data = null;
        $_start = strpos( strtolower( $pSource ), strtolower( $pStart ), 0 );
        $_start = ( $pPrefix == false ) ? $_start + strlen( $pStart ) : $_start;
        $_stop = strpos( strtolower( $pSource ), strtolower( $pStop ), $_start 
);
        if( $_start > strlen( $pElement ) && $_stop > $_start ) {
                $_data = trim( substr( $pSource, $_start, $_stop - $_start ) );
        }
        return( $_data );

function getElement( $pElement, $pSource ) {
        $_data = null;
        $pElement = strtolower( $pElement );
        $_start = strpos( strtolower( $pSource ), chr(60) . $pElement, 0 );
        $_start = strpos( $pSource, chr(62), $_start ) + 1;
$_stop = strpos( strtolower( $pSource ), "</" . $pElement . chr(62), $_start );
        if( $_start > strlen( $pElement ) && $_stop > $_start ) {
                $_data = trim( substr( $pSource, $_start, $_stop - $_start ) );
        }
        return( $_data );
}



/* Next, we'll get the raw source code of
  the page using our getURL(  ) function:  */
$_rawData = getURL( "http://www.techdeals.net/"; );

/* And clean up the raw source for easier parsing:  */
$_rawData = cleanString( $_rawData );

/* The next step is a little more complex. Because we've already
  looked at the HTML source, we know that the items start and
  end with two particular strings. We'll use these strings to
  get the main data portion of the page:*/
$_rawData = getBlock( "<div class=\"NewsHeader\">",
                     "</div> <div id=\"MenuContainer\">", $_rawData );

/* We now have the particular data that we want to parse into
  an itemized list. We do that by breaking the code into an
  array so we can loop through each item: */
$_rawData = explode( "<div class=\"NewsHeader\">", $_rawData );


/* While iterating through each value, we
  parse out the individual item portions:  */

foreach( $_rawData as $_rawBlock ) {
  $_item = array(  );
  $_rawBlock = trim( $_rawBlock );
  if( strlen( $_rawBlock ) > 0 ) {

     /*   The title of the item can be found in <h2> ... </h2> tags   */
     $_item[ "title" ] = strip_tags( getElement( "h2", $_rawBlock ) );

     /*   The link URL can is found between
          http://www.techdeals.net/rd/go.php?id= and "   */
     $_item[ "link" ] = getBlock( "http://www.techdeals.net/rd/go.php?id=";,
                                  chr(34), $_rawBlock );

     /*   Posting info is in <span> ... </span> tags   */
     $_item[ "post" ] = strip_tags( getElement( "span", $_rawBlock ) );

     /*   The description is found between an </div> and a <img tag   */
     $_item[ "desc" ] = cleanString( strip_tags( getBlock( "</div>",
                                     "<img", $_rawBlock ) ) );

     /*   Some descriptions are slightly different,
          so we need to clean them up a bit   */
if( strpos( $_item[ "desc" ], "Click here for the techdeal", 0 ) > 0 ) { $_marker = strpos( $_item[ "desc" ], "Click here for the techdeal", 0 );
        $_item[ "desc" ] = trim( substr( $_item[ "desc" ], 0, $_marker ) );
     }

     /*   Print out the scraped data   */
     print( implode( chr(10), $_item ) . chr(10) . chr(10) );

     /*   Save the data as a string (used in the mail example below)   */
     $_text .= implode( chr(10), $_item ) . chr(10) . chr(10);
  }
}

?>

_________________________________________________________________
Ever wanted to be a TV Stylist? Win Your Dream Job at MyCareer http://dreamjob.mycareer.com.au/?s_cid=213322
--- End Message ---
--- Begin Message ---
Poppy,

Poppy Alexandra wrote:
> Parse error: parse error in book-1.php on line 90

Please provide lines 89-91 of book-1.php only please.

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

http://pear.php.net/package/File_Ogg    0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

--- End Message ---
--- Begin Message ---
David Grant wrote:
Poppy,

Poppy Alexandra wrote:

Parse error: parse error in book-1.php on line 90


Please provide lines 89-91 of book-1.php only please.

humbug David :-) - turns out lines 89-91 will tell the OP nothing about
the error because the its the definition of function getBlock()
that is missing a closing brace (at around line 38) that si causing the error.

once you add the missing brace the script works (at least it dumped a
load of content from http://www.techdeals.net/ onto my console).

by helping you get your sample code working are per chance hepling into
life yet another 'linkfarm' or some similarly SEO related nasty?

grds,
Jochem

PS  - 'Queen Alexandra' is a kind of poppy, apparently


David

--- End Message ---
--- Begin Message ---
Please provide lines 89-91 of book-1.php only please.

humbug David :-) - turns out lines 89-91 will tell the OP nothing about
the error because the its the definition of function getBlock()
that is missing a closing brace (at around line 38) that si causing the error.

Thanks for the reply, it had really stumped me. I knew it would be an error with the bit I typed in :)


once you add the missing brace the script works (at least it dumped a
load of content from http://www.techdeals.net/ onto my console).
by helping you get your sample code working are per chance hepling into
life yet another 'linkfarm' or some similarly SEO related nasty?

It's only sample code from a book. All of the examples are in Perl, except this particular code. I am new to PHP and wanted to try and run the code to see if it worked.

Thank you. Poppy

_________________________________________________________________
Buy now @ Tradingpost.com.au http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fad%2Eau%2Edoubleclick%2Enet%2Fclk%3B24875379%3B12369854%3Ba%3Fhttp%3A%2F%2Fwww%2Etradingpost%2Ecom%2Eau%3Freferrer%3DnmsnHMetagv1&_t=752643439&_r=hotmailtagline&_m=EXT
--- End Message ---
--- Begin Message ---
it' not to find in the lines 89-91....

You missed a " } " at the end of func "getBlock"....

Hello Björn,

Thank you also for your reply. I appreciate your help.


 KEEP YOUR CODE CLEAN !!!!!!

This is sample code from a book. I am interested to know what you mean by clean code (formatting, conventions?). If you have any pointers how one should keep their code clean, I would like to learn. I am new to PHP. If this is off topic, apologies to the list.

Thank you. Pop

_________________________________________________________________
Make your dream car a reality http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fcarpoint%2Eninemsn%2Ecom%2Eau&_t=12345&_r=emailtagline&_m=EXT
--- End Message ---
--- Begin Message ---
Poppy Alexandra wrote:
Please provide lines 89-91 of book-1.php only please.


humbug David :-) - turns out lines 89-91 will tell the OP nothing about
the error because the its the definition of function getBlock()
that is missing a closing brace (at around line 38) that si causing the error.


Thanks for the reply, it had really stumped me. I knew it would be an error with the bit I typed in :)

it usually is ;-)



once you add the missing brace the script works (at least it dumped a
load of content from http://www.techdeals.net/ onto my console).
by helping you get your sample code working are per chance hepling into
life yet another 'linkfarm' or some similarly SEO related nasty?


It's only sample code from a book. All of the examples are in Perl, except this particular code. I am new to PHP and wanted to try and run the code to see if it worked.

which doesn;t actually answer my question :-) you see I have my suspicions
about a book named 'Spidering Hacks' - if it was meat I doubt it would be
kosher or halal.


Thank you. Poppy

_________________________________________________________________
Buy now @ Tradingpost.com.au http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fad%2Eau%2Edoubleclick%2Enet%2Fclk%3B24875379%3B12369854%3Ba%3Fhttp%3A%2F%2Fwww%2Etradingpost%2Ecom%2Eau%3Freferrer%3DnmsnHMetagv1&_t=752643439&_r=hotmailtagline&_m=EXT


--- End Message ---
--- Begin Message ---
I am trying to set up a personal blog of mine with the new
LinkSleeve.orgXML-RPC link spam service, but I dont know the firs
thing about PHP and
XML-RPC.

I did read that there are some problems with security, though, with the
popular PHP XML-RPC classes. Have these been fixed and which would you all
recommend?

rjones

--- End Message ---

Reply via email to