Monday, March 25, 2019

Config for OSX Mojave 10.14

After upgrade to OSX Mojave 10.14
- php is upgraded to 7
- apache is working, but website is not working
- php is not working
- mysql is not working
- phpmyadmin is not working


Solution:

1) copy old config to /etc/apache2/httpd.conf
- enable php
- add alias
- add directory

2) update php config
- create php.ini
cp /etc/php.ini.default /etc/php.ini
- enable session.save_path

3) install mysql 5.7 (only 5.7 or above support Mojave)
- remove old config
mv /etc/my.cnf /etc/my.cnf.old
- create /etc/my.cnf
[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION
- restart mysql and test
select @@sql_mode;
- remove duplicate icon in system preference

4) download mysqladmin 4.8.5
- create config.inc.php from config.sample.inc.php
- update $cfg['blowfish_secret']
- update $cfg['Servers'][$i]['host'] = 'localhost' to '127.0.0.1'
- add folder ./tmp with owner & group _www

5) update php code for 7

Wednesday, May 28, 2014

Config for OSX Mavericks 10.9

After upgrade to OSX Mavericks:
- apache is not running
- php is not working
- phpMyAdmin is not working

1) update /etc/apache2/httpd.conf

2) create /etc/php.ini

3) restart apache

Monday, January 13, 2014

MySQL Command Line

sudo /usr/local/mysql/support-files/mysql.server start
sudo /usr/local/mysql/support-files/mysql.server stop
sudo /usr/local/mysql/support-files/mysql.server restart

Config MySQL (my.cnf) for OSX Mountain Lion

Mac load default MySQL setting, so there is no my.cnf file. To customize MySQL config:

1) Create you own my.cnf
sudo cp /usr/local/mysql/support-files/my-huge.cnf /etc/my.cnf

2) Update my.cnf

3) Restart MySQL
sudo /usr/local/mysql/support-files/mysql.server restart



Thursday, January 2, 2014

Add Virtual Host for OSX Mountain Lion

Update /etc/apache2/httpd.conf

NameVirtualHost 127.0.0.1

<VirtualHost 127.0.0.1>
DocumentRoot "website_root"
ServerName server_name
</VirtualHost>

<Directory "website_root">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>

Update /etc/hosts

127.0.0.1 server_name

Enable pdo_mysql for OSX Mountain Lion

Update /etc/php.ini

extension=php_pdo_mysql.dll
pdo_mysql.default_socket=/tmp/mysql.sock

Tuesday, April 30, 2013

Enable Apache for OSX Mountain Lion

To enable
sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist

To disable
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist

Monday, December 10, 2012

[小技巧] Mac OS X 內建尋找輸入碼及聯想詞

尋找輸入碼
[shift] + [option] + [L]

聯想詞
[shift] + [option] + [U]

Wednesday, October 3, 2012

Create XCode Project

1. New a project from "Empty Application"

2. Update AppDelegate.h

    - update "window" property as IBOutlet

3. Create AppWindow

    - New a xib named "AppWindow.xib"
    - Change the class of "File's Owner" to UIApplication
    - Add an object to "Objects" and change its class to "App Delegate"
    - Point "File's Owner" outlet named "delegate" to "App Delegate"
    - Point "App Delegate" outlet named "window" to "Window"

4. Point "Main Interface" to AppWindow in target setting

5. Update AppDelegate.m

    - remove code to alloc/init window

6. Create MainViewController

    - New a class from UIViewController with xib named "MainViewController"
    - Do something in the xib, say add a button

7. Update AppDelegate.m

    - load MainViewController in AppDelegate
      MainViewController *vc = [[MainViewController alloc...
      [self.window setRootViewController:vc];

   

Tuesday, August 14, 2012

Sunday, August 12, 2012

Apache Command Line

sudo apachectl start
sudo apachectl stop
sudo apachectl restart

Tuesday, August 2, 2011

Batch Update File/Directory Right

sudo find . -type d -exec chmod 755 {} \;
sudo find . -type f -exec chmod 644 {} \;

Tuesday, June 7, 2011

Install PHP on IIS7

1. Run PHP window installer.

2. inetmgr

3. Handler Mappings
> Add Script Map...
- Request path = *.php
- Executable = ...\php5isapi.dll
- Name = PHP-ISAPI
> OK
> OK

4. ISAPI and CGI Restrictions
> Add...
- ISAPI or CGI path = ...\php5isapi.dll
- Description = PHP
- Allow extension path to execute = checked
> OK (may exist already)

5. Default Document
> Add...
- Name = index.php
> OK

6. Restart IIS

Monday, September 20, 2010

MySQL problem after upgrade to Mac OS 10.6 #2

Mac OS version:
10.6.4

Problem:
phpMyAdmin show following error after login

"Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly."

Solution:
In folder "/etc"
Recreate "php.ini" from "php.ini.default"
- sudo cp php.ini.default php.ini
- sudo chmod 777 php.ini
- edit /etc/php.ini (using what ever editor)
-> session:auto_start = 1
-> session:save_path = /tmp
-> mysql.default_socket = /tmp/mysql.sock (x2)
- sudo chmod 444 php.ini
Restart apache

Saturday, August 28, 2010

MySQL problem after upgrade to Mac OS 10.6

Mac OS version:
10.6.3

Problem:
MySQL server not started

Solution:
Create a symbolic link named "mysql"
In folder "/usr/local"
Point to "/usr/local/mysql-5.1.42-osx10.5-x86_64"
Restart computer

Wednesday, June 16, 2010

14" Notebook

1) Asus
A52JC

A52JR
http://hk.asus.com/product.aspx?P_ID=OdtStEQ9nbSbUSMI

A52F

2) Lenovo
Thinkpad Edge
Core i3-330M, 14" WXGA, 320G HD, 2G RAM, DVD
HDMI, 6 cell, 2.22kg, Win7 Home Premium
Color:black or red
Price: HK$5,688 up

