PHP

Remote Linux server PHP debugging using PhpStorm Xdebug with its port forwarded through SSH tunnel

If your client's site setup is complicated and you don't have time to replicate it in your local machine, your choice is to debug it directly. This article will show steps on how to debug a website's PHP codes remotely in a server with firewall specifically hosted in Linode server running Centos 7 64-bit Linux distribution, PHP-FPM (FastCGI Process Manager) and PHP 7.0 (the server is running multiple PHP versions).

Running PHP 7.0 as one of multiple PHP versions on CentOS 7 using Virtualmin

In connection to my post Running multiple PHP versions on CentOS 7 using Virtualmin, this guide will show how to install additional PHP 7.0 version on CentOS 7 by using the Software Collections and have Virtualmin detect and use it.

Here are the steps:

  1. Login as root to your server's console terminal.

  2. Install the CentOS Linux Software Collections release file:

          
    yum install centos-release-scl
          
        
  3. Install the PHP package:

Using Google Contacts API as server to server PHP application

You've got a website for your business and most of your new customers are reaching you via your "Contact us" form page. You're probably manually adding your customers' phone number, email, their preferred product, etc. in your Google Contacts. Would it be nice if your "Contact us" form page has the ability to save a visitor's contact and other details to the database of your account's Google Contacts app automatically? With this kind of application, server to server authentication is needed.

Adding external javascript library available to all pages with query string value came from PHP in Drupal 8

In Drupal 7, adding external javascript library available to all pages with query string value came either from PHP computed value or from database this can be done by:

  
/**
 * Implements hook_init()
 */
function mymodule_init() {
  drupal_add_js('//maps.googleapis.com/maps/api/js?key=' . variable_get('mymodule_google_map_api_key', NULL), 'external');
}
  

For Drupal 8 this is possible by:

Passing data from PHP to javascript variable available to all pages in Drupal 8

Most of us pass data from PHP to javascript variable available to all pages in Drupal 7 is by:

  
/**
 * Implements hook_init()
 */
function mymodule_init() {
  $computed_data = mymodule_get_data();
  drupal_add_js(array('mymodule_computed_data' => $computed_data), 'setting');
}
  

We can access this data in javascript by:

Solution to PHP script at home page is downloaded instead of executed

The issue is only at the website home page's PHP script has the download behaviour but the rest of the website pages' PHP script run normally. In this article will show two solutions. This issue is very hard to debug because there are no helpful logs that will give hint on solving this issue. Actually, I was debugging a "Permission denied" issue and the fixes I tried to apply to this resulted to our main topic issue. The web server setup: Nginx as reverse proxy to Apache and under a web hosting control panel.

Tags