Testing your PHP CLI binary installation

Question:

How do I verify that my PHP CLI binary is installed correctly?

-OR-

During installation I receive the following error:

Your PHP CLI binary does not appear to be working correctly. Please

correct this problem and then restart this installation script.

What does this mean, and how do I correct it?

Answer:

Before beginning the installation of Centova Cast, the installer asks your PHP command line interpreter (CLI) to run a simple test script which outputs the word "test". If it outputs anything other than just the word "test", then it is malfunctioning and the installer will abort.

How do I test the PHP CLI myself?

To test the CLI yourself, you may run the following command from a shell prompt (i.e., SSH or similar):

echo '<?php echo "test\n"; ?>' > test.php

php -q test.php

Copy and paste the above to ensure that you run it exactly as shown above.

In response, PHP should output the word "test", and only the word "test". If it does not output the word "test", or if it outputs any other text as well, then something is wrong with your PHP CLI and will need to be fixed before you install Centova Cast.

How do I determine what is wrong?

Due to the wide variety of system configurations and potential server problems, it would be impossible to compose a complete list of every possible issue that could result in a broken PHP CLI binary.

Your qualified systems administrator will need to evaluate your server, diagnose the issue for you, and take the necessary steps to correct it.

Here are a few places for your systems administrator to begin diagnosis:

  • Does your PHP CLI's version number match your PHP Apache module's version number? (Run "php -v" from a shell prompt to test your CLI version, and check the output of phpinfo() to check your Apache module version.)

If the version numbers do not match, it's possible that a PHP upgrade was previously performed on your server, but only the PHP Apache module was updated. In this case, the PHP extensions on which the CLI depends may have been replaced with the newer Apache module's extensions.

Repair this by upgrading your PHP CLI binary to match your PHP Apache module's version.

  • When running the test command provided above, do you receive warnings similar to the following?

PHP Warning: mime_magic: type xxx invalid in Unknown on line 0

If so, you'll need to modify your magic.mime file as described here:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=361789

  • Depending on your OS distribution and/or how PHP was built, your PHP CLI may use a different configuration file than your PHP Apache module.

Systems administrators sometimes forget about this when making changes to the PHP configuration, which leads to the PHP Apache module working correctly while the PHP CLI does not.

If you suspect that this may be the problem, try backing up your PHP CLI configuration file, then overwriting it with a copy of your PHP Apache module's configuration file.

  • Is there an alternate PHP CLI binary in /bin/php, /usr/bin/php, /usr/local/bin/php, or elsewhere on your server? If so, does it work correctly?

It's possible that during a past upgrade, the PHP CLI binary was installed in a different location. This may have resulted in the old PHP CLI binary being broken, whereas the new one still works fine. Centova Cast uses your shell search path to find your PHP CLI binary, so if the old (broken) binary happens to be found before the new (working) one, the broken one will always be used.

You can resolve this by removing (or renaming) the old, broken CLI binary, then creating a symlink in its place which points to the new, working one.

  • When running the test command provided above, do you receive other warnings or errors?

If so, search Google for the text of those errors. There's a good chance that someone else has encountered (and resolved) this issue before you.

Will you fix my PHP CLI for me?

PHP CLI binary problems, like any other server configuration problem, are not covered as part of the Centova Cast support agreement. If you require assistance in repairing your PHP CLI, we recommend hiring a qualified systems administrator to diagnose and repair your server.

If you wish to hire one of Centova Technologies' experienced technicians to work on your server, please contact the sales department. Professional services such as this are billed in advance at a rate of USD$70 per hour.

Please note that due to the unpredictability of problems such as this, we will NOT be able to provide a precise up-front quote. A non-refundable diagnostic fee of one hour will be assessed, during which time we will evaluate your server and attempt to diagnose the problem. If a resolution can be achieved within the first hour, there will be no additional fee. Otherwise, we will contact you after the first hour with a quote for the remainder of the job.

Can I just remove the test line from the installer to bypass it?

The test is there for good reason -- in order to operate correctly, Centova Cast itself requires a fully-functional PHP CLI.

If you remove the test from the installer, Centova Cast might install correctly, however you will likely run into bizarre problems when actually attempting to use Centova Cast after it is installed. Our technical support department will not be able to assist you if it is determined that your PHP CLI is broken after installation.