PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
DETAILED PEAR GUIDE
Goto page Previous  1, 2
 
Post new topic   Reply to topic    PEAR Forum Forum Index -> Documentation, Tutorials, How to's
View previous topic :: View next topic  
Author Message
saddlebite



Joined: 17 Feb 2009
Posts: 20

PostPosted: Wed Feb 25, 2009 5:03 pm    Post subject: Reply with quote

i could not find the mhash extension when I ran phpinfo()...

I did find this however:

hash
hash support enabled
Hashing Engines md2 md4 md5 sha1 sha256 sha384 sha512 ripemd128 ripemd160 ripemd256 ripemd320 whirlpool tiger128,3 tiger160,3 tiger192,3 tiger128,4 tiger160,4 tiger192,4 snefru gost adler32 crc32 crc32b haval128,3 haval160,3 haval192,3 haval224,3 haval256,3 haval128,4 haval160,4 haval192,4 haval224,4 haval256,4 haval128,5 haval160,5 haval192,5 haval224,5 haval256,5
Back to top
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1210

PostPosted: Wed Feb 25, 2009 5:19 pm    Post subject: Reply with quote

According to the PHP manual, hash made mhash obsolete (but that doesn't mean that you can't use mhash anymore, of course). I guess that the php_mhash.dll file is missing or cannot be found. The Apache error log should show you a message if this is the case.

The file can be found here: http://windows.php.net/download/
(in the 9.88 MB archive)
Back to top
View user's profile Send private message
saddlebite



Joined: 17 Feb 2009
Posts: 20

PostPosted: Wed Feb 25, 2009 5:26 pm    Post subject: Reply with quote

thanks for the link mark... I am downloading the 9.88MB Archive...

I ran a search and found the php_mhash.dll in php/ext directory...

I figured that the mhash extension is workning because I installed Pear's Net_DNS which required mhash...

I am still unable to use the mhash function in the php script though...
Back to top
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1210

PostPosted: Wed Feb 25, 2009 5:36 pm    Post subject: Reply with quote

Did previously the PEAR installer complain about the missing extension? If that's the case, you're having two different PHP installations, with two different php.ini files. You need to enable the extension in both of these files.
Back to top
View user's profile Send private message
saddlebite



Joined: 17 Feb 2009
Posts: 20

PostPosted: Wed Feb 25, 2009 10:48 pm    Post subject: Reply with quote

Hi Mark... The PEAR installation, previously did complain about the mhash extension, but not anymore...

I found a php.ini-recommended file, where I enabled the mhash extension as well...

The following is the code I am trying to execute:

<?php

$usrpswd="mysecretpswd";
$pswdhash=mhash(MHASH_SHA1,$usrpswd);
echo"The Hashed Password is ".bin2hex($pswdhash);
?>

The error message I get is:

Fatal error: Call to undefined function mhash() in C:\Apache2\htdocs\1\coding\mhash1.php on line 6
Back to top
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1210

PostPosted: Thu Feb 26, 2009 12:04 am    Post subject: Reply with quote

saddlebite wrote:
I found a php.ini-recommended file, where I enabled the mhash extension as well...


