4

I am currently trying to install a php extension on my computer. I am in the process of developing a new site and I am using LAMPP. I used PECL to install the syck YAML extension so that I can parse YAML to a PHP array in a file that will run daily with cronjobs.

In the process of trying to install it, I broke LAMPP and had to re-install it, but I got the extension installed. Here's the kicker! The extension was installed on PHP5 that is called by the terminal.

If I:

# php ./politicianupdate.php

It runs as it should, but it is not using the php installation inside of lampp, which is a problem because the php being ran from the terminal is not linked up to my databases, which I need to keep the data current.

Two things I need to figure out: how I can call a .php file from the terminal using the php installation in lampp, and the other thing I need to know is how can I point a PECL/PEAR installation at the installation of php in lampp?

The output of whereis php is:

php: /usr/bin/php /usr/bin/X11/php /usr/share/php /opt/lampp/bin/php /usr/share/man/man1/php.1.gz
1
  • 1
    What is the output of whereis php command? Aug 28, 2013 at 18:49

1 Answer 1

2

Then I suggest you to use:

/opt/lampp/bin/php ./politicianupdate.php

If is ok, then check with ls -l /usr/bin/php if is a symbolic link. If yes, and if you would like, remove it then create a new one to /opt/lampp/bin/php:

ln -sf /opt/lampp/bin/php /usr/bin/php
6
  • 2
    This creates a hardlink, not a symlink. For a symlink, you need -s.
    – Lekensteyn
    Aug 28, 2013 at 19:39
  • I did this, and now if I go to the directory that contains the php file I want to run and run this command: # php ./phpfile.php I get an error: bash: /usr/bin/php: No such file or directory.
    – user27038
    Aug 28, 2013 at 20:07
  • @user27038 which command? Aug 28, 2013 at 20:09
  • -sf rather than -f alone just fixed it. Thank you.
    – user27038
    Aug 28, 2013 at 20:09
  • The command was "php ./thephpfile.php"
    – user27038
    Aug 28, 2013 at 20:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .