Install Lua on Linux Ubuntu

As Android world use Java mostly for its language then I found Lua is another language that powering many games. I want to try it on my Ubuntu desktop and see how it goes :

$ sudo apt-get install lua
[sudo] password for alamsyah:
Reading package lists… Done
Building dependency tree
Reading state information… Done
Package lua is a virtual package provided by:
lua50 5.0.3-6
lua5.2 5.2.1-3
lua5.1 5.1.5-4
You should explicitly select one to install.

I choose Lua 5.2
$ sudo apt-get install lua5.2
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages were automatically installed and are no longer required:
libjavascriptcoregtk-1.0-0 libwebkitgtk-1.0-0 libwebkitgtk-1.0-common
Use ‘apt-get autoremove’ to remove them.
The following NEW packages will be installed:
lua5.2
0 upgraded, 1 newly installed, 0 to remove and 341 not upgraded.
Need to get 159 kB of archives.
After this operation, 357 kB of additional disk space will be used.
Get:1 http://id.archive.ubuntu.com/ubuntu/ raring/universe lua5.2 i386 5.2.1-3 [159 kB]
Fetched 159 kB in 2s (57,1 kB/s)
Selecting previously unselected package lua5.2.
(Reading database … 200688 files and directories currently installed.)
Unpacking lua5.2 (from …/lua5.2_5.2.1-3_i386.deb) …
Processing triggers for man-db …
Setting up lua5.2 (5.2.1-3) …
update-alternatives: using /usr/bin/lua5.2 to provide /usr/bin/lua (lua-interpreter) in auto mode
update-alternatives: using /usr/bin/luac5.2 to provide /usr/bin/luac (lua-compiler) in auto mode

$

Checking version :
$ lua -v
Lua 5.2.1  Copyright (C) 1994-2012 Lua.org, PUC-Rio

$ luac -v
Lua 5.2.1  Copyright (C) 1994-2012 Lua.org, PUC-Rio

Nice, ready for the ‘moon’.

in Blog | 247 Words

Install php 5.2.17 on FreeBSD 9.2

Mysql Apache Linux PHP Mugs
Another server came and the requirement still same. PHP 5.2.17 is a must. I only have 2 options from the vendor; using ubuntu or freebsd.

Its 2013 and all support for php 5.2 on ubuntu server already gone. I have one option left for this job. FreeBSD. Since my last work with FreeBSD I also think FreeBSD 9.2 already throw PHP 5.2 but I’ll try it first.

Install Ports, PHP 5.2.17, Apache 2.2 and MySQL Server 5.1

# portsnap fetch

Looking up portsnap.FreeBSD.org mirrors… 7 mirrors found.
Fetching public key from ec2-ap-southeast-2.portsnap.freebsd.org… done.
Fetching snapshot tag from ec2-ap-southeast-2.portsnap.freebsd.org… done.
Fetching snapshot metadata… done.
Fetching snapshot generated at Mon Nov 25 07:07:20 WIT 2013:

# portsnap extract

Install latest supported PHP 5.2

# cd /usr/ports/lang/php52

Choose required stuff, Apache as web server.

Selection_019

===>   NOTICE:

This port is deprecated; you may wish to reconsider installing it:

PHP 5.2 series is strongly discouraged for new  installations, migrate now.

It is scheduled to be removed on or after 2014-03-01.

Wew. At least it work for my job now 🙂

For apache selection, let it as is.

Selection_020

Install PHP Extensions

# cd /usr/ports/lang/php52-extensions && make install

choose extensions that you like. ( I pick MySQL, Curl, GD beside default options).

Tips : add WITHOUT_X11=yes to /etc/make.conf to prevent system install X11 related software.

Install MySQL Server

# cd /usr/ports/databases/mysql51-server && make install

Configuration

Add service to /etc/rc.conf :

# echo mysql_enable=YES >> /etc/rc.conf

# echo apache22_enable=YES >> /etc/rc.conf

Starting Service

# /usr/local/etc/rc.d/mysql-server start
Starting mysql.

Add php handler

# ee /usr/local/etc/apache22/httpd.conf

Make sure these lines exists :

LoadModule php5_module        libexec/apache22/libphp5.so

in load module list

DirectoryIndex index.php index.html

in IfModule dir_module

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

inside IfModule mime_module directive.

# /usr/local/etc/rc.d/apache22 start
Performing sanity check on apache22 configuration:
Syntax OK
Starting apache22.

