Here is an example of a script written in PHP, for sending SMS messages through the Goip4 gateway.
The script receives data from the SQL database with a query and alternately sends SMS to each number, and also writes an entry about sending it to a special sms table.
Continue reading “SMS sending script via Goip4 gateway”
Category Archives: Web server
How to install and enable mbstring
To install mbstring in Ubuntu/Debian, run the following command:
sudo apt-get install php-mbstring
In CentOS like this:
sudo yum install php-mbstring
You can activate/deactivate the module like this:
sudo phpenmod mbstring sudo phpdismod mbstring
Restart Apache2 to apply the changes:
sudo service apache2 restart
Let’s see if mbstring is activated:
php -i | grep -i mbstring
How to remove a repeating title in wordpress rss
In the directory /wp-includes/ find the files feed-atom.php, feed-rdf.php, feed-rss.php, feed-rss2.php and look for a line in them:
<title type="text"><?php bloginfo_rss('name'); wp_title_rss();?></title>
remove from it:
bloginfo_rss('name');
or:
wp_title_rss();
Done.
Eliminating duplicate headers on WordPress pages
Once asked to remove on the pages of one WordPress site repeated headlines.
After viewing the code, noticed that they are adding the plugin Yoast SEO, edited in its settings Titles & Metas – Yoast SEO line:
%%title%% %%page%% %%sep%% %%sitename%%
But it did not turn out very nicely, because the plugin sometimes missed the space after the hyphen, so I returned it as it was.
I fixed the error by commenting out the following line in the code of the active template (layout-head.php file):
// bloginfo( 'name' );
After that, the title of the pages was displayed correctly.
P.S. If you disable the Yoast SEO plugin, the above line will need to be uncommented back.
If the topic is not self-explanatory, then probably after the appearance and installation of its update, the layout-head.php file will return to the original state.
How to install and enable mcrypt
To install mcrypt in Ubuntu/Debian, run the following command:
sudo apt-get install php-mcrypt
In CentOS like this:
sudo yum install php-mcrypt
After that, the mcrypt.ini file will appear in the PHP directory with the mcrypt.so extension, in my case it appeared /etc/php/7.0/mods-available/mcrypt.ini.
You can activate/deactivate the module like this:
sudo phpenmod mcrypt sudo phpdismod mcrypt
Restart Apache2 to apply the changes:
sudo service apache2 restart
Let’s see if mcrypt is activated:
php -i | grep -i mcrypt
How to install and turn on soap
To install soap in Ubuntu/Debian, run the command:
sudo apt-get install php-soap
In CentOS like this:
sudo yum install php-soap
Look for the name of the package, if that’s possible:
apt-cache search php | grep -i soap yum search php | grep -i soap
You can activate/deactivate the module like this:
sudo phpenmod soap sudo phpdismod soap
Restart Apache2 to apply the changes:
sudo service apache2 restart
Let’s see if soap is activated:
php -i | grep -i soap
Updating phpBB 3.0.x to phpBB 3.1.x
Updated recently phpBB 3.0.12 to 3.1.8, auto update here does not help, so I will describe the procedure for updating the items:
1) Be sure to make a backup copy of the files and the database of the forum. We will make the standard topic prosilver, disable the rest of the styles and modules, as they will not work on the new version of phpBB.
2) Download the archive with the new version of phpBB from the official site “https://www.phpbb.com/downloads/”.
3) On the server, delete all the files and folders of the forum except the file config.php and directories images, files, store.
4) Unpack the downloaded archive, delete the file config.php and directories images, files, store. Move the rest of the files to the server.
5) In the browser, open the forum address by specifying a database update script, for example http://FORUM/install/database_update.php and following the instructions, perform the update.
At this point, I had an error:
PHP Fatal error: Uncaught exception 'Twig_Error_Loader' with message 'Unable to find template "login_body.html" ... ...
I suspect that the information in the database in the phpbb_migrations table did not allow the script to fully update. So I solved the problem by restoring the old forum base by clearing this phpbb_migrations table via phpMyAdmin or by sql query:
TRUNCATE TABLE phpbb_migrations
And again running the database update script http://FORUM/install/database_update.php, which this time performed the update correctly.
At the end of the update, remove the install directory and clear the cache via the administration panel of the forum. Done.