Mac Apache setup new DocumentRoot

Since most stuff get tested on my MAMP server i look for a second local test environment . Some server related packages are just much easier to install under Apache than to compile it for MAMP.  Default MAMP port is 8888 and some software need the default 80 port .

First of all i moves the default Apache directory from  /Library/WebServer/Documents

to my webdev disc www add near Line 173

# Mac ApacheServer port80
DocumentRoot "/Volumes/www/ApacheWebserver"

Therefore edited the Apache  httpd.conf  in /private/etc/apache2

to make it available under add ServerName Localhost

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80

ServerName localhost

And one more edit according to stackoverflow to access the folder near line 183

<Directory />
    #Options FollowSymLinks
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order deny,allow
    Allow from all
</Directory>

Dont forget to restart the apache server with the Terminal command monitor in your console log if any error shown.

sudo /usr/sbin/apachectl restart

How too Real Time track Facebook Likes with Google Analytics

Build your Like button on the Facebook Widget Page as you like it should look. Chose XFBML button type.  Inside the <fb:like  we place the javascript to fire a google tracking.

onclick="javascript: _gaq.push(['_trackPageview', 'yourpagepost.com/facebook']);"

<fb:like onclick="javascript: _gaq.push(['_trackPageview', 'yourpagepost.com/facebook']);" href="http://www.youtpagepost.com/" ><fb:like>

These methode is slightly different then the standard way adding the social tracking code on page  and with

FB.Event.subscribe

. Its more usable if you render the like buttons dynamic. For my case i will track that way unlikes on a multi like page with several hundred Like buttons .

You Google Analytics account must be approved for the Beta Program.   

FFMPEG install for MAMP OSX

Tinkering a lot to get FFmpeg running on a MAMP development environment.  Since I will  need it again here a step by step guide for non Linux or Mac Terminal Geeks like me to fix it.

First of all make clear that your system is clean and everything is linked as it should . FFMPEG needs/install a lot of libraries to convert .If a older install fail you simple can mess up and it get hard to find the missing or wrong linked part. Some great Blogs been a major part in debugging and showed me the path where to go mentioned at the end. We will need to compile ffmpeg for our MAMP php version here PHP 5.3.14  since our second PHP version for MAMP is PHP 5.4 we need to repeat the compile process for every version we whant ffmpeg running. Imagick is installed on my System so i will not go in detail for that but its needed for ffmpeg.so to work.

First Part run some general check to prove system consistense . Second part will guide step by step thrue isntall Third part will show some Errors and bugs and how to get around them.

1. General System Check open  Terminal we will make some general check of your system health.

brew doctor

Make sure Homebrew Packet manager is installed and all files linked +update

brew update

2. Installation preparation

  • Point to your MAMP install dir

export PATH=/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php/php5.3.14/bin:/usr

Execute

  • which php pecl phpize

return :

/Applications/MAMP/bin/php/php5.3.14/bin/php
/Applications/MAMP/bin/php/php5.3.14/bin/pecl
/Applications/MAMP/bin/php/php5.3.14/bin/phpize

  • phpize -v

Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626

 

  • Install ffmpeg 
  • sudo brew install ffmpeg

==> Downloading http://ffmpeg.org/releases/ffmpeg-1.2.4.tar.bz2

Check & Test your FFMPEG in Terminal

  • ffmpeg -v

ffmpeg version 1.2.4 Copyright (c) 2000-2013 the FFmpeg developers
built on Dec 29 2013 18:32:07 with gcc 4.2.1 (GCC) (Apple Inc. build 5666) (dot 3)
configuration: –prefix=/usr/local/Cellar/ffmpeg/1.2.4 –enable-shared –enable-pthreads –enable-gpl –enable-version3 –enable-nonfree –enable-hardcoded-tables –enable-avresample –enable-vda –cc=gcc-4.2 –host-cflags= –host-ldflags= –enable-libx264 –enable-libfaac –enable-libmp3lame –enable-libxvid
libavutil 52. 18.100 / 52. 18.100
libavcodec 54. 92.100 / 54. 92.100
libavformat 54. 63.104 / 54. 63.104
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 42.103 / 3. 42.103
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100

  • which ffmpeg

/usr/local/bin/ffmpeg

Look for every error or problem in the log file output !

Test in Terminal that ffmpeg is working from terminal with a simple command cd to a random folder with a video .mp4

  •  ffmpeg -i  video.mp4

will return video information like frame rate ect

If Imagick install missing

  • brew install ImageMagick

or

  • sudo pecl channel-update pecl.php.net
  • sudo pecl install imagick

Now lets Build the Extension  for MAMP

Install ImageMagick  required for the  PHP ffmpeg.so extension