Testing

Create php script

# ee /usr/local/www/apache22/data/info.php

put these lines :

<?php
phpinfo();
?>

save.

Open via lynx

lynx localhost/info.php

then I get

Selection_023

Picture source : Mysql Apache Linux PHP Mugs by Zerotees

Testing php script on google app engine

On last post I’ve wrote about howto install the google app SDK for PHP . Today I want to continue with simple testing.

How to run php script using google app engine on my Ubuntu 13.04 desktop :

1. Setting PATH to google app engine by edit .profile

$ cd
$ nano .profile

add this line :

PATH=”$HOME/google_appengine:$PATH”

save.

2. Export the PATH for current operation

$ export PATH=”$HOME/google_appengine:$PATH”
$ echo $PATH

”/home/alamsyah/google_appengine:/home/alamsyah/android-sdk-linux/tools:/home/alamsyah/android-sdk-linux/platforms:/home/alamsyah/android-sdk-linux/platform-tools:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games”

3. Create testing directory

$ mkdir digitalfusi

4. Create php script

$ nano digitalfusi/index.php

put these lines :

<?php

echo “Hello world from rasyid.net <p>”;

phpinfo();

?>

save.

5. Create yaml file (configuration file).

$ nano digitalfusi/app.yaml

Put these lines :

application: digitalfusi
version: 1
runtime: php
api_version: 1

handlers:
– url: /.*
script: index.php

save. For full list of yaml option you can refer to this link.

6. Run the script

Google app engine need to know which php-cgi that work.

if you use php-cgi from ubuntu stock you can run the server using this command :

$ google_appengine/dev_appserver.py –php_executable_path=/usr/bin/php-cgi digitalfusi

INFO     2013-11-23 06:50:46,610 sdk_update_checker.py:245] Checking for updates to the SDK.
INFO     2013-11-23 06:50:59,891 sdk_update_checker.py:261] Update check failed: HTTP Error 404: Not Found
INFO     2013-11-23 06:50:59,927 api_server.py:138] Starting API server at: http://localhost:39378
INFO     2013-11-23 06:50:59,951 dispatcher.py:171] Starting module “default” running at: http://localhost:8080
INFO     2013-11-23 06:50:59,961 admin_server.py:117] Starting admin server at: http://localhost:8000

Selection_007

Using previous location of php-cgi :

$ google_appengine/dev_appserver.py –php_executable_path=$HOME/php-5.4.22/installdir/bin/php-cgi digitalfusi

INFO     2013-11-23 06:47:20,067 sdk_update_checker.py:245] Checking for updates to the SDK.
INFO     2013-11-23 06:47:27,422 sdk_update_checker.py:261] Update check failed: HTTP Error 404: Not Found
INFO     2013-11-23 06:47:27,452 api_server.py:138] Starting API server at: http://localhost:46100
INFO     2013-11-23 06:47:27,477 dispatcher.py:171] Starting module “default” running at: http://localhost:8080
INFO     2013-11-23 06:47:27,482 admin_server.py:117] Starting admin server at: http://localhost:8000

Selection_006

in Blog | 359 Words

Install Laravel 4 on Windows 7

Working with laravel Shirt I want to learn new things and it seem a lot of changes already happened. Specially PHP. First time I learn about this lang I see 4.0 version. Today, I see PHP already reach 5.3, 5.4 and so on. I don’t know about OOP in PHP so I decide to learn about OOP by doing it on project.

Laravel is my option after CodeIgniter . As usual, installation is big thing for me and my netbook run on Windos 7 starter.

Steps for Laravel installation on Windows 7 :

Download latest laravel version 

In time of writing I got 4.0.4 version.

Put it on Xampp htdocs directory.

I rename it to laravel after extract its content.

install_laravel_windows7_1

 

Install Git

Git work ‘distribution system control‘ . It will work together with composer.

Download latest version of Git for Windows from here.

Installation is straightforward. A few notes during installation :

– Make sure to choose “Run Git from the Windows Command Prompt” on adjusting your PATH environment section.

Checkout Window style,commit unix-style line endings on Configuring the line ending conversion section.

Install Composer for Windows

Get latest version from here. Install it as usual. Nothing serious here 🙂

Configuration

In this section we just need to check if everything is work.

1. Check php version
C:\Users\pc>php -v

PHP 5.4.7 (cli) (built: Sep 12 2012 23:48:31)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies

C:\Users\pc>

2. Check Git version

Continue reading