Category Archives: Linux

How to install Xampp Linux on Peppermint OS 5

I have a few php system at the moment. My 1st system is php and folks (mysql etc) installed via apt-get . 2nd system is PHP system using phpfarm technique . This time I want to add other system that backed by Xampp :-) . Lets start add this big boy.

Download Latest xampp for linux (at this time I use xampp 5.6.3.0 for 64 bit).

xampp1

$ wget -c http://downloads.sourceforge.net/project/xampp/XAMPP%20Linux/5.6.3/xampp-linux-x64-5.6.3-0-installer.run?r=&ts=1423030874&use_mirror=jaist

$ mv xampp-linux-x64-5.6.3-0-installer.run\?r\= xampp-linux-x64-5.6.3-0-installer.run

$ chmod +x xampp-linux-x64-5.6.3-0-installer.run

$ sudo ./xampp-linux-x64-5.6.3-0-installer.run

Execute as super user or sudo

# ./xampp-linux-x64-5.6.3-0-installer.run

xampp2

Make sure core files selected.

xampp3

After installation finish you might want to test run it.

Stop all running instance of Apache and Mysql

# service apache2 stop
* Stopping web server apache2 *
# service mysql stop
mysql stop/waiting

# /opt/lampp/xampp start
Starting XAMPP for Linux 5.6.3-0…
XAMPP: Starting Apache…ok.
XAMPP: Starting MySQL…ok.
XAMPP: Starting ProFTPD…ok.
# /opt/lampp/xampp stop
Stopping XAMPP for Linux 5.6.3-0…
XAMPP: Stopping Apache…ok.
XAMPP: Stopping MySQL…ok.
XAMPP: Stopping ProFTPD…ok.

Or using sudo

$ sudo /opt/lampp/xampp start
Starting XAMPP for Linux 5.6.3-0…
XAMPP: Starting Apache…ok.
XAMPP: Starting MySQL…ok.
XAMPP: Starting ProFTPD…ok.

Test

xampp4

Document root setting

$ sudo nano /opt/lampp/etc/httpd.conf

Find these lines :

DocumentRoot “/opt/lampp/htdocs”
<Directory “/opt/lampp/htdocs”>

Change to your preferences.

Save when you’re done.

Access MySQL command line

$ sudo /opt/lampp/bin/mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.21 Source distribution

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql>

Change MySQL password

Continue from previous prompt

mysql> use mysql;
Database changed
mysql> update user set password=password(‘123456′) where user=’root’;
Query OK, 2 rows affected (0,00 sec)
Rows matched: 2 Changed: 2 Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0,00 sec)

mysql> exit

Install IonCube Loader

IonCube provide loader for 32 and 64 bit architecture.

Download latest version from here.

$ wget -c http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.bz2

$ tar xvjf ioncube_loaders_lin_x86-64.tar.bz2
ioncube/
ioncube/ioncube_loader_lin_5.0.so
ioncube/ioncube_loader_lin_4.3.so
ioncube/ioncube_loader_lin_4.2.so
ioncube/ioncube_loader_lin_5.6.so
ioncube/ioncube_loader_lin_5.3.so
ioncube/ioncube_loader_lin_5.5_ts.so
ioncube/ioncube_loader_lin_5.4.so
ioncube/ioncube_loader_lin_4.3_ts.so
ioncube/ioncube_loader_lin_5.5.so
ioncube/ioncube_loader_lin_5.4_ts.so
ioncube/ioncube_loader_lin_5.3_ts.so
ioncube/ioncube_loader_lin_4.4.so
ioncube/ioncube_loader_lin_4.4_ts.so
ioncube/ioncube_loader_lin_5.2.so
ioncube/ioncube_loader_lin_4.1.so
ioncube/ioncube_loader_lin_5.1_ts.so
ioncube/ioncube_loader_lin_5.0_ts.so
ioncube/ioncube_loader_lin_5.1.so
ioncube/ioncube_loader_lin_5.6_ts.so
ioncube/ioncube_loader_lin_5.2_ts.so

Which version?

Based on phpinfo() . Its PHP 5.6.3 then I must copy ioncube/ioncube_loader_lin_5.6_ts.so to