Unpack and  Create directory for your PHP sources for your php version . Place it in the dir MAMP/bin/php/php5.3.14 /include/php If the dir dont exist create it

 

 Install ffmpeg-php 

  • svn co svn://svn.code.sf.net/p/ffmpeg-php/code/trunk ffmpeg-php-code
  • cd ffmpeg-php-code
  • phpize
  • . /configure
  • make install

A lot of log files and checks ….

———————————————————————-
Libraries have been installed in:
/Applications/MAMP/bin/php/php5.3.14/include/php/ffmpeg-php-code/ffmpeg-php/modules

———————————————————————-
Installing shared extensions: /usr/lib/php/extensions/no-debug-non-zts-20090626/

Here you will find you new compiled  ffmpeg.so  copy them to your MAMP extension folder

 

 Set MAMP Path for your FFMPEG 

Add the Extensions to your Mamp /conf /php5.3.14/ php.ini file

;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;

extension=imagick.so

extension=ffmpeg.so

SET the Correct PATH for FFMPEG

On many Install tutorial i have seen that the path get not recognised and they add the path in the php file like these example .

exec(“/usr/local/bin/ffmpeg -i $srcFile $destFile 2>&1”, $output);

To prevent that specialy if we use other software and the code is written without path like . You need to set the ENV vars for MAMP !

exec(“ffmpeg -i $srcFile $destFile 2>&1”, $output);

  • Open MAMP Env file .

/Applications/MAMP/Library/bin/envars

Comment out if not already done !

#DYLD_LIBRARY_PATH=”/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH”
#export DYLD_LIBRARY_PATH

Add the path of your FFMPEG and IMAGEMagick installation 

#METAMODE 2014 !Important ffmpeg path
export PATH=”$PATH:/usr/local/bin/”

#METAMODE 2014 path for imagmagic
export PATH=”$PATH:/usr/local/opt/imagemagick/bin/”

Dont forget to Restart MAMP to take effect

  • Install ffmpeg-php for PHP 
  • svn co https://ffmpeg-php.svn.sourceforge.net/svnroot/ffmpeg-php ffmpeg-php
  • cd ffmpeg-php/trunk/ffmpeg-php
  • phpize

Don’t forget to run ‘make test’

 

 

Some Error DEBUGING 

If you get any error like “Possible conflicting files are: ”  remove all files by hand ffmpeg will add recent version needet

If you get these kind of Error during ffmpeg-php you ffmpeg-php is not compatible , the version in the drupal tutorial point to a outdated version ffmpeg-php 0.6

include/php/ffmpeg-php/ffmpeg_movie.c:531: error: ‘AVFormatContext’

full error logs strungling on ffmpeg-php 

 

Check you Apache, in logs for any error

File PermissionProblems

MAMP is accesing ffmpeg in root by default MAMP php cant acces root files , so lets change permission on ffmpeg

ls -l /usr/local/bin/ffmpeg

returns -rwxr-xr-x

If you get any error reinstall ffmpeg with option overwrite brew will guide you quite nice

brew –overwrite ffmpeg

The Drupal Forum on MAMP 

Plesk add additional Codecs to ffmpeg Tutorial

Add Memcoder FFMPEg

 

 

 

Sublime PHPFormat Plugin Install

Für die Installation von Php Format plugin Sublime Text 2 sind einige Komponenten Nötig wie PEAR. Dies ist ein einfacher Logpost sollte ich wieder in die Verlegenheit kommen zusätzliche PHP Komponenten installieren zu müssen. Die Tipps sind zusammengetragen aus unterschiedlichen posts in Foren. Im Anhang eine kleine  Cheatsheet für das Mac Terminal nachdem doch immer wieder etwas installiert werden muss. In meinem Fall eine MAMP Entwicklung s Server mit wahlweise PHP 5.3.14  und PHP 5.4.4 . Die Installation von Imagemagick und FFMPEG unter MAMP hat wesentlich einfacher funktioniert doch dazu später. Meist ist nur ein Fehlender Pfad . Wir Listen und Testen hier etwas über genau da wir die selben upgrades auch für die MAMP installation nachvolziehen müssen und nicht noch einmal die selbe Hindernisse springen möchten.

Um etwas  Code sauber zu bekommen wollen wir dieses Subline Plugins installieren. Dieses Erweiterung macht Probleme da Sie den richtigen Pfad zu PEAR nicht findet und einen Fehler in der Sublime Konsole ausgeben. Im Prinzip sind die Plugins nur schnitstellen zu einem PEAR packet PHP_Beautifier . PEAR ist ein PHP Framework mit über 5 mil Zeilen das einiges erleichtert.  Damit all das nahtlos lauft muss PEAR sauber instaliert sein . Sublime  Text Erweiterungen arbeitet mit der System APACHE  Server zusammen nicht mit der eigenen MAMP oder XAMPP also auch wenn PEAR erfolgreich in der Entwicklungs Umgebung funktioniert kann es leicht zu Verwirrungen kommen.

