Wrox Programmer Forums
|
Pro PHP Advanced PHP coding discussions. Beginning-level questions will be redirected to the Beginning PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 5th, 2004, 09:16 AM
Registered User
 
Join Date: Aug 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default php parser

Hello,

I'm looking for php parser. Any idea other than developing a new one?

Thanks.

 
Old August 5th, 2004, 11:33 AM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Try: http://pear.php.net/package/PHP_Parser

HTH!

Regards,
Rich

--
[http://www.smilingsouls.net]
[http://pear.php.net/Mail_IMAP] A PHP/C-Client/PEAR solution for webmail
 
Old August 9th, 2004, 06:18 AM
Registered User
 
Join Date: Aug 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Dear Richard,

Many thank for your suggestion. It seems promising.

I have downloaded related files, installed PEAR related files and executed PEAR_ENV registry files.

I'm not sure how to run the Parser.php. I simply execute it as below.

http://localhost/PHP/Parser/Parser_modify.php

Unfortunately, I received message as below.

Warning: main(PEAR.php): failed to open stream: No such file or directory in C:\yahya\working\php\php-4.3.7-Win32\php-4.3.7-Win32\PEAR\Console\Getopt.php on line 21

Fatal error: main(): Failed opening required 'PEAR.php' (include_path='.;c:\php4\pear') in C:\yahya\working\php\php-4.3.7-Win32\php-4.3.7-Win32\PEAR\Console\Getopt.php on line 21

As far as I can see, the php and PEAR is installed in different folder. Does it matter?

Your kind advise is highly appreciated.

Cheers.

 
Old August 9th, 2004, 11:31 AM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

PEAR.php is the PEAR base file, it contains error handling functions for PEAR scripts.

Did you install the PEAR command-line installer? If you did and all went well the PEAR.php file should be in the directory that you installed PEAR to. You might also verify that the include_path directive of php.ini includes a reference to the PEAR install directory containing the PEAR.php file.


Regards,
Rich

--
[http://www.smilingsouls.net]
[http://pear.php.net/Mail_IMAP] A PHP/C-Client/PEAR solution for webmail
 
Old August 9th, 2004, 11:58 AM
Registered User
 
Join Date: Aug 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Dear all,

I have installed the PEAR command-line installer. Below are portion of php.ini file. There is a line consist of path related to PEAR. Any suggestion? I'm waiting at the office. Many thanks to Rich.

;exif.encode_unicode = ISO-8859-15
;exif.decode_unicode_motorola = UCS-2BE
;exif.decode_unicode_intel = UCS-2LE
;exif.encode_jis =
;exif.decode_jis_motorola = JIS
;exif.decode_jis_intel = JIS

; Local Variables:
; tab-width: 4
; End:


;***** Added by go-pear
include_path=".;C:\yahya\working\php\php-4.3.7-Win32\php-4.3.7-Win32\pear"
;*****



 
Old August 10th, 2004, 09:24 AM
Registered User
 
Join Date: Aug 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,

Warning: main(PEAR.php): failed to open stream: No such file or directory in C:\yahya\working\php\php-4.3.7-Win32\php-4.3.7-Win32\PEAR\Console\Getopt.php on line 21

Fatal error: main(): Failed opening required 'PEAR.php' (include_path='.;c:\php4\pear') in C:\yahya\working\php\php-4.3.7-Win32\php-4.3.7-Win32\PEAR\Console\Getopt.php on line 21

The above file existing but I'm not sure why the error message is generated.

cheers,
yahya

 
Old August 10th, 2004, 10:02 AM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

You have conflicting output as to what the PEAR path is. Your error says the path to PEAR is include_path='.;c:\php4\pear' in your previous post you said the path to PEAR is include_path=".;C:\yahya\working\php\php-4.3.7-Win32\php-4.3.7-Win32\pear", which is correct? Did you restart your HTTP server after installing PEAR? Sometimes that is necessary for ini changes to take affect.

Once you have that sorted you should be able to write the include path require_once 'PEAR.php'; from any directory on your server.

Regards,
Rich

--
[http://www.smilingsouls.net]
[http://pear.php.net/Mail_IMAP] A PHP/C-Client/PEAR solution for webmail
 
Old August 10th, 2004, 10:18 AM
Registered User
 
Join Date: Aug 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Dear all,

I'm have done the suggestion. It works. My question is where to place all the parser related files such as parser.php, core.php and tokenizer.php? Currently, I placed it at C:\Program Files\Apache Group\Apache2\htdocs\PHP\Parser\Parser.php on line 34

Below are the error message.
Warning: main(PHP/Parser/Core.php): failed to open stream: No such file or directory in C:\Program Files\Apache Group\Apache2\htdocs\PHP\Parser\Parser.php on line 34

Fatal error: main(): Failed opening required 'PHP/Parser/Core.php' (include_path='.;C:\yahya\working\php\php-4.3.7-Win32\php-4.3.7-Win32\PEAR') in C:\Program Files\Apache Group\Apache2\htdocs\PHP\Parser\Parser.php on line 34

Second, how to execute the parser.php?

Prompt reply is highly appreciated because I need the parser urgertly. Thanks so much Richard.

Many thanks,
yahya

 
Old August 10th, 2004, 10:44 AM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

It doesn't sound like you've installed the package using the PEAR installer. You should install the PHP_Parser package using the PEAR command line installer.

After you install PEAR a file called 'pear.bat' is created, this file contains the guts of the PEAR command line interface. Set your command line pointer to the directory that contains the pear.bat file.

C:\PHP\PEAR>pear install PHP_Parser

Otherwise you can add the path to the directory as an Environment variable.

Control Panel->System->Advanced->Enviornment Variables->System Variables->Path->Edit->Add semi-colon separated path.

Restart the command line, now the simple 'pear' command is available. You can also reference the complete file path.

C:\>C:\php\pear.bat install PHP_Parser

Use the 'help' command for more options. Some examples of allowed arguments are install, upgrade and uninstall, then you provide the name of the package or a path to the package tarball.

C:\>pear help

If the package is not stable the command line will refuse to install it but you can force the installation using an optional --force argument.

C:\PHP\PEAR>pear install --force PHP_Parser

Now, once installed the files of the PHP_Parser package should be available via the PEAR include path and may be included from any directory.

The installer automatically creates the necessary directories and manages all of the files associated with the package.

I did just notice that this pacakge is in development state, the lowest possible state! I'd be leary of bugs and such things, still probably better than starting from scratch. As far as how to use the package, I have never used this package so I haven't a clue on that end of it. You can always solicit help from the package's developers. Many of them are subscribed to the PEAR general mailing list.

Find that list here:
http://pear.php.net/support/lists.php

I'd encourage you to help the developers by reporting any bugs that you find, since this package is in such an early stage of development.


Regards,
Rich

--
[http://www.smilingsouls.net]
[http://pear.php.net/Mail_IMAP] A PHP/C-Client/PEAR solution for webmail
 
Old August 10th, 2004, 11:34 AM
Registered User
 
Join Date: Aug 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Dear all,

I tried the second option. Below are the environment variables.

C:\yahya\research\latex\texmf\miktex\bin;%SystemRo ot%\system32;%SystemRoot%;%SystemRoot%\System32\Wb em;C:\Program Files\Common Files\Roxio Shared\DLLShared;c:\yahya\working\php\php-4.3.7-Win32\php-4.3.7-Win32\PEAR

Then, the command below is executed. The error are as below.

Thanks Rich. I'm extremely need it.


C:\>c:\php\pear.bat install PHP_Parser
'c:\php\pear.bat' is not recognized as an internal or external command,
operable program or batch file.

C:\>pear help

Notice: Constant already defined in PEAR.php on line 24

Notice: Constant already defined in PEAR.php on line 25

Notice: Constant already defined in PEAR.php on line 26

Notice: Constant already defined in PEAR.php on line 27

Notice: Constant already defined in PEAR.php on line 28

Notice: Constant already defined in PEAR.php on line 33

Notice: Constant already defined in PEAR.php on line 35

Notice: Constant already defined in PEAR.php on line 38

Notice: Constant'« already defined in PEAR.php on line 39

Notice: Constant'« already defined in PEAR.php on line 40

Fatal error: Cannot redeclare class pear in C:\yahya\working\php\php-4.3.7-Win32
\php-4.3.7-Win32\PEAR\PEAR.php on line 86

C:\>c:\php\pear.bat install PHP_PARSER
'c:\php\pear.bat' is not recognized as an internal or external command,
operable program or batch file.

C:\>cd php

C:\PHP>cd pear
Invalid directory








Similar Threads
Thread Thread Starter Forum Replies Last Post
Html parser francofm76 Pro PHP 1 July 31st, 2007 09:54 AM
Parser html francofm76 PHP How-To 1 July 4th, 2007 08:01 AM
Help needed: the PHP parser don't work! pbuongiovanni PHP How-To 8 January 12th, 2006 07:32 AM
How to get and use MSXML parser? zhao790 XML 4 September 1st, 2004 11:31 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.