Fix error install phalconphp 3

Since I use Apricity and its arch linux ‘blood’ make me use latest php version (php 7.0.9 in time of writing) then I can’t get latest phalconphp (version 2). Finally I see phalconphp 3 released. I got little problem to install it but at least i know the error is in my side.

/tmp/yaourt-tmp-alamsyahr/aur-php-phalcon/src/cphalcon-3.0.0/build/php5/64bits/phalcon.zep.c:203:30: fatal error: ext/spl/spl_heap.h: No such file or directory
#include <ext/spl/spl_heap.h>
^
compilation terminated.
make: *** [Makefile:164: phalcon.lo] Error 1
==> ERROR: A failure occurred in build().
Aborting…
==> ERROR: Makepkg was unable to build php-phalcon.
==> Restart building php-phalcon ? [y/N]
==> ————————————
==> y
==> Edit PKGBUILD ? [Y/n] (“A” to abort)
==> ————————————
==>

==> php-phalcon dependencies:
– php>=5.5 (already installed)
– gcc (already installed) [makedepend]

==> Continue building php-phalcon ? [Y/n]
==> ————————————-
==> n

php-config –version
5.2.17
?  ~
?  ~ php -v
PHP 7.0.9 (cli) (built: Jul 20 2016 17:12:28) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
?  ~ whereis php-config
php-config: /usr/bin/php-config /usr/local/bin/php-config /usr/share/man/man1/php-config.1.gz
?  ~ /usr/bin/php-config –version
7.0.9
?  ~ /usr/local/bin/php-config –version
5.2.17

Need to fix 5.2.17 version 🙂

ls -l /usr/local/bin | grep php-config
-rwxr-xr-x 1 root root     2104 Apr 18 15:39 php-config

sudo rm /usr/local/bin/php-config
rm: remove write-protected regular file ‘/usr/local/bin/php-config’? y

fixed.

php-config –version
7.0.9

Yes, the error came since the output of php-config –version is 5.2.17 just remove it and I can continue for the ride 🙂

in PHP | 255 Words

How to install PHP7 ports on FreeBSD 10.2

My friend ask me about FreeBSD PHP7 ports and he already check if the ports not exist yet. He just feel more comfortable with ports than using git or source.

I search Google and found github repository of PHP 7 ports. I give it a try with my vps and it looks good.

Lets get start!

# freebsd-update update
# freebsd-update install
# pkg update
# portsnap fetch
# portsnap extract

Install git

# pkg install -y git

Clone

# git clone https://github.com/SentaLtd/freebsd-php7-ports.git
Cloning into ‘freebsd-php7-ports’…
remote: Counting objects: 210, done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 210 (delta 16), reused 13 (delta 13), pack-reused 184
Receiving objects: 100% (210/210), 40.52 KiB | 0 bytes/s, done.
Resolving deltas: 100% (68/68), done.
Checking connectivity… done.

Copying all files

# mv /root/freebsd-php7-ports/bsd.php.mk /usr/ports/Mk/

Lang

# mv /root/freebsd-php7-ports/lang/php7-extensions /usr/ports/lang/
# mv /root/freebsd-php7-ports/lang/php7-extensions /usr/ports/lang/

Archivers

# cd /root/freebsd-php7-ports/archivers/
# mv php7-* /usr/ports/archivers/

Converters

# cd /root/freebsd-php7-ports/converters/
# mv php7-* /usr/ports/converters/

Databases

# cd /root/freebsd-php7-ports/databases/
# mv php7-* /usr/ports/databases/

Continue to others 🙂

Install PHP7 ports

# cd /usr/ports/freebsd-php7-ports/lang/php7
# make install

php7_ports_freebsd10

Test

# php -v
PHP 7.0.2 (cli) (built: Jan 30 2016 07:50:43) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies

# php --ini
Configuration File (php.ini) Path: /usr/local/etc
Loaded Configuration File: (none)
Scan for additional .ini files in: /usr/local/etc/php
Additional .ini files parsed: (none)

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

How to install Apache, MariaDB and PHP on CentOS 7 minimal

After install and configure network under CentOS 7 minimal I continue with LAMP section. Since the machine has 4GB memory I prefer to use old fashion LAMP. Only switch MySQL with MariaDB 🙂

The steps for LAMP installation for my own reference and my vps need :

Install required Package

Install nano

# yum install nano

Install Apache, PHP and MariaDB

# yum install httpd mariadb-server mariadb php php-mysql php-mysqli php-gd php-pear php-mbstring

Configure Apache

Start httpd

# systemctl start httpd.service

Set httpd to auto start after reboot or boot process

# systemctl enable httpd.service
ln -s ‘/usr/lib/systemd/system/httpd.service’ ‘/etc/systemd/system/multi-user.target.wants/httpd.service’

By default firewall will block access. To exclude http from firewall block :

# firewall-cmd --permanent --add-service http

# systemctl restart firewalld.service

Try visit ip address from browser

httpd_centos7

Configure MariaDB

Start mariadb

# systemctl start mariadb

Set mariadb to autostart

# systemctl enable mariadb.service
ln -s ‘/usr/lib/systemd/system/mariadb.service’ ‘/etc/systemd/system/multi-user.target.wants/mariadb.service’

Set password for mariadb, delete unnecessary database and users.

# mysql_secure_installation
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we’ll need the current
password for the root user.  If you’ve just installed MariaDB, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on…

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
… Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
… Success!

Normally, root should only be allowed to connect from ‘localhost’.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
… Success!

By default, MariaDB comes with a database named ‘test’ that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
– Dropping test database…
… Success!
– Removing privileges on test database…
… Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
… Success!

Cleaning up…

All done!  If you’ve completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

I also need to enable firewall to exclude future database remote backup. Port 3306 is required to open.

# firewall-cmd --permanent --add-port=3306/tcp
success
# systemctl restart firewalld.service

Done.

Next step is measure time needed from start server to get login display and make my report.

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