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:

[code lang=bash]
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
[/code]

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:

[code lang=bash]
wget -c http://ncu.dl.sourceforge.net/project/playsms/playsms/Version%201.4/playsms-1.4.tar.gz
[/code]

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:

[code lang=bash]
tar -zxf playsms-1.4.tar.gz
cd playsms-1.4/
cp install.conf.dist install.conf
[/code]

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.

[code lang=bash]
vi install.conf
[/code]

Run install-playsms.sh:

[code lang=bash]
./install-playsms.sh
[/code]

Step 5

Edit Nginx default website config file:

[code lang=bash]
vi /etc/nginx/sites-enabled/default
[/code]

Look for this part and insert index.php:

[code lang=bash]
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 _;
[/code]

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

[code lang=bash]
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;
}
[/code]

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:

[code lang=bash]
vi /etc/php/7.0/fpm/php.ini
[/code]

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

[code lang=text]
cgi.fix_pathinfo=0
[/code]

Save php.ini and exit.

Reload both php7.0-fpm and Nginx:

[code lang=bash]
service php7.0-fpm reload
service nginx reload
[/code]

Step 7

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

[code lang=bash]
vi /var/www/html/playsms/init.php
[/code]

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

[code lang=php]
$c_php_self = $_SERVER['SCRIPT_NAME'];
[/code]

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:

[code lang=bash]
vi /etc/mysql/mysql.conf.d/mysqld.cnf
[/code]

Add this line to the end of the file:

[code lang=text]
sql_mode=NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
[/code]

Restart MySQL server:

[code lang=bash]
service mysql restart
[/code]

Step 9

Restart playsmsd:

[code lang=bash]
playsmsd restart
[/code]

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. Igor

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

    Reply
  2. Gustavo Sergio Martin Zalazar Gonzalez

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

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *