0

PHP command line on my OS X has the built in Mavericks version: 5.4.24

I have compiled and configured my own php to work with apache, which is version: 5.5.9

The command line version is sitting in /usr/bin and I can rename it to stop it working but don't have a clue where or how to get my compiled (5.5.9) version working through the command line

The 5.5 version has a libphp5.so file that sits under /usr/libexec/apache2

Guys this is a compiled version on a MAC so I did not install it with yum or apt-get or homebrew or ports.

To be clear I am trying to work out how to run the 5.5.9 version from the command line.

Adding COMPOSER-PHP tag as I want to use composer on this Mavericks build which does not support mcrypt without my lovely compiled php, which I can't find!!!!

Here is the configure info:

'./configure' '--prefix=/usr' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--sysconfdir=/private/etc' '--with-apxs2=/usr/sbin/apxs' '--enable-cli' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/Library/Server/Web/Config/php' '--with-libxml-dir=/usr' '--with-openssl=/usr' '--with-kerberos=/usr' '--with-zlib=/usr' '--enable-bcmath' '--with-bz2=/usr' '--enable-calendar' '--disable-cgi' '--with-curl=/usr' '--enable-dba' '--enable-exif' '--enable-fpm' '--enable-ftp' '--with-gd' '--with-jpeg-dir=/BinaryCache/apache_mod_php/apache_mod_php-87~65/Root/usr/local' '--with-png-dir=/BinaryCache/apache_mod_php/apache_mod_php-87~65/Root/usr/local' '--enable-gd-native-ttf' '--with-icu-dir=/usr' '--with-ldap=/usr' '--with-ldap-sasl=/usr' '--with-libedit=/usr' '--enable-mbstring' '--enable-mbregex' '--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--without-pear' '--with-pdo-mysql=mysqlnd' '--with-mysql-sock=/var/mysql/mysql.sock' '--with-readline=/usr' '--enable-shmop' '--with-snmp=/usr' '--enable-soap' '--enable-sockets' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--with-tidy' '--enable-wddx' '--with-xmlrpc' '--with-iconv-dir=/usr' '--with-xsl=/usr' '--enable-zip' '--with-pcre-regex' '--with-mcrypt' '--with-freetype-dir=/usr/X11R6' '--enable-builtin-freetype'

The Mavericks (5.4.24) version is here:

/usr/bin/php -v

Where is my (5.5.9) version??

.so files:

/Users/lisa/src/php-5.5.9/libs/libphp5.so  
/usr/libexec/apache2/libphp5.so  
Lisa
  • 23
  • 4
  • Well, does not OSX not have a software management? I only know Linux, there you can ask the software management about every package installed, for example what files it contains... Otherwise you can use phps builtin functioon `phpinfo()` to get information about the engine. Maybe you find usable information about the engine in there. – arkascha Apr 02 '14 at 21:01
  • Thanks for responding arkascha, I am not sure about software management on osx, what was the one in Linux called? I did try phpinfo() on both versions but it does not give any clue as to how to get the command line using the 5.5 version...? – Lisa Apr 02 '14 at 21:13
  • Different linux distributions use different software management systems, but their purpose and basic function is identical. Anyways, that does not help you. If phpinfo does not offer any insight, then check in your http servers configuration. Somewhere the php executable or library must be configured that is used to interpret php scripts. Be aware that this might only be a library, typically http servers do not use php executables for such tasks these days. – arkascha Apr 02 '14 at 21:19
  • I gave that, its: /usr/libexec/apache2/libphp5.so but its an .so file so can't be used from the command line?? – Lisa Apr 03 '14 at 05:53
  • Hello - anybody alive out there? – Lisa Apr 16 '14 at 20:15
  • Sure, and yes, that is a library which is exactly what I predicted in the comment before. You just have to accept that php comes in different versions: as a module (library), which can be used directly inside for example apache, as a cli executable which can be used on the command line or as cgi executable and as a fastcgi container for a fastcgi server. These versions are separate and it depends on your compilation run which version(s) are built and installed and where they are installed. That is something only you can find out on your system. – arkascha Apr 16 '14 at 20:51
  • Hi @arkascha, thank you again for your responses :-) They are not really helping me as you have admitted you don't really know anything about osx. I really need help understanding why the command line php version is different on my osx box ;-( – Lisa Apr 18 '14 at 08:53
  • Is there anybody else out there that know what I need to do or am I being really blond here? – Lisa Apr 18 '14 at 08:53
  • You say you compiled it yourself.. what options did you give .configure? There should also be a binary somewhere which needs to be added to $PATH.. – VF_ Apr 25 '14 at 10:05
  • Its the binary that I can't find - any ideas? – Lisa Apr 25 '14 at 10:12

1 Answers1

0

If you compiled it yourself, give us the command you used for that. From there, we can give you some idea as to where it is.

Alternatively, from a command prompt, type

find / -type f -iname '*php*' -print

which will find every file with PHP in the name.

If you're only looking for the libphp5.so file then use

find / -type f -iname 'libphp5.so' -print

It's probably best to run this with higher privileges than normal (sudo it)

DaveyBoy
  • 2,928
  • 2
  • 17
  • 27
  • Did a search for php files - found tones of them as its what I do so there were lots of php files, but only one binary. Found the .so files @DaveyBoy (see above). One for my apache and one for where I compiled php. How can I make them into a binary for php? – Lisa Apr 25 '14 at 15:45
  • The `.so` file is the Apache mod file. The other file (hopefully called just php) is the binary for command line use. Did you actually run the command to install PHP? Simply compiling it will leave the resultant files in the source folder. I know when I compile PHP on Linux, a `make install` command is required to actually get the files into the correct locations. Checking the INSTALL file with the source code says to use the Unix installation guide – DaveyBoy Apr 28 '14 at 13:24
  • You, @DaveyBoy are a star! I could kiss you!! Yes, I did make install because I got the php working in apache but on closer inspection there was an error saying "sed: RE error: illegal byte sequence" - I must have missed that last time. This I fixed by adding stuff - see [link](http://stackoverflow.com/questions/19242275/sed-re-error-illegal-byte-sequence-on-mac-os-x) and yippee PHP 5.5.9 (cli) (built: Feb 23 2014 19:40:09) Virtual hugs coming your way, thank you :-) – Lisa Apr 28 '14 at 19:34
  • No prob @Lisa. Glad you got it working OK. It's worth keeping the `config.nice` file from the source code folder for future reference (especially as PHP 5.5.11 is now available). You can just copy the `config.nice` file to a different PHP source folder, run it and it will configure a new version with all the options you used in the earlier version. It saves a hell of a lot of typing. I've found that they are pretty compatible between versions too (i.e. 5.4.x -> 5.5.x). Actually, you probably already know this but it's always worth mentioning just in case someone doesn't) – DaveyBoy Apr 28 '14 at 21:11