directory that provide by phpinfo() information

xampp5

$ sudo mv ioncube/ioncube_loader_lin_5.6.so /opt/lampp/lib/php/extensions/no-debug-non-zts-20131226/

Tell php.ini for new shared object file.

$ sudo nano /opt/lampp/etc/php.ini

Add this line :

zend_extension = /opt/lampp/lib/php/extensions/no-debug-non-zts-20131226/ioncube_loader_lin_5.6.so

save.

Restart xampp

$ sudo /opt/lampp/xampp restart

Recheck phpinfo() page to find this information.

xampp6

Install PhalconPHP Extension on Linux Xampp

$ wget -c "https://github.com/phalcon/cphalcon/archive/master.zip"

$ unzip master.zip

$ cd cphalcon-master/build/64bits/

$ /opt/lampp/bin/phpize --enable-phalcon --with-php-config=/opt/lampp/bin

Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226

$ ./configure --with-php-config=/opt/lampp/bin/php-config

$ make

$ sudo make install

[sudo] password for alamsyah:
Installing shared extensions: /opt/lampp/lib/php/extensions/no-debug-non-zts-20131226/

$ sudo echo "extension=phalcon.so" >> etc/php.ini

Restart Xampp

$ sudo /opt/lampp/xampp restart

Check phpinfo() page to see

xampp7

Reference : Belajar Phalcon Framework

Rebuild Fedora as Server using VPS and custom iso

Today task is little different. Old php script that run on PHP 5.2.9 and utilize mysql 5.0.88 need to rebuild in other place. That way another group of developer can add or inspect why new injected code can behave odd in such environment (they already try new code using newer PHP and it work well).

As far I can see from server log in message its Fedora 10 and using old PHP and old Mysql version. I need to replicate it in some place. Where we (I and developer) can log in and see it together.

Target for this server is same php and same mysql version :

#rpm -qa | grep php

php-common-5.2.9-2.fc10.i386
php-pgsql-5.2.9-2.fc10.i386
php-pecl-apc-3.0.19-1.fc10.i386
php-5.2.9-2.fc10.i386
php-gd-5.2.9-2.fc10.i386
php-mysql-5.2.9-2.fc10.i386
php-ldap-5.2.9-2.fc10.i386
php-mbstring-5.2.9-2.fc10.i386
php-mcrypt-5.2.9-2.fc10.i386
php-odbc-5.2.9-2.fc10.i386
php-pear-1.7.2-2.fc10.noarch
php-cli-5.2.9-2.fc10.i386
php-pdo-5.2.9-2.fc10.i386
phpMyAdmin-3.2.3-1.fc10.noarch

# rpm -qa | grep mysql

mysql-5.0.88-1.fc10.i386
mysql-server-5.0.88-1.fc10.i386
php-mysql-5.2.9-2.fc10.i386
mysql-connector-odbc-3.51.26r1127-1.fc10.i386
libdbi-dbd-mysql-0.8.3-2.fc10.i386
mysql-libs-5.0.88-1.fc10.i386

VPS is my option  and Vultr (I choose $5/month specs that come with 15GB SSD storage and 768MB memory) can help me for this case .

Log in to Vultr and upload iso

  1. For Fedora 10 64 bit click here.
  2. For Fedora 10 32 bit click here.

Since I need to replicate it with minimum hassle I decide to use 64 bit in DVD format.

Create Server

After iso file successfully uploaded then I Choose custom iso selected Fedora 10 file.

fedora10_vps : virtual iso

After hit ‘deploy server’ wait for moment to take control.

Install Fedora Server in VPS

In case you see ipxe message in ‘console’ then you must make sure iso file attached. Check from virtual iso menu. If it’s not then select Fedora images and click ‘attach iso and reboot’ button.

fedora10_vps2 : attach iso

 

This view is the right one.

fedora10_vps3 : remove attached iso

Go back to manage server menu and choose ‘console’ link. If you see this then iso attach process working well.

fedora10_vps4 : install serverThe rest of installation step is as usual.

For partition I choose to use all disk space.

fedora10_server5 : web server chosen etcWeb server and repositories (installation repo, Fedora 10 -x86_64 and updates).