Sublime Text Packages  CodeFormat Git

PhpBeautifier plugin for Sublime Text 2 Git

Wir  benötigen pear install PHP_Beautifier  Fehler Meldung in der Sublime Console

PHP Warning: require_once(PEAR.php): failed to open stream: No such file or directory in /usr/bin/php_beautifier on line 37
PHP Fatal error: require_once(): Failed opening required ‘PEAR.php’ (include_path=’.:/usr/lib/php/pear’) in /usr/bin/php_beautifier on line 37

 Was doch zu einiger Verwirrung führen kann da Sublime auf die mac Standard PHP installation zurückgreift. Hier die von PEAR webseite vorgeschlagene weg welcher nicht unbedingt leicht für non UNIX Leute Nachvollziehbar ist.

PEAR Version abfrage

pear version

PEAR Version: 1.8.0
PHP Version: 5.3.26
Zend Engine Version: 2.3.0

Überprüfen wir die pfade Path für PEAR

$ pear config-get php_dir
/usr/lib/php

Abfrage welche php.ini Verwendung findet

php --ini 

/private/ect/php.ini

Solle die Date ZEitzone nicht gesetzt sein kann das zu Fehler ausgaben führen in die php.ini

date.timezone = Europe/Berlin

Abfrage unserer Include Pfade

php -c /path/to/php.ini -r 'echo get_include_path()."\n";'

Wir Edititiern unser php.ini und fügen den Pfad hinzu

include_path = “.:/usr/lib/php/pear”

include_path=".:/usr/lib/php/pear"

Neustart des Apache Servers nicht vergessen damit die neuen Pfade wirksam werden (wie unten)

Installation PEAR MAC OSX

 wget http://pear.php.net/go-pear.phar
 php -d detect_unicode=0 go-pear.phar

Das Installations Script schlägt folgende Pfade  vor

Screen shot 2013-11-10 at 21.11.37

** The ‘pear’ command is not currently in your PATH, so you need to
** use ‘/Volumes/Meta/Users/Metaprime/pear/bin/pear’ until you have added
** ‘/Volumes/Meta/Users/Metaprime/pear/bin’ to your PATH environment variable.

Kurzer  Test : /Volumes/Meta/Users/Metaprime/pear/bin/pear list

Jetzt noch den PATH hinzufügen

export PATH=/Volumes/Meta/Users/Metaprime/pear/bin:$PATH

echo $PATH überprüfen ob der PATH auch dabei ist

pear -v   Jetzt können wir PEAR mit dem Kurzbefehl aufrufen   und z.B Version abfragen

Da haben wir ( das Instalation script)  noch eine alte Installation gefunden, die wir Löschen

** WARNING! Old version found at /usr/bin/pear, please remove it or be sure to use the new /Volumes/Meta/Users/Metaprime/pear/bin/pear command

Das Install Script hat nach bestätigter Frage die Zeile in die php.ini geschrieben .

Weiter Nützliche Optionale Pakete für PEAR installieren

pear install pear/Mail
pear install pean/Net_SMTP

Nun ans Eingemachte installation von PHP_Beautifier

Die Installation von PHP_Beautifier misslingt mit folgender Meldung

No releases available for package “pear.php.net/PHP_Beautifier” install failed 

Wir wechseln auf die BETA , welche klaglos funktioniert

sudo pear install PHP_Beautifier-beta  

Sublime Text findet alle nötigen Libs DOCH jetzt werden mal hundete Fehler ausgespuckt welche anzeigen das die PHP Deprecated Befehle in der PEAR Config überholt sind, also weitere Updates .

Last ein paar alte php befehle ausgetauscht und es läuft am ende der Nacht.

&new  gegen new suchen und ersetzen in 2 Files php_beautifier und REgistiry.php im Pfad   /Volumes/Meta/Users/Metaprime/pear/share/pear/PEAR

Das Sublime Text Plugin kann nun einfach über die Tools Command  Pallete aufgerufen werden mit FORMAT PHP

Sauber machen werden wir hier später .

MAC TERMINAL BEFEHLE 

Nach dem Editieren der php.ini Apache Restart .Eine Terminal Kommandos

sudo apachectl start

sudo apachectl stop

echo $PATH          Show me  PATH environment variable

whereis pear     auffinden von installation 

sudo find / -name “*Luftbalon*”        Find AnyThing with Terminal

z.B Finde den Pear PATH

locate bin/pear

Hinzufügen zu  PATH unsere envoriment Variable

export PATH=/usr/lib/php/bin:$PATH

Weiter TIPS &Links

