Thursday, January 28, 2010

Mac OS X Install MySQL, Apache + mod_xsendfile, PHP with iconv, gd, pdo, and bug fixes, and PHPMyAdmin

apache:
- for apache + mod_xsendfile, read the blog post regarding on mod_xsendfile compiling w/in mac os x for apache module

php:

sudo CFLAGS="-arch x86_64 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch x86_64 -g -Os -pipe" CXXFLAGS="-arch x86_64 -g -Os -pipe" LDFLAGS="-arch x86_64 -bind_at_load" './configure' '--prefix=/usr' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--with-config-file-path=/etc/' '--with-config-file-scan-dir=/opt/local/var/db/php5' '--enable-bcmath' '--enable-ctype' '--enable-dom' '--enable-fileinfo' '--enable-filter' '--enable-hash' '--enable-json' '--enable-libxml' '--enable-pdo' '--enable-phar' '--enable-session' '--enable-simplexml' '--enable-tokenizer' '--enable-xml' '--enable-xmlreader' '--enable-xmlwriter' '--with-bz2=/opt/local' '--with-mhash=/opt/local' '--with-pcre-regex=/opt/local' '--with-readline=/opt/local' '--with-libxml-dir=/opt/local' '--with-zlib=/opt/local' '--disable-cgi' '--with-ldap=/usr' '--with-apxs2=/opt/local/apache2/bin/apxs' '--with-mysqli=/usr/local/mysql/bin/mysql_config' '--with-openssl' '--with-mcrypt=/opt/local/' '--with-mysql=/usr/local/mysql-5.1.42-osx10.6-x86_64/' '--with-iconv=/usr' '--with-curl=/opt/local' '--enable-mbstring' '--with-gd' '--with-jpeg-dir=/opt/local' '--with-png-dir=/opt/local' '--with-freetype-dir=/opt/local' '--with-t1lib=/opt/local' '--enable-gd-native-ttf'  --with-ttf


- afer running ./configure successfully, vi Makefile, then add -lresolv in EXTRA_LIBS assignment which would avoid the "error _res_9_dn_expand" as undefined symbol (in php 5.2.12 this is fixed and won't be encountered anymore).
- save then run make
- with-iconv problem bug was "_iconv_close" undefined symbol and the fix was  I did use the php 5.2.12 version and it works smoothly.
- for php with mysql, use the downloaded mysql which are located in /usr/local/mysql-5.1.42-osx10.6-x86_64/ which contains the headers and the source, then point that thru '--with-mysql=/usr/local/mysql-5.1.42-osx10.6-x86_64/'
- --with-ttf and --enable-gd-native-ttf will avoid this error:
Fatal error: Call to undefined function imagettftext()
Encountering the error above, you must also make clean before issuing the "make" command, else error will still keep resuming


mysql:
- http://dev.mysql.com/downloads/mysql/4.0.html then chose the Mac OS X ver. 10.6 (x86, 64-bit), DMG Archive
- install
- system preferences, start mysql or start mysql  on startup
- files are in /usr/local/mysql

phpmyadmin:
- PHP Fatal error: Class 'ArrayObject' not found in /www/phpmyadmin/libraries/List.class.php on line 14
- workaround is download thru PEAR though I manage it by copying the PEAR contents from my slackware linux box
- ArrayObject is part of SPL (Standard PHP Library)


Mounting A Shared Folder from Mac OS X running samba to Linux

By executing the code below:

mount -t cifs -o uid=1001,gid=100,username=boboyshariff //mymacosxnetbiosname/www ws_mac/www/

-t = cifs is the filing system rather than smbfs where CIFS stands for Common Internet File System (CIFS) is a protocol that lets programs make requests for files and services on remote computers on the Internet. When trying to use smbfs, you will be prompted by a kernel warning saying "smbfs is deprecated and will be removed from the 2.6.27 kernel. Please migrate to cifs"

-o = if you specify some options specially when dealing with file permission and ownership or account credentials on accessing the smb server remotely. uid is what user id is to be used when it's shared to your linux local, gid where the group id to be used for the directory permission and username is the username from remote server running samba. Note that password will be prompted afterwards which is pretty secure.


Note also that mymacosxnetbiosname can be an ip or a domain name.