This file is delivered with PHP, and it is meant to be renamed to just php.ini. Anyway, if you execute phpinfo() in a script on your web server (i.e. called via your browser, just like the last example code that you've showed), you'll find a row named "Loaded Configuration File" in the first table. This is the php.ini file that needs the mentioned modification.
Back to top
View user's profile Send private message
saddlebite



Joined: 17 Feb 2009
Posts: 20

PostPosted: Thu Feb 26, 2009 5:56 am    Post subject: Reply with quote

Hi Mark... I've tried everything possible... I even downloaded the 9.8MB archive link and replaced the php_mhash.dll file in the php5/ext/ directory.

(I've loaded php in a directory called php5)

I uncommented the 'extension=php_mhash.dll' line in the 'php.ini' file as well...
The following is the error I noticed in the Apache error logs

PHP Warning: PHP Startup: Unable to load dynamic library 'c:\\php5\\ext\\php_mhash.dll' - The specified module could not be found.\r\n in Unknown on line 0
Back to top
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1210

PostPosted: Thu Feb 26, 2009 2:04 pm    Post subject: Reply with quote

Maybe a version conflict? Is your PHP version on the web server older than the downloaded archive (5.2.Cool?

Is the "extension_dir" set correctly in the php.ini?

If you use Google with the mentioned error message, you'll get a lot of results. There might be some other ideas that help you solving this problem.
Back to top
View user's profile Send private message
saddlebite



Joined: 17 Feb 2009
Posts: 20

PostPosted: Fri Feb 27, 2009 9:02 am    Post subject: Reply with quote

I will try and google it and try to solve it that way... Thanks for your help though MARK, much appreciated Smile
Back to top
View user's profile Send private message
saddlebite



Joined: 17 Feb 2009
Posts: 20

PostPosted: Wed Mar 04, 2009 12:15 pm    Post subject: Transferring Variable Values Reply with quote

Hi Mark... I wanted to know if it is possible to transfer variable values between scripts... For example, if I have 2 PHP scripts called '3.php' and '2.php' and if the code of '3.php' is as follows:

<?php //3.php

$form=new HTML_QuickForm('form','post','3.php');
$form->addElement('text','myName','Name:');
$form->addElement('submit','submit','submit');

$name=$form->exportValue('myName');

$form->display();

?>


Is it possible to transfer the variable($name) along with the same value to the script named "2.php"?

Thanks
Back to top
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1210

PostPosted: Wed Mar 04, 2009 4:19 pm    Post subject: Reply with quote

How do you redirect to 2.php? I only see code that is related to 3.php.

A possible solution is to use session variables to store the value in 3.php and to read it in 2.php. => www.php.net/session
Back to top
View user's profile Send private message
saddlebite



Joined: 17 Feb 2009
Posts: 20

PostPosted: Wed Mar 04, 2009 7:34 pm    Post subject: Reply with quote

Assuming I redirect it to '2.php', either using the header function or setting the action to '2.php'.... will check out the link...

Thanks Mark
Back to top
View user's profile Send private message
saddlebite



Joined: 17 Feb 2009
Posts: 20

PostPosted: Tue Jun 30, 2009 8:59 pm    Post subject: Sessions and cookies Reply with quote

Hi Mark... How are you doing... got 2 doubts with respect to sessions

1.)
I want to know if it is possible for a user to access and manipulate session variables...

For example if I set a session variable as

$_SESSION['user']="David"

Can a user access this Session Variable and change it to John

2.)

I got the following error message:

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\php5\PEAR\HTML\Common.php:432) in C:\Apache2\htdocs\boot2h\login.php on line 21

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\php5\PEAR\HTML\Common.php:432) in C:\Apache2\htdocs\boot2h\login.php on line 21

I then changed session_start(); to appear on the first line of code and the error message disappeared

I have installed php on 2 different computers...
Both run on windows XP

I did not have this problem with my 1st computer

Why is this happening?

Thanks
Back to top
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1210

PostPosted: Wed Jul 01, 2009 10:37 pm    Post subject: Re: Sessions and cookies Reply with quote

saddlebite wrote:
1.)
I want to know if it is possible for a user to access and manipulate session variables...

For example if I set a session variable as

$_SESSION['user']="David"

Can a user access this Session Variable and change it to John


This isn't related to PEAR ...

=> http://de.php.net/manual/en/session.security.php

saddlebite wrote:
2.)

I got the following error message:

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\php5\PEAR\HTML\Common.php:432) in C:\Apache2\htdocs\boot2h\login.php on line 21 [...]


Well, the message tells you where the problem is: line 432 of Common.php. Maybe on old version that ends with whitespace after the closing PHP tag?
Back to top
View user's profile Send private message
saddlebite



Joined: 17 Feb 2009
Posts: 20

PostPosted: Thu Jul 02, 2009 5:25 pm    Post subject: Thanks Reply with quote

Thanks Mark.. You're reply helped a lot... Smile

The reason I asked the PHP question is cause I could not find any PHP forums to join...

Thanks once again...

Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> Documentation, Tutorials, How to's All times are GMT + 2 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement

'Actiemonitor' online projectmanagement software