Reboot and configure it for first time as usual till you see this view (already login)

fedora10_vps6 : successfully installed

Disable GUI login and X-Window on Fedora

Yes, of course its server. No X windows please :-)

Open terminal from console and edit /etc/inittab and change this line :

id:5:initdefault:

into

id:3:initdefault:

save.

In this stage also make sure to remove iso from custom iso menu for this server.

After server reboot you’ll see no more X-Window.

fedora10_vps7

Control Fedora Server using ssh

By default ssh server already installed and running. Vultr system will make sure right ip assigned for this VPS and you just need to access it from ipv4 provided.

fedora10_vps8

 

free -m

# free -m
total used free shared buffers cached
Mem: 748 169 578 0 6 57
-/+ buffers/cache: 105 642
Swap: 1503 0 1503

# df -H
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
15G 3,4G 10G 26% /
/dev/vda1 200M 15M 175M 8% /boot
tmpfs 393M 0 393M 0% /dev/shm

Check PHP

# rpm -qa | grep php

php-5.2.9-2.fc10.x86_64
php-ldap-5.2.9-2.fc10.x86_64
php-common-5.2.9-2.fc10.x86_64
php-pdo-5.2.9-2.fc10.x86_64
php-cli-5.2.9-2.fc10.x86_64
php-mysql-5.2.9-2.fc10.x86_64

Check MySQL

# rpm -qa | grep mysql

mysql-libs-5.0.88-1.fc10.x86_64
php-mysql-5.2.9-2.fc10.x86_64

I can see the result is different. I use 64 bit while existing server use 32 bit and few extension not installed. In general Vultr can help me rebuild the server. I just need to more careful and diligent :-)

# yum install php-gd php-mcrypt php-mbstring php-pecl-apc mysql-server

For iptables etc remain same as Install PHP 5.2.17 on CentOS 5.10.

For Selinux case I prefer to disable it :

# nano /etc/selinux/config

change enforcing to disabled .

 

Install TeamViewer 10 on Peppermint OS 5

My new laptop has arrived. Its a HP Pavilion Laptop Computer Silver plus 4GB more memory. I choose it over my old laptop that powered by Acer due its processor. 332 bit limitation force me to walk in place. Maximum 4GB memory limitation and unable to test server software that available in 64 bit. Lucky me that I still able to use cheap cloud provider that cost me $5/month that allow me to install many operating system as many as I want. Very helpful in many case but I still have problem when I have to show a demo server where no internet connection available.

I install Peppermint OS 5 for my new laptop. I choose it simply for the name and since this distro use Lubuntu that more familiar for me.

Installation is very smooth and my wife even like it. She want me to install it for her netbook (I’m in process download iso for 32 bit architecture).

During this holiday season a call is coming and I need to see client monitor. The answer is teamviewer and I decide to use latest version (teamviewer 10).

Here the steps for install teamviewer 10 on peppermint os 5 :

1. Download 64 bit version from here

$ wget -c http://download.teamviewer.com/download/teamviewer_amd64.deb

2. Install it from command line

Yes, if you use gui you’ll get this error screen

teamviewer10_peppermint errror when you choose 64 bit

Yes. lib32asound2 needed for installation. In fact I can’t find it in repository.

$ sudo dpkg -i teamviewer_10.0.36281_amd64.deb

[sudo] password for alamsyah:
Selecting previously unselected package teamviewer.
(Reading database … 186532 files and directories currently installed.)
Preparing to unpack teamviewer_10.0.36281_amd64.deb …
Unpacking teamviewer (10.0.36281) …
dpkg: dependency problems prevent configuration of teamviewer:
teamviewer depends on lib32asound2; however:
Package lib32asound2 is not installed.
teamviewer depends on ia32-libs; however:
Package ia32-libs is not installed.

dpkg: error processing package teamviewer (–install):
dependency problems – leaving unconfigured
Errors were encountered while processing:
teamviewer.

Check it

$ sudo dpkg --get-selections | grep teamviewer
teamviewer install

Yes, its installed.

Fix anything related.

