Month: March 2013

Installing XCode and Mac Ports

1) Download XCode from Apple from the page: https://developer.apple.com/technologies/tools/ After you ‘ok’ the license install the command line tools by going to XCode->Preferences then clicking on Download.  Next click on the ‘Install’ button to download and install the command line tools.

Download and install mac port.

port search <search string>

Next from the command line Install Apache2:

sudo port install apache2

Next install PHP,

sudo port install php5 +apache2 +mysql5 +pear

Enable PHP in apache by typing:

cd /opt/local/apache2/modules
sudo /opt/local/apache2/bin/apxs -a -e -n “php5” libphp5.so

Setting up named based hosting directory:

edit the httpd.conf file with your favorite editor, in this example I am using joe.

sudo joe /opt/local/apache2/conf/extra/httpd-vhosts.conf

Comment out all the existing virtual hosting and add a configuration for named based virtual hosting:

#
# Use name-based virtual hosting.
#
<VirtualHost *:80>
# include the server name in the filenames used to satisfy requests
  VirtualDocumentRoot /var/www/%1/public
  VirtualScriptAlias /var/www/%1/cgi-bin
  SetEnv APPLICATION_ENV “development”
  php_value include_path “.:/var/lib/Zend/ZendFramework-1.12.0/library”
  ServerAlias *.zendlocal.com
    <Directory “/”>
        Options Indexes FollowSymLinks Includes
        AllowOverride All
        Allow from All                                             
    </Directory>                        
                                        
</VirtualHost> 

Now create the web directory:

sudo mkdir /var/www

Now set the permission for the directory (Note, this is for a development system not production)

sudo chmod a+rw /var/www

Edit your host file to add some hosts:

127.0.0.1       test.zendlocal.com

Find and un-comment the line in your httpd.conf file:

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

# PHP5 Config
Include conf/extra/mod_php.conf

<IfModule dir_module>
    DirectoryIndex index.html index.php index.phtml
</IfModule>

 

Extract zend framework into your lib directory from the httpd-vhost.conf file (Note your version my vary).

/var/lib/Zend/ZendFramework-1.12.3/

MySQL +Server:

sudo port install mysql55 +server

sudo port install mysql55-server

 

sudo /opt/local/lib/mysql5/bin/mysql_install_db –user=mysql