playSMS 1.4 on Ubuntu 16.04 with PHP 7.0

This is the tutorial of howto install playSMS 1.4 on Ubuntu 16.04 with PHP 7.0. I’m using DigitalOcean to write this tutorial. I choose Nginx as the web server and MySQL as the database server.

There are 9 steps that you need to do correctly and in order. It seems complicated and looks like a long tutorial, but its relatively easy to follow and straightforward. Post your question in playSMS user forum should you encountered any problem following this tutorial.

In this tutorial the password is not secure and I’m logged in as root. If you know what you’re doing then you should know that you can always use any Ubuntu 16.04 server, not just on DigitalOcean. And you can always use your own secure password and use non-root login.

Let’s start.

Step 1

Login to your DigitalOcean account, create a Ubuntu 16.04 x64 droplet. In about 2 minutes you’ll have a working Ubuntu 16.04 server. Use SSH to access your server.

If you haven’t got the account, register and I think you’ll get a chance to create a free droplet.

Step 2

Install Nginx, PHP 7.0 and MySQL:

apt install nginx php7.0-fpm php7.0-cli php7.0-mysql php7.0-gd php7.0-imap php7.0-curl php7.0-mbstring php7.0-mcrypt php7.0-xml mysql-server mysql-client

For tutorial purposes only, I’m using MySQL server root password: password. So the MySQL server username is root and the password is password.

Oh, again, please note that I’m logged in as root (default access to DigitalOcean droplet) as opposed to using non-root login and use sudo whenever necessary.

Step 3

Get playSMS from Sourceforge. Here’s the link that works from me:

wget -c http://ncu.dl.sourceforge.net/project/playsms/playsms/Version%201.4/playsms-1.4.tar.gz

You may get the file by using other method, for example by browsing http://playsms.org/download and click the latest official release Sourceforge link, download playSMS 1.4 to your laptop and then upload it to your server.

Just make sure that you’re downloading playSMS 1.4 and then upload it to the server.

Step 4

Install playSMS 1.4:

tar -zxf playsms-1.4.tar.gz
cd playsms-1.4/
cp install.conf.dist install.conf

Just to make sure the content of install.conf is representing your actual server configuration, for example the MySQL username and password must be correct. If you follow this tutorial then just exit the editor don’t change anything.

vi install.conf

Run install-playsms.sh:

./install-playsms.sh

Step 5

Edit Nginx default website config file:

vi /etc/nginx/sites-enabled/default

Look for this part and insert index.php:

root /var/www/html;

# Add index.php to the list if you are using PHP
index index.html index.htm index.php index.nginx-debian.html;

server_name _;

Look for this part and uncomment 2 lines to look like below snippet:

location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php7.0-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php7.0-fpm:
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}

Save default file and exit.

Basically you’re setting index.php as one of the web directory index file and you enabled processing of PHP files via php7.0-fpm.

Step 6

Edit php.ini and look for ;cgi.fix_pathinfo=1:

vi /etc/php/7.0/fpm/php.ini

Remove the comment and change the value to 0, it must be set to this:

cgi.fix_pathinfo=0

Save php.ini and exit.

Reload both php7.0-fpm and Nginx:

service php7.0-fpm reload
service nginx reload

Step 7

Unfortunately playSMS 1.4 wasn’t tested for PHP 7, so you need to do this adjustment, edit playSMS init.php:

vi /var/www/html/playsms/init.php

Go to line 73 and change PHP_SELF to SCRIPT_NAME, it must be changed to this:

$c_php_self = $_SERVER['SCRIPT_NAME'];

Step 8

I believe you’re using MySQL 5.7, so you need to do this, you need to make MySQL 5.7 behave just like previous version, edit MySQL server config:

vi /etc/mysql/mysql.conf.d/mysqld.cnf

Add this line to the end of the file:

sql_mode=NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

Restart MySQL server:

service mysql restart

Step 9

Restart playsmsd:

playsmsd restart

Browse your playSMS at your-server-address/playsms and login with default playSMS login admin, password admin.

About

This tutorial is written by Anton Raharja.

5 thoughts on “playSMS 1.4 on Ubuntu 16.04 with PHP 7.0

  1. Gustavo Sergio Martin Zalazar Gonzalez

    You are magnificeny, thanks for this guide… it works for me at the first try :) BIG THANKS!!!!

    Like

  2. Igor

    Dear Anton,
    Thank you very much for this tutorial and above all thank you for all your effort you put into PlaySms project.

    Liked by 1 person

Comments are closed.