Issue
I have a hard drive that used to be in a server, now I'm trying to find out what exact version of php was installed on the server. I know it was version 4 because the folder it's in is /etc/php4, but I'm wondering if there is a config file, or some file somewhere that would tell me what exact version it is. I check php.ini and that didn't have it. The OS was debian. Thanks!
Solution
If you can find the php
executable, you can probably extract the version number from within using the strings
utility on Linux. In my case (Ubuntu Linux), it's in /usr/bin/php
.
If I then run
# strings /usr/bin/php | grep X-Powered-By
I get:
X-Powered-By: PHP/5.3.2-1ubuntu4.9
If you can't find that string, try this:
# strings /usr/bin/php | grep buildd
for which I get (lots of examples of the version number there):
/build/buildd/php5-5.3.2/ext/phar/phar.c
/build/buildd/php5-5.3.2/ext/phar/phar_object.c
/build/buildd/php5-5.3.2/ext/soap/soap.c
/build/buildd/php5-5.3.2/ext/standard/assert.c
/build/buildd/php5-5.3.2/main/main.c
/build/buildd/php5-5.3.2/main/output.c
/build/buildd/php5-5.3.2/Zend/zend_alloc.c
/build/buildd/php5-5.3.2/Zend/zend_opcode.c
/build/buildd/php5-5.3.2/Zend/zend_alloc_canary.c
/build/buildd/php5-5.3.2/Zend/zend_objects_API.c
/build/buildd/php5-5.3.2/Zend/zend_vm_execute.h
Telling me that the PHP version is 5.3.2.
Answered By - JJ.