Apache/PHP installation on OSX differences?

General Tech Bugs & Fixes 2 years ago

0 2 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (2)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

 

I'm wanting to update the local version of PHP on my Mac.. i've been doing some digging and got a little confused.

If i run php -i from the terminal it says:

    $ php -i
    phpinfo()
    PHP Version => 5.3.15
    Configuration File (php.ini) Path => /etc
    Loaded Configuration File => 

I was sure i had 5.4 installed so ran phpinfo();

    PHP Version 5.4.5
    Loaded config file: /usr/local/php5/lib/php.ini

A problem i'm having is i can't seem to make any php.ini file work, i'm getting lots of

    Notice: Undefined index:

errors, so error reporting is too high, but no matter how many php.ini files i find and edit it's not taking effect..

I have no idea which version of PHP is being used or why there is two.

Is it possible to disable or remove one of them so i know exactly whats going on, and then i can update it to a newer version?

Thanks,

profilepic.png
manpreet 2 years ago

You have two PHP-installations on your Mac. One of them is the default OS-X php whos binary is located under /usr/bin/php and the other one seems to be a kind of the liip one-line installer which is located under /usr/local/php5

When you call php -i on the command-line the MacOS-X default php under /usr/bin is called. And when you run a phpinfo()-script your WebServer calls the apache-module of the PHP located under /usr/local/php5.

So when you want to remove one of your installations, I'd recommend removing the one under /usr/local/php5 as the otehr one is bundled with your OS and the files are located all over the filesystem and it's not that easy to get rid of everything related.

But if you want to upgrade your PHP installation you might simply call the one-line-installer from liip again which will install the new version in a new directory under /usr/local/ and link it against the /usr/local/php5-folder.

And if you want to call those new binaries you can either adapt your $PATH-Variable so that /usr/local/php5/bin comes before /usr/bin or you simply call it directly usig the full path to the binary like /usr/local/php5/bin/php -i.


0 views   0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.

tuteehub community

Join Our Community Today

Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.

tuteehub community