2

I want to display the PHP version on my page, and I have two PHP binaries on my server. One is used for the website (i.e. used by the content in /public_html/) and the other one is used by the command line.

Both the PHP have different version so I want to display the CLI PHP version using the web server. I have the path of both binaries.

I am using:

exec('/usr/bin/php-cli -r "echo phpversion();"', $phpversion, $ret);
echo $phpversion = implode('', $phpversion);

But it is giving me some ascii code which is not recognized by my browser.

The out put I get is �2�3�34��V.B

What's going wrong?

1
  • why don't you use "php-cli --version" instead? Commented Sep 8, 2012 at 10:43

2 Answers 2

1

I managed to fix the issue. This issue was coming because zlib.output_compression was turned on. I just turned it off and it resolved the problem. Thanks for the replies guys.

Sign up to request clarification or add additional context in comments.

Comments

0

Its a characterset issue.

Before sending any output to your browser do:

header('Content-Type: text/html; charset=utf-8');

Your browser has, as I see it, another default as UTF-8. When I run your code I get "5.4.6-1~dotdeb.0"

1 Comment

I have charset as utf-8 but than also it is giving me the same issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.