$ sudo apt-get install -f
Reading package lists… Done
Building dependency tree
Reading state information… Done
Correcting dependencies… Done
The following packages were automatically installed and are no longer required:
lib32z1 libc6-i386
Use ‘apt-get autoremove’ to remove them.
The following packages will be REMOVED:
teamviewer
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 120 MB disk space will be freed.
Do you want to continue? [Y/n] n
Abort.

Well. Looks like 64bit is not welcome at the moment.

I need 32/64 bit multi architecture.

$ wget -c http://download.teamviewer.com/download/teamviewer_i386.deb

Uninstall ‘half baked’ teamviewer I install previously.

$ sudo apt-get install -f
Reading package lists… Done
Building dependency tree
Reading state information… Done
Correcting dependencies… Done
The following packages were automatically installed and are no longer required:
lib32z1 libc6-i386
Use ‘apt-get autoremove’ to remove them.
The following packages will be REMOVED:
teamviewer
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 120 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database … 186778 files and directories currently installed.)
Removing teamviewer (10.0.36281) …

Back to install

$ sudo dpkg --add-architecture i386

$ sudo dpkg -i teamviewer_i386.deb
Selecting previously unselected package teamviewer.
(Reading database … 186532 files and directories currently installed.)
Preparing to unpack teamviewer_i386.deb …
Unpacking teamviewer (10.0.36281) …
dpkg: dependency problems prevent configuration of teamviewer:
teamviewer depends on libjpeg62.
teamviewer depends on libxtst6.

dpkg: error processing package teamviewer (–install):
dependency problems – leaving unconfigured
Errors were encountered while processing:
teamviewer

Ups, another dependency problem.

Let apt-get fix it.

$ sudo apt-get install -f
Reading package lists… Done
Building dependency tree
Reading state information… Done
Correcting dependencies… Done
The following packages were automatically installed and are no longer required:
lib32z1 libc6-i386
Use ‘apt-get autoremove’ to remove them.
The following extra packages will be installed:
libjpeg62:i386 libxtst6:i386
The following NEW packages will be installed:
libjpeg62:i386 libxtst6:i386
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 89,7 kB of archives.
After this operation, 266 kB of additional disk space will be used.
Do you want to continue? [Y/n] y

Get:1 http://id.archive.ubuntu.com/ubuntu/ trusty/main libjpeg62 i386 6b1-4ubuntu1 [75,8 kB]
Get:2 http://id.archive.ubuntu.com/ubuntu/ trusty/main libxtst6 i386 2:1.2.2-1 [13,8 kB]
Fetched 89,7 kB in 3s (29,1 kB/s)
Selecting previously unselected package libjpeg62:i386.
(Reading database … 186778 files and directories currently installed.)
Preparing to unpack …/libjpeg62_6b1-4ubuntu1_i386.deb …
Unpacking libjpeg62:i386 (6b1-4ubuntu1) …
Selecting previously unselected package libxtst6:i386.
Preparing to unpack …/libxtst6_2%3a1.2.2-1_i386.deb …
Unpacking libxtst6:i386 (2:1.2.2-1) …
Setting up libjpeg62:i386 (6b1-4ubuntu1) …
Setting up libxtst6:i386 (2:1.2.2-1) …
Setting up teamviewer (10.0.36281) …
Processing triggers for libc-bin (2.19-0ubuntu6.4) …

Try again

$ sudo dpkg -i teamviewer_i386.deb
(Reading database … 186787 files and directories currently installed.)
Preparing to unpack teamviewer_i386.deb …
Unpacking teamviewer (10.0.36281) over (10.0.36281) …
Setting up teamviewer (10.0.36281) …

Looks fine.

Access it from Menu -> Internet -> Team Viewer 10

teamviewer10 installed successfully on pepermintos 5 64 bit

Conclusion for Teamviewer 10 on Peppermint OS 5 64 bit is : use 32bit or you’ll get nothing :-)

Happy new year 2015 everyone.

Using multiple php inside one Ubuntu machine

programmer plus gamerAnother challenge came. One of our application finally updated. The application development use php 5.3 + and already pass with php 5.5+ version. Time for migration schedule and the requirement is obvious : the machine able to run 2 different php (php 5.2.17 is a must and other php version is at least 5.3+). The machine I use is Ubuntu 12.04 32 bit ( I prefer to use old supported version due to lower memory consumption than 14.04).

