I have recently purchased a macbook pro and wanted to set up my web development environment on it. A lot of people seem to download MAMP, but I have (so far) being able to avoid this.
Opened Terminal, and Apache 2.2.9 is already installed. (use httpd -v to see this)
sudo -u root -s
to shell in as root and not have to write sudo everywhere.
I needed to get PHP 5 running, even though it was installed it needed enabling. I edited /etc/apache2/httpd.conf and uncommented:
LoadModule php5_module libexec/apache2/libphp5.so
then restarted apache using:
Now for mySQL installation. I went to mySQL and downloaded the 'community edition' Mac package and installed it. I also installed the startup script that came with the download. This allowed me to start mySQL using:
I wanted to be able to run PHP from the command line, so I added the necessary modifications to local environment variables using setvar - look this one up.
I needed PECL and PEAR so I followed this article to get it installed:
Pear is now under /usr/local/bin/pear - this will be handy to know when specifying the location of symfony later.
Installed symfony using the guide here:
pear channel-discover pear.symfony-project.com
pear install symfony/symfony-1.2.1
I would recommend a newcomer to symfony should follow the tutorial here
When you get to day 3, you will face the command:
php symfony propel:insert-sql
This will not work with the error:
Some problems occurred when executing the task:
build-propel.xml:275:1: [wrapped: could not find driver]
Read the logs to fix them
I could not find any logs, but the problem was a lack of PDO support for mySQL. After searching around, I found articles where people had tried to recompile mysql, recompile php, modify apache to be 32 bit instead of 64 bit, and other ideas. All would possibly work, but all looked quite complicated. Some comments were given saying this may not work on Leopard etc. So I kept searching. I found this article:
Because PECL was already installed (with PEAR above), I tried:
pecl install PDO_MYSQL
(note this is case sensitive)
got an error:
ERROR: `make INSTALL_ROOT="/var/tmp/pear-build-root/install-PDO-1.0.3" install' failed
ERROR: `/usr/local/temp/PDO_MYSQL/configure' failed
so I needed to bypass the standard pecl install. I followed: http://discussions.apple.com/thread.jspa?threadID=1539743&tstart=75
but this had the wrong path for the location of mysql, so modified it to:
1. Download PDO_MYSQL / http://pecl.php.net/package/PDO_MYSQL
2. cd ~/Downloads/PDO_MYSQL-x.x.x/PDO_MYSQL-x.x.x
4. ./configure '--with-pdo-mysql=shared,/usr/local/mysql'
5. make install
I modified the existing /etc/php.ini file (if this doesn't exist, make a file named ~/Sites/phpinfo.php with within it, and go to http://localhost/phpinfo.php in your web browser. It should show you where php.ini is located.
I modified extension_dir to:
extension_dir = "/usr/lib/php/extensions/no-debug-non-zts-20060613"
and added the line:
(ignore all the pdo_mysql.dll modules as they are for a PC).
Now restart apache using:
You should be able to run:
And PDO support should display with mysql listed within it.
The problem with the above is that the command:
would not work and, it seems this was because of a fault with versioning of PDO.
So to fix all of this I decided upon Mac Ports, which required the Developer Tools on the OS X Leopard installation CD.
After installing this, I went to macports.org and downloaded the tar package and installed it.
The commands to install were:
port install mysql5 +server
sudo -u root mysql_install_db5
port install apache2
sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist
cp /etc/apache2/httpd.conf /opt/local/apache2/conf/
also found this good tutorial:
AFTER install it told us to do this:
If this is your first install, you might want
/opt/local/apache2/bin/apxs -a -e -n "php5" libphp5.so
* copied the php.ini in /etc/php.ini to to /opt/local/etc/php.ini
port install php5 +apache2 +mysql5
The above command took quite a while, basically copy the tutorial referenced above.
Location of old apache was:
new apache is:
To start APACHE:
/opt/local/apache2/apachectl -k start
to allow "apachectl start" to work from anywhere, modify the path in ~/.profile and add the line at the bottom:
This will mean apachectl in this folder will be run instead of /usr/sbin
the php.ini file used is:
Edit php.ini and modify the following line to read:
mysql.default_socket = /opt/local/var/run/mysql5/mysqld.sock
To run mysql5, use:
mysql5 -u root
You can also set up PHPMyadmin, which will be stored in /opt/local/www/phpmyadmin when you run:
port install phpmyadmin
and follow the documentation at: http://trac.macports.org/wiki/howto/MAMP
To get pear working, you need to modify what is shown in:
then you can modify with:
pear config-set attribute value