Saturday, June 12, 2010

Handle photo with iPhone

1) Copy photo file from SD card to iPhone

ZoomIt SD Card Reader (hardware)
Google Search: iPhone SD card reader


2) Upload file to FTP server

iStorage (iPhone App)
Info: search "iStorage" in iTunes App Store
Google Search: istorage

FTP On The Go (iPhone App)
Info: search "ftp" in iTunes App Store
Google Search: ftp on the go
Google Search: iPhone upload ftp


3) Update Exif/IPTC meta data of photo file

Still searching ...




Monday, May 17, 2010

Install GD on Mac with PHP

Reference:

1. start terminal
sudo bash

2. install libjpeg

mkdir -p /SourceCache
cd /SourceCache
curl -O http://.../jpegsrc.v6b.tar.gz
(http://www.opensource.apple.com/source/apache_mod_php/apache_mod_php-53/libjpeg)
(or download first, then cp /.../jpegsrc.v6b.tar.gz .)
tar xzpf jpegsrc.v6b.tar.gz
cd /SourceCache/jpeg-6b
cp /usr/share/libtool/config.sub .
cp /usr/share/libtool/config.guess .

(64-bit only)
MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe" CXXFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe" LDFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -bind_at_load" ./configure --enable-shared

make clean
make
mkdir -p /usr/local/include
mkdir -p /usr/local/bin
mkdir -p /usr/local/lib
mkdir -p /usr/local/man/man1
make install

3. Compile GD graphics library extension (gd.so)

- make sure which php version is using

mkdir -p /SourceCache
cd /SourceCache
curl -O http://.../php-5.2.11.tar.bz2
(http://us.php.net/get/php-5.2.11.tar.bz2/from/a/mirror)
(or download first, then cp /.../php-5.2.11.tar.bz2 .)
tar xjf php-5.2.11.tar.bz2
cd /SourceCache/php-5.2.11/ext/gd
phpize

(64-bit only)
MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe" CXXFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe" LDFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -bind_at_load" ./configure --with-zlib-dir=/usr --with-jpeg-dir=/usr/local/lib --with-png-dir=/usr/X11R6 --with-freetype-dir=/usr/X11R6 --with-xpm-dir=/usr/X11R6

make clean
make
make install

4. Add gd.so to PHP

- edit php.ini
-> add extension=gd.so
-> add extension_dir=/usr/lib/php/extensions/no-debug-non-zts-20060613

- restart apache
-> apachectl graceful


Friday, February 5, 2010

Install PHP + MySQL + PhpMyAdmin on Mac with Apache

1. activate web share

2. test apache by using test.html
- computer doc root /Library/WebServer/Documents/
- current user doc root ~/Sites/

3. test php by using phpinfo()

4. install MySQL

5. config MySQL
- /usr/local/mysql/bin/mysqladmin -u root password
- /usr/local/mysql/bin/mysqladmin -u root -p password
- sudo chmod 777 php.ini
- edit /etc/php.ini (using what ever editor)
-> session.auto_start = 1
-> session.save_path = /tmp
-> mysql.default_socket = /tmp/mysql.sock
-> mysqli.default_socket = /tmp/mysql.sock
- sudo chmod 444 php.ini

6. copy phpMyAdmin to computer doc root

7. config apache alias
- sudo chmod 777 httpd.conf
- edit /etc/apache2/httpd.conf
-> Alias /artmate "/<folder>"
-> <Directory "/<folder>">
-> Options Indexes FollowSymLinks MultiViews
-> AllowOverride None
-> Order allow,deny
-> Allow from all
-> </Directory>
- sudo chmod 644 httpd.conf

Friday, December 18, 2009

Apache httpd.conf example

Alias /asMgt/ "C:/folder/"
<Directory "C:/folder">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>