Friday, 14 October 2011

PHP, Apache & MySQL

Hi,

There are some tutorials active Webserver environment:
  1. Apache:
    1. Root folder: /Library/WebServer/Documents/
    2. Start: sudo apachectl start
    3. Stop: sudo apachectl stop
    4. Restart: sudo apachectl graceful
  2. PHP:
    1. Install:
      1. cd /etc && sudo cp php.ini.default php.ini
      2. sudo vim httpd.conf
      3. Uncomment out the hash # to leave it like:
        • LoadModule php5_module libexec/apache2/libphp5.so
      4. Restart Apache
    2. Warning: date_default_timezone_get():
      • sudo vim /private/etc/php.ini
      • date.timezone = "UTC"
    3. autoconf:
      1. Install:
        • Install Xcode
        • Launch Xcode > Preferences > Downloads > Install 'Command Line Tools'
      2. Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script.
        • curl -O http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz
        • tar xvfz autoconf-latest.tar.gz
        • cd autoconf-2.69/
        • ./configure
        • make
        • sudo make install
    4. Missing extension:
      • http://www.coolestguyplanettech.com/how-to-install-mcrypt-for-php-on-mac-osx-lion-10-7-development-server/
      • Download the PHP's source code. You'll need to download the one that matches the version already installed on your system. To find out which one you're using, type php -v from the command line.
      • Extract the archive you downloaded using tar -zxvf followed by the filename. Type cd php-5.4.x/ext/sqlite3/ (where "5.4.x" should be replaced with your version number and "sqlite3" can be any of the modules you want to install from your list above minus the "php_" prefix)
      • Type phpize
      • Type ./configure
      • Type make
      • Type sudo make install
      • Find shared extenstions folder:
        • E.G.: /usr/lib/php/extensions/no-debug-non-zts-20090626/
      • Add extension_dir = "/usr/lib/php/extensions/no-debug-non-zts-20090626" to your php.ini
      • Add extension=sqlite3.so to your php.ini (again make sure to replace sqlite3.so with the name of the other extensions if you compile the others).
      • Restart Apache
    5. Or you can try this tutorials:
      • http://php-osx.liip.ch/
  3. MySQL:
    1. Install:
      • Go to: http://dev.mysql.com/downloads/mysql/
      • Download DMG file for your current operation: Mac OS X ver. 10.6 (x86, 64-bit), DMG Archive
      • Open the downloaded file and double click the file called mysql-x.x.xx-osx10.x-x86_64.pkg and continue through the installation
        • App can’t be opened because it is from an unidentified developer: http://osxdaily.com/2012/07/27/app-cant-be-opened-because-it-is-from-an-unidentified-developer/
      • Installation: MySQL.prefPane, MySQLStartupItem.pkg
    2. Enable command line:
      • sudo vim /etc/paths
      • Appended the line:
        • /usr/local/mysql/bin
      • Restart OS
    3. Missing /var/mysql/mysql.sock file:
      • Check it at:
        • /private/tmp/mysql.sock
        • /tmp/mysql.sock
        • /usr/local/mysql/run/mysql_socket
      • Try create symbolic link for: /var/mysql/mysql.sock
        • sudo ln -s /private/tmp/mysql.sock /var/mysql/mysql.sock
        • sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
        • sudo ln -s /usr/local/mysql/run/mysql_socket /var/mysql/mysql.sock
    4. Reference:
      • http://blog.mclaughlinsoftware.com/2011/02/10/mac-os-x-mysql-install/
Good luck!

No comments:

Post a Comment