Looking the Method that MANUALLY INSTALL PHP on OSX Yosemite

162 Views Asked by At

I am looking the method that Manually Installation of PHP, No Homebrew(Package Installation), Just .tar archive only. I've searched few days on Google, but I still can't find the proper method.

2

There are 2 best solutions below

2
On BEST ANSWER

Before thinking about installing PHP manually in your OS X, I would like to give you some updates regarding OS X Yosemite.

[1] Yosemite includes Apache 2.4, so you don't need to worry about Apache installation.

[2] Mac OS X runs atop UNIX. So most UNIX software installs easily on Mac OS X. Furthermore, Apache and PHP come packaged with OS X. To create a local web server, all you need to do is enable them and install MySQL.

Now here is step by step process to install PHP and Mysql -

  1. First, open the Terminal app and switch to the root user to avoid permission issues while running these commands.

    sudo su -

  2. Enable Apache on Mac OS X by this command.

    apachectl start

    Now you can check localhost by accessing http://localhost . If it is working it will show it works!

  3. Before enabling PHP for apache create a backup of the default Apache configuration which will be helpful for comparison against future versions of Mac OS X and then enable PHP for APACHE -

    cd /etc/apache2/

    cp httpd.conf httpd.conf.bak

  4. Now edit the Apache configuration. Feel free to use TextEdit if you are not familiar with vi.

    vi httpd.conf

  5. Uncomment the following line (remove #):

    LoadModule php5_module libexec/apache2/libphp5.so

  6. Restart Apache:

    apachectl restart

  7. You can verify PHP is enabled by creating a phpinfo() page in your DocumentRoot.The default DocumentRoot for Mac OS X Yosemite is /Library /WebServer/Documents. You can verify this from your Apache configuration.

    grep DocumentRoot httpd.conf

    Now create the phpinfo() page in your DocumentRoot:

    echo '<?php phpinfo();' > /Library/WebServer/Documents/phpinfo.php

    Verify PHP by accessing http://localhost/phpinfo.php

  8. Install Mysql on OS X :

    Download the MySQL DMG for Mac OS X

    Install MySQL

  9. The README suggests creating aliases for mysql and mysqladmin. However there are other commands that are helpful such as mysqldump. Instead, I updated my path to include /usr/local/mysql/bin.

    export PATH=/usr/local/mysql/bin:$PATH

    Note: You will need to open a new Terminal window or run the command above for your path to update.

    I also run mysql_secure_installation. While this isn’t necessary, it’s good practice.

  10. Connect PHP and MySQL

    You need to ensure PHP and MySQL can communicate with one another. There are several options to do so. I do the following:

    cd /var

    mkdir mysql

    cd mysql

    ln -s /tmp/mysql.sock mysql.sock

  11. Additional Configuration (optional)

    The default configuration for Apache 2.4 on OS X Yosemite seemed pretty lean. For example, common modules like mod_rewrite were disabled. You may consider enabling this now to avoid forgetting they are disabled in the future.

    I edited my Apache Configration:

    vi /etc/apache2/httpd.conf

    I uncommented the following lines (remove #):

    LoadModule deflate_module libexec/apache2/mod_deflate.so LoadModule expires_module libexec/apache2/mod_expires.so LoadModule rewrite_module libexec/apache2/mod_rewrite.so

So these were the steps to install PHP Manually .I hope it will be helpfull. :-)

0
On

This should do the trick to compile it manually: http://php.net/manual/en/install.macosx.compile.php