php – I'm Knight https://imknight.net From Freelancer to Bootstrapper Mon, 16 Jan 2017 14:12:43 +0000 en-US hourly 1 https://wordpress.org/?v=4.9.8 Setup LAMP Stack on Mac OS X Lion https://imknight.net/development/setup-lamp-stack-on-mac-os-x-lion/ https://imknight.net/development/setup-lamp-stack-on-mac-os-x-lion/#comments Thu, 29 Sep 2011 00:58:44 +0000 https://imknight.net/?p=2444 I have just upgraded my old iMac to Mac OS X Lion, just documented down the process for setup LAMP Development environment, of course there is easier solution like using the MAMP all in one package....

The post Setup LAMP Stack on Mac OS X Lion appeared first on I'm Knight.

]]>
I have just upgraded my old iMac to Mac OS X Lion, just documented down the process for setup LAMP Development environment, of course there is easier solution like using the MAMP all in one package.

First install Homebrew, so call the missing package manager for mac , it has become lots of OSX based developer favourite package manager. The Installation is only one line , just fire up your terminal and run it.

[box type=”info”]/usr/bin/ruby -e “$(curl -fsSL https://raw.github.com/gist/323731)”[/box]

Once Homebrew installed, let’s start the LAMP stack with MySQL first.

[box type=”info”]brew install mysql[/box]

once the downloading and installation done, follow the instructions to setup MySQL run as your user account.

[box type=”info”] unset TMPDIR[/box]

[box type=”info”]mysql_install_db –verbose –user=`whoami` –basedir=”$(brew –prefix mysql)” –datadir=/usr/local/var/mysql –tmpdir=/tmp[/box]

after this you  will be able to start the MySQL with [highlight]mysql.server start[/highlight]

MySQL are ready art now, time for Apache and PHP, which come with Mac OSX Lion, but there are some changes need to apply on the Apache config.

[box type=”info”]Chmod 755  /etc/apache2/httpd.conf  and open in your text/IDE editor[/box]

Enable the PHP library for Apache on line 111.

[box type=”info”]remove the  # from #LoadModule php5_module libexec/apache2/libphp5.so[/box]

You can skip this part if you are ok with using the GUI to start the Apache, if you prefer to start the Apache with terminal, this has to be done in order for the Apache Setting to kick in.Comment out 2 line of setting line 609 and 631.

[box type=”info”]Comment out ( add a # in front) <IfDefine WEBSHARING_ON> and the enclose [/box]

uncomment lin 624 , this allow the vhost kick in even the web sharing is not turn on.

[box type=”info”]remove the #  from Include /private/etc/apache2/extra/httpd-vhosts.conf[/box]

you can start configure the vhost in this httpd-vhosts.conf

Once all the setting are in place,start the Apache in terminal/GUI

[box type=”info”]sudo apachectl start OR check the check box at Preference ->Sharing->Web Sharing[/box]

create a standard PHPINFO script to test is the PHP running.

Update 1/10/2011 add your username on line 157 this will fixed the can’t access site issue.

The post Setup LAMP Stack on Mac OS X Lion appeared first on I'm Knight.

]]>
https://imknight.net/development/setup-lamp-stack-on-mac-os-x-lion/feed/ 5
Cloud Platform for PHP https://imknight.net/web-hosting/cloud-platform-for-php/ https://imknight.net/web-hosting/cloud-platform-for-php/#respond Thu, 12 May 2011 16:27:11 +0000 https://imknight.net/?p=2374 It’s been sometime  I blog about things related to web hosting already, I been using Linode VPS ( my referral link ) for a year plus and I m really happy with it, I...

The post Cloud Platform for PHP appeared first on I'm Knight.

]]>
It’s been sometime  I blog about things related to web hosting already, I been using Linode VPS ( my referral link ) for a year plus and I m really happy with it, I have a free tier AWS account , but don’t have time to really setup it and I still have some credit with VPS.net .

As a developer , I m not really good in server admin, for the past one year I been trying my best to learn but I still don’t really like it. Shared hosting is not suitable for developer since there are many restriction and you always affected by the users on the same server ( unless something like Webfaction , dedicated memory for share hosting) , managed VPS is quite expensive because most of the time they are forcing you to use a control panel in order for them to offer manage hosting, but after you install a control panel , more resources are required, your tiny VPS might need to upgrade again to run smoothly, that’s why it can cost a bomb.

The only choice I have is to pick up some basic server admin skill and host up on Linode , but what I really prefer is some hosting that is simple , budget , dedicated resource, easy to scale and no need to manage the server. I use to think Media Temple’s Grid Hosting might be what I need , but it seem like it doesn’t really meet the expectation. I always wish that one day maybe Heroku or Google App Engine can finally support PHP and  I can no need to worry about server anymore.

