Abhimanyu
Abhimanyu

Reputation: 369

php command line

i m trying to use mcrypt_decrypt from commond line but i m getting the folllowing error:-

  Call to undefined function mcrypt_decrypt() in Command line code on line 1

Any idea ? and any other alternative solution because i m using os:cmd() from erlang to achive this.since erlang do have function to achieve this but i m unable to figure out whats worng in that.so thought of doing like this so that i verify the things.

thanx in advanced

Upvotes: 1

Views: 911

Answers (4)

Fernando
Fernando

Reputation: 1

Try specifying the complete path of php binary in command line. For instance:

/Applications/XAMPP/xamppfiles/bin/php someprogram.php

It's works for me.

Upvotes: 0

rasjani
rasjani

Reputation: 7970

And going still abit further, it might be that its not even compiled so enabling it from php.ini doesnt help at all. And how to determinate that depends on the os where you run php-cli.

Addition:

Original poster indicated that he's running on ubuntu. So, how to make it work:

sudo apt-get install php5-mcrypt

And note, there are on ".dll" files in linux, dll refers to "dynamicaly loaded library" its used in windows, linux equivalent is ".so" and im pretty sure that you havent just installed the mcrypt packages.

Upvotes: 2

JasonV
JasonV

Reputation: 596

Going further on what Greg said, uncomment the correct line by removing the ";" in front of mcrypt.dll

(I think it's mcrypt.dll)

Upvotes: 0

Greg
Greg

Reputation: 321806

It means that the mcrypt extension isn't being loaded - make sure you're loading the right php.ini from the command line.

Upvotes: 3

Related Questions