7 Replies Latest reply: Mar 13, 2010 2:48 PM by etresoft
sinkingfish Level 1 Level 1 (0 points)
I seem to have broken the built in php. Anyone have any idea on how to fix it or how to reinstall php.

I tried installing Entropy PHP 5.3.0-3 but that didn't work.

HELP PLEASE

Macbook Unibody 13', Mac OS X (10.6.2)
  • etresoft Level 7 Level 7 (26,560 points)
    sinkingfish wrote:
    I seem to have broken the built in php.


    How so? What did you do?

    Anyone have any idea on how to fix it or how to reinstall php.


    Other than with your Snow Leopard DVD? If you can explain what you did, maybe.
  • sinkingfish Level 1 Level 1 (0 points)
    Sorry I wasn't very clear, just in a blind rage.

    The error I'm getting is "/usr/bin/php: fork: Resource temporarily unavailable". I was attempting to copy a .sh script to the php directory (Zend_Tool stuff to be exact). the guide I was reading suggested finding the directory by typing "which php". This returned /user/etc/php. I was trying to copy the files there but the system was saying the directory doesn't exist. This sis the only thing I can think of which would have broken it.

    I tried reinstalling php with Entropy PHP 5.3.0-3 but no success. I doen't really want to reinstall OSX in case I lose data/apps etc. I'm mid way through a masters and doen't want to have to start setting up my laptop from scratch.

    Brian
  • etresoft Level 7 Level 7 (26,560 points)
    sinkingfish wrote:
    The error I'm getting is "/usr/bin/php: fork: Resource temporarily unavailable". I was attempting to copy a .sh script to the php directory (Zend_Tool stuff to be exact).


    But what did you do? Run the "history" command and it will tell you.

    the guide I was reading suggested finding the directory by typing "which php". This returned /user/etc/php.


    Are you sure about that? "/user" should not be a valid directory. There is a "/usr", but there is no "etc" inside it. There is a "/etc", but there is no "php" inside it. PHP is at "/usr/bin/php". Did you overwrite your PHP executable with a shell script perhaps? Do you have a Time Machine backup?

    I don't think you would have to modify any system directories to install Zend. Can you point me to a web site that says you should?

    I was trying to copy the files there but the system was saying the directory doesn't exist. This sis the only thing I can think of which would have broken it.

    I tried reinstalling php with Entropy PHP 5.3.0-3 but no success.


    Entropy is a well-built package that installs itself into /usr/local, where it won't interfere with other software. If your system PHP is hopelessly scrambled, you should still be able to reconfigure Apache to use the Entropy PHP. There are more instructions on the Entropy site about how to install Entropy PHP. Did you follow those? If you did, but still want to fix and use the system PHP, you will have to undo those changes. If you just want to forge ahead with Entropy, then you should apply those changes.
  • sinkingfish Level 1 Level 1 (0 points)
    Thanks for the response.

    Sorry I mis typed the path in my post - should have read /usr/bin/php.

    I didn't know about the history command. These are the lines were I messed up :

    416 /Users/brian/Downloads/ZendFramework-1.10.2/bin/zf.sh
    417 zf show version
    418 /Users/brian/Downloads/ZendFramework-1.10.2/bin/zf.sh show version
    419 which php
    420 cd /Users/brian/Downloads/ZendFramework-1.10.2/bin
    421 cd . /usr/bin/php
    422 cd * /usr/bin/php
    423 zf\
    424 zf
    425 ls -al
    426 cd *.php /usr/bin/php
    427 cp * /usr/bin/php
    428 cp . /usr/bin/php
    429 cp *.php /usr/bin/php
    430 sudo cp *.php /usr/bin/php
    431 sudo cp * /usr/bin/php
    432 sudo cp *.php /usr/bin/php
    433 sudo cp *.sh /usr/bin/php

    I think I may have overwritten the PHP executable like you suggested. I do have a time machine backup from a few days back but have never used it before, will rolling back solve OS issues ? I had a look on my friends computer, he didn't seem to have a php file in /usr/bin either.

    Thanks again for looking at this.

    Brian
  • etresoft Level 7 Level 7 (26,560 points)
    sinkingfish wrote:
    I think I may have overwritten the PHP executable like you suggested.


    That is exactly what you did - a few times. Be careful that sudo command. It can do things like overwrite your PHP executable.

    I do have a time machine backup from a few days back but have never used it before, will rolling back solve OS issues ?


    Navigate to /usr/bin in the finder with Go > "Go to folder" or shift ⌘ G. Run Time Machine. Find your original "php" and restore only that file.

    I had a look on my friends computer, he didn't seem to have a php file in /usr/bin either.


    That's odd because everyone else has it.

    Now, can you explain just what prompted you to try all of these commands?
  • sinkingfish Level 1 Level 1 (0 points)
    Brilliant, thanks so much for helping me with this. All back working now.

    I was trying to put the zf scrips into a system path, though I was putting them in the php system path, i.e. I thought that /usr/bin/php was a folder and not a file.

    Thanks again

    Brian
  • etresoft Level 7 Level 7 (26,560 points)
    sinkingfish wrote:
    I was trying to put the zf scrips into a system path, though I was putting them in the php system path, i.e. I thought that /usr/bin/php was a folder and not a file.


    I'm very fond of "path_helper" on MacOS X. Run "man path_helper" for more information. You can also edit your PATH variable in .bash_profile.