But not any more , there are 3 Cloud Platform for PHP now.


Share with me if you have try any of this ? I original writing this post to talk about my PHP Fog experience, it seem like it will become a rather long post,  I guess I will leave it to my next post.

The post Cloud Platform for PHP appeared first on I'm Knight.

]]>
https://imknight.net/web-hosting/cloud-platform-for-php/feed/ 0
Easily setup LEMP on Linode https://imknight.net/web-hosting/easily-setup-lemp-on-linode/ https://imknight.net/web-hosting/easily-setup-lemp-on-linode/#comments Tue, 20 Apr 2010 15:19:53 +0000 https://imknight.net/?p=2002 I just complete setup LEMP (Linux, nginx (engine-x), MySQL, PHP) on my Linode box, which is totally different with the traditional LAMP ( Linux , Apache , MySQL,  PHP) setup, if you never heard...

The post Easily setup LEMP on Linode appeared first on I'm Knight.

]]>
I just complete setup LEMP (Linux, nginx (engine-x), MySQL, PHP) on my Linode box, which is totally different with the traditional LAMP ( Linux , Apache , MySQL,  PHP) setup, if you never heard about nginx , i would recommend you this post from pingdom (a famous website monitoring service’s blog) to understand the buzz around on nginx.

How to easily setup LEMP on Linode? I just make use of Linode’s StackScripts feature

  1. Select the Deploying using StackScripts links when you deploy your new Linode, select LEMP StackScripts and filling some of the fields, it will auto deploy your VPS.
  2. Once the VPS deployment done, the StackScripts will start running , it should take about 20~30 min , just wait for your VPS displaying nginx welcome message means the setup is done.
  3. You will find that the nginx init script seem like broken, you can’t really issue restart or stop command, just follow this article to create a new nginx init script .
  4. One important thing to take note is the path for Daemon, it shall be DAEMON=/usr/local/nginx/sbin/nginx
  5. The final step is changing of socket by following this article.
  6. Don’t forget to change the date time in your /usr/local/lib/php/php.ini to avoid date time error in your php log.

Some reference , there are different way to setup PHP with nginx

Base on my research it seem like  PHP-FPM is winning in term of performance and it will be integrate into PHP core, that’s why it should be the first choice if you try to setup a LEMP box , but since you need to manually compile PHP, it will be quite troublesome to do upgrade.

If you find it this post is helpful and planning to get a Linode box , please use my referral code , this will help me fund my box, thanks.

The post Easily setup LEMP on Linode appeared first on I'm Knight.

]]>
https://imknight.net/web-hosting/easily-setup-lemp-on-linode/feed/ 3
Display user count from delicious https://imknight.net/development/display-user-count-from-delicious/ https://imknight.net/development/display-user-count-from-delicious/#respond Tue, 12 May 2009 15:18:12 +0000 https://imknight.net/?p=1843 I m redesign one of my showcase site , one of the feature i m thinking of is display user count that saved the showcase site on delicious. Although there are some ready solutions...

The post Display user count from delicious appeared first on I'm Knight.

]]>
I m redesign one of my showcase site , one of the feature i m thinking of is display user count that saved the showcase site on delicious. Although there are some ready solutions call tagometer, but it seem like the options is limited, nothing much can be configure. This image tell why i need the the user count for [image via go2web2.0]

saved-on-delicious.jpg

after some research , i find out that for getting the total user , it  can be done in 4 line , if your host/server is having PHP 5.2 and above.

[php]$hash=md5($url);
$delrawoutput = file_get_contents(&quot;http://feeds.delicious.com/v2/json/urlinfo/$hash&quot;);
$deloutput = json_decode($delrawoutput, true);
echo $deloutput[0][&quot;total_posts&quot;];[/php]

what you actually need to do is convert the url into md5 hash and send over to delicious API , it will return json data and after json_decode ( function that available on php5.2 and greater ), you can get the total user count.

If you want to use this in your wordpress theme , just paste the below function in your theme folder , on a file call functions.php , after that you can just apply the function in your theme with provided url.

[php]function getDeliciousCount($url){
$hash=md5($url);
$delrawoutput = file_get_contents(&quot;http://feeds.delicious.com/v2/json/urlinfo/$hash&quot;);
$deloutput = json_decode($delrawoutput, true);
return $deloutput[0][&quot;total_posts&quot;];
}[/php]

The post Display user count from delicious appeared first on I'm Knight.

]]>
https://imknight.net/development/display-user-count-from-delicious/feed/ 0