Quick google give me reference to phpfarm and other resources. As I said in previous post, php 5.2.17 successfully installed after applied a patch (installed on Ubuntu 14.04). For reference purpose I share my experience here. Target php extensions are standard like support for mysql, pdo and gd extension.

Note : if you want to to try / apply it using vps then You’ll need memory minimal 1GB. My box show this memory utilization (32 bit). Click here for hourly cheap vps.

# free -m
total       used       free     shared    buffers     cached
Mem:           873        786         87          0         78        569
-/+ buffers/cache:        138        734
Swap:          890          0        890

Disable php5 module (optional)

In case you already install php5 as apache module you must disable it first.

#a2dismod php5

Fixing locale

Locale error are pop up everywhere first time I install. I need to get rid from this error.

# locale

locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE=”en_US.UTF-8″
LC_NUMERIC=id_ID.UTF-8
LC_TIME=id_ID.UTF-8
LC_COLLATE=”en_US.UTF-8″
LC_MONETARY=id_ID.UTF-8
LC_MESSAGES=”en_US.UTF-8″
LC_PAPER=id_ID.UTF-8
LC_NAME=id_ID.UTF-8
LC_ADDRESS=id_ID.UTF-8
LC_TELEPHONE=id_ID.UTF-8
LC_MEASUREMENT=id_ID.UTF-8
LC_IDENTIFICATION=id_ID.UTF-8
LC_ALL=

# nano /etc/environment

Continue reading

Compile PHP 5.2.17 using phpfarm

In general phpfarm is working well in case you need multiple php environment in single machine. Special case is for PHP 5.2.17 (latest version of 5.2 generation), I got this error when compile :

opt/phpfarm/src/php-5.2.17/ext/dom/node.c: In function ‘zim_domnode_getNodePath’:
/opt/phpfarm/src/php-5.2.17/ext/dom/node.c:2002:8: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
value = xmlGetNodePath(nodep);
^
make: *** [ext/dom/node.lo] Error 1
make failed.

Google suggest me for apply patch.

php programmer

$cd php-5.2.17

$sudo curl -o php-5.2.17.patch https://mail.gnome.org/archives/xml/2012-August/txtbgxGXAvz4N.txt
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
100  1817  100  1817    0     0    722      0  0:00:02  0:00:02 –:–:–   722

run the patch ::

$sudo patch -p0 -b < php-5.2.17.patch

patching file ext/dom/node.c
Hunk #1 succeeded at 1950 (offset 55 lines).
patching file ext/dom/documenttype.c
Hunk #1 succeeded at 215 (offset 10 lines).
patching file ext/simplexml/simplexml.c
Hunk #1 succeeded at 1343 (offset -74 lines).

$cd ..

$ sudo ./compile.sh 5.2.17

and finally get this :

Build complete.
Don’t forget to run ‘make test’.

Installing PHP SAPI module:       cgi
Installing PHP CGI binary: /opt/phpfarm/inst/php-5.2.17/bin/
Installing PHP CLI binary:        /opt/phpfarm/inst/php-5.2.17/bin/
Installing PHP CLI man page:      /opt/phpfarm/inst/php-5.2.17/man/man1/
Installing build environment:     /opt/phpfarm/inst/php-5.2.17/lib/php/build/
Installing header files:          /opt/phpfarm/inst/php-5.2.17/include/php/
Installing helper programs:       /opt/phpfarm/inst/php-5.2.17/bin/
program: phpize
program: php-config
Installing man pages:             /opt/phpfarm/inst/php-5.2.17/man/man1/
page: phpize.1
page: php-config.1
Installing PDO headers:          /opt/phpfarm/inst/php-5.2.17/include/php/ext/pdo/

yay.

check version now ::

$ /opt/phpfarm/inst/php-5.2.17/bin/php -v

PHP 5.2.17 (cli) (built: Sep 24 2014 16:53:53) (DEBUG)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies

Archive patch for backup (php5.2.17.patch.txt)