Installation von PEAR unter MAC 10.5 Leopard  und phpunit

Path Settings for Snow Leopard OS 10.6

Install PEAR on MAMP 1.9

MAc Terminal Aliases 

FQL Graph get link stats for Multiple Urls

Um mehrfache URls wie z.B von einem Blog abzurufen fragt man den Facebook Graphen folgt ab über die FQL Schnittstelle. Wobei es keine rolle spielt ob die URL eine externe fremde oder eine Facebook Page ist. Einziger unterschied es wird nur die Summe der Fans  angezeigt.

SELECT url, normalized_url,like_count,comment_count,share_count,click_count,total_count FROM link_stat WHERE url in ("http://www.ard.de","www.orf.at")

Um alle Fanpage Kommentare und likes von der Page Timeline zu bekommen geht man wie folgt vor.

Facebook Content Reach – Update looped

Links :

If you keep sharing links Post Reach becomes low

Images :

Best format for shared picture are huge Formats 600×600 is recommended by stuff . Much better 1000 x 1000 vimeo style HD thumbs . Must not be in the page but at least linked in the og:image Tag.

Video :

Only uploaded video works .Youtube and Vimeo external links are handelt like links not video. Tagged User in video by user . Expetion cusom own videoplayer with great video content. Can go viral if community is used for these kind of posts

Text 

Very high reach should be at least 500 words to cover feed space and well written. Provoke a answer after read . mostly for higher aged people

Bigg APP Post 

Instagram Twitter Forusquere convert minimal to some close friends from the same network. Probably should be limited to FB List who have account at the other platfrom .

Metacover Facebook Cover Editor

Metacover Editor is Social Facebook Cover Editor to edit your recent  Timeline Cover Photo and put some  beautiful Text on it with nice Fonts . Instant update without the need to open a Photo editor software or save and Upload you images.  additional it can publish your promotional Cover to Pinterest and Google+ . Free  Photo Text Editor to create cool timeline covers for your FB Fanpage and FB Profile.

The Idea behind is that Cover Photos are the most powerful Photo Content you have. Instead of placing just one for all time you should regularly change and update them. Like a Weekly Magazine and not like a Book one time Cover. Why ? Interaction Like Share on Fanpage Covers get sumarized more on a Blogpost shortly.

How it works All options are drag and drop .Take a Photo from the Background Gallery and drop it on the checkboard canvas . To edit your own connect with Facebook to load personal Cover to reedit and add Text on it when finshed click save .You will get redirected to your Cover to make the final repositioning and conform the edit.

Edit your Fanpage covers give permission by clicking on Load my Fanpage Covers, after that you can select your Fanpage where you want to publish your new cover. All Fanpage Covers get loaded in a extra scroller. Just drag and drop the one you would like to add Text on in. If you prefer to make a new one you can upload you custom photos that can be multiple PNG images too with transparency you can position them on the canvas .Elements like arrows signs and symbols can easy motivate your Fanbase to take the action you want.

Color to select your color there are two options first you can chose by the color wheel selector. Second  click in the picture to pic a color your want to fit the image. you still can use the color wheel to fine tune the Font color.

Position on top and right hand there are two slider to position your Text on the picture.

Publish : As you should be connected to Facebook you can publish the cover by clicking Save .wait 1-2 seconds before conforming the update. Button is to publish and make  your profile pic instead of Banner .

Planed Features : adding Masks ,Filters ,Light Effects to enhance Cover Photo quality

Known Bugs: Text will not instant update after Font change ,you need to type

Comment : Post into the comemnt  your Questions Ideas Problems or Prise  we will keep you update there and will try to inlclude your suggestions  feel free to email if you prefer at support{at}metaprime.at

FAQ

Why you build These ? Because we need some Tools to update many Fanpages fast

When it will be final ? If we see it worth for other people to we will publish and extend a final version with nice UI ect .

Can i use it Mobile ? It works on a IPad screen for small mobile screen cover will not fit and also the app make not much sense .

How about the Cover size pixel ration ? Metacover Editor auto resize your Facebook covers to full size . As they should be already in the right format 851x315px . By uploading photos they have to fit or can be smaller if your compose a multi layer cover .

Tray out Metaeditor and leave some feedback

What you do at Metaprime

Mostly our focus is on visual apps from Flash to Html5 with a strong focus to serve tools for our community in the  social media world. From image video  and Mediaplayer in Flash to Image manipulation via HTML5 is what interest us. Not only to create simple also to give tools to deliver Visual Stories to Audience is one of our main focus. With a strong Media background we know that creating creative work is just half the work.

The Lab

What is the metaprime Lab about ?

Most Apps and Tools first go online at these place its a place for Beta Tester and our Developer to test and research on possibility and future functions and directions for various apps and some times code Frameworks.