Author Topic: running PHP command-line version  (Read 21735 times)

Offline Eric H. Jung

  • grimholtz
  • Administrator
  • *****
  • Posts: 3353
running PHP command-line version
« on: November 15, 2005, 08:15:42 PM »
Hi Miquel,

I'm trying to run test.php, which you really wrote as server-side PHP, as command-line php (PHP 4.4.1 on Windows XP). I don't want to use a php.ini; I want it to be completely stand-alone. So here's what I have:

Code: [Select]
c:\php\cli\php.exe -d extension_dir=/php/extensions -d extension=php_mhash.dll /path/to/test.php

Note I also copied php4ts.dll into c:\php\cli. I also added this as the first line of test.php:

Code: [Select]
ini_set("include_path", ".");
so that include 'passwordmaker_class.php'; would work. However, I'm getting this error:

Quote
MD4 generated password:
Fatal error: Call to undefined function:  mhash() in C:\temp\new\passwordmaker_class.php on line 289

Any ideas?

Regards,
Eric
« Last Edit: November 15, 2005, 08:18:09 PM by Eric H. Jung »

Offline Miquel 'Fire' Burns

  • Administrator
  • *****
  • Posts: 1157
  • Programmer
running PHP command-line version
« Reply #1 on: November 15, 2005, 09:13:52 PM »
Code: [Select]
php.exe -d extension_dir=/php/extensions -z php_mhash.dll /path/to/test.php
FYI, it was written as cli based, otherwise all that test would be on one line. (I love SciTE)

Might be best if we decide to use this for some reason, have a special compiled version of PHP for Windows users.
« Last Edit: November 16, 2005, 09:09:12 PM by Eric H. Jung »
"I'm not drunk, just sleep deprived."

Offline Eric H. Jung

  • grimholtz
  • Administrator
  • *****
  • Posts: 3353
running PHP command-line version
« Reply #2 on: November 16, 2005, 09:08:27 PM »
I'm still getting:

Code: [Select]
C:\temp\new>php.exe -d extension_dir=/php/extensions -z php_mhash.dll  /temp/new/test.php
Failed loading php_mhash.dll
MD4 generated password:
Fatal error: Call to undefined function:  mhash() in C:\temp\new\passwordmaker_class.php on line 289

Any other ideas?

Quote
Might be best if we decide to use this for some reason, have a special compiled version of PHP for Windows users.
How would it be different than the normally-compiled PHP? And yes, I do see a use for this--it's a cross-platform command-line version until the C/C++ edition (the backend of which you are writing) is ready.
« Last Edit: November 16, 2005, 09:13:14 PM by Eric H. Jung »

Offline Miquel 'Fire' Burns

  • Administrator
  • *****
  • Posts: 1157
  • Programmer
running PHP command-line version
« Reply #3 on: November 17, 2005, 03:41:02 AM »
It can't find the php_mhash for some reason. Might want to include the drive letter in the path (and use backslashes as well)

The normally compiled PHP needs you to load the mhash extension, the special compiled version would have it built in, provided you can do that with the Windows version.

BTW, either just post in a topic or PM me next time, not both. That's annoying.
"I'm not drunk, just sleep deprived."

Offline Eric H. Jung

  • grimholtz
  • Administrator
  • *****
  • Posts: 3353
running PHP command-line version
« Reply #4 on: November 17, 2005, 01:30:05 PM »
Quote
BTW, either just post in a topic or PM me next time, not both. That's annoying.
I do that because I don't know when or if someone is subscribed to a topic to which I'd like a response. Anyway, I apologize.
« Last Edit: November 17, 2005, 01:31:37 PM by Eric H. Jung »

Offline Miquel 'Fire' Burns

  • Administrator
  • *****
  • Posts: 1157
  • Programmer
running PHP command-line version
« Reply #5 on: November 17, 2005, 03:23:41 PM »
If the yellow arrow is there, I'll read the topic. (In other words, I read all posts)
"I'm not drunk, just sleep deprived."

Offline Eric H. Jung

  • grimholtz
  • Administrator
  • *****
  • Posts: 3353
running PHP command-line version
« Reply #6 on: November 17, 2005, 04:28:07 PM »
What yellow arrow?

Offline Miquel 'Fire' Burns

  • Administrator
  • *****
  • Posts: 1157
  • Programmer
running PHP command-line version
« Reply #7 on: November 17, 2005, 06:13:58 PM »
Yellow, new, whatever the heck this forum uses.
"I'm not drunk, just sleep deprived."

Offline Romeo

  • Hero Member
  • *****
  • Posts: 561
running PHP command-line version
« Reply #8 on: November 18, 2005, 03:27:53 AM »
Quote
What yellow arrow?
Eric, miquelfire is talking about the yellow double arrow, I believe.    :D
It is impossible to create a fool-proof system, because fools are ingenious.

Offline Miquel 'Fire' Burns

  • Administrator
  • *****
  • Posts: 1157
  • Programmer
running PHP command-line version
« Reply #9 on: November 18, 2005, 03:33:57 AM »
Yea, on the forum index. It's new on the thread list though.
"I'm not drunk, just sleep deprived."

Offline Romeo

  • Hero Member
  • *****
  • Posts: 561
running PHP command-line version
« Reply #10 on: November 18, 2005, 03:47:59 AM »
That's what I thought.  It's in the left most column, too.  I know, because I do precisely the same thing.   :D   I guess Eric subscribes to all the forums and only checks when he gets an email, or should I say fora, Eric ?  :nerd:  Otherwise he would know what we are talking about.
It is impossible to create a fool-proof system, because fools are ingenious.

Offline Eric H. Jung

  • grimholtz
  • Administrator
  • *****
  • Posts: 3353
running PHP command-line version
« Reply #11 on: November 18, 2005, 01:52:48 PM »
That's correct, Romeo. But now I understand the yellow arrow. The email bit doesn't work so well with InvisionFree.com (our current forum host); that's one reason we're taking the forum hosting in-house....

PasswordMaker Forums

running PHP command-line version
« Reply #11 on: November 18, 2005, 01:52:48 PM »