Welcome to Centmin Mod Community
Become a Member

PHP-FPM cUrl on php not working.

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by Indrit, Feb 28, 2018.

  1. Indrit

    Indrit New Member

    12
    4
    3
    Jun 30, 2016
    Ratings:
    +4
    Local Time:
    10:07 PM
    After i run the following commands
    yum clean all
    yum update
    i found out (1 month later) that the cUrl command on php does not get anything.
    If i run the cUrl through command line the command works fine but if i run the cUrl through php there is always blank results from the cUrl script. The cUrl is installed on php but does not get any results.

    Any suggestions? Do i have to make an upgrade of centminmod?

    Please fill in any relevant information that applies to you:
    • CentOS Version: CentOS 7 64bit
    • Centmin Mod Version Installed: 123.09beta01
    • Nginx Version Installed: i.e. 1.11.1
    • PHP Version Installed: i.e. 5.6.23
    • MariaDB MySQL Version Installed: 10.0.33
    • When was last time updated Centmin Mod code base ? : 1-2 years ago
    • Persistent Config: Do you have any persistent config file options set in /etc/centminmod/custom_config.inc ? You can check via this command:

      cat /etc/centminmod/custom_config.inc

      PHPMSSQL='y'
      PHPMSSQL_ALWAYS='y'

      Post output in CODE tags.
     
  2. eva2000

    eva2000 Administrator Staff Member

    34,613
    7,653
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,770
    Local Time:
    5:07 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    what is specific php code and command you running ?

    very very old so update 123.09beta01 as outlined below and recompile latest php 5.6.33 version if 5.6 branch is needed via centmin.sh menu option 5

    Upgrading Centmin Mod Code to Latest Version



    Getting Started Guide step 19 outlines also how to keep Centmin Mod code updated or how to switch version branches or you can run cmupdate command that was recently added.

    Centmin Mod LEMP stack's script code is constantly updated for improvements, bug fixes and security fixes so keeping the Centmin Mod code up to date is important. With Centmin Mod 1.2.3-eva2000.08) (123.08stable) and higher releases, a newly added centmin.sh menu option 23 allows much easier code updates and version branch swicthing via Git backed environment you can setup. For full details read the following links:
    Upgrading Centmin Mod involves 2 parts.
    1. Upgrading the actual Centmin Mod code outlined at Upgrade Centmin Mod. This is heart of Centmin Mod where the code is the engine that runs centmin.sh shell based menu and all the automation you're accustomed to. You can easily update within a Centmin Mod version branch or switch version branches via centmin.sh menu option 23 outlined here.
    2. Upgrade software that Centmin Mod installed or manages. For this part following outline at How to upgrade Centmin Mod software installed on your server.
    So essentially, you can upgrade from one version branch to another i.e. 123.08stable to 123.09beta01 or higher in place, but not everything is upgraded as some things like server initial environment setup isn't changed i.e. how swap, tmp setup and allocation are created etc. The main parts from part 2 above are what in place upgrades do i.e. Nginx and PHP-FPM compilation and config/settings parameters and MariaDB version from 5.5 to 10.0.x. If you want the full environment changed including tmp and swap setup to .08's configuration, then you would need a fresh OS install and fresh .08 initial install. You can think of it like upgrading Windows 7 to Windows 8. An in place upgrade will upgrade code but won't change your computer environment from when you installed Windows 7 i.e. disk configuration and partition sizes won't change from when you initially installed Windows 7. Only way to change that would be fresh Windows 8 install.
     
  3. Indrit

    Indrit New Member

    12
    4
    3
    Jun 30, 2016
    Ratings:
    +4
    Local Time:
    10:07 PM
    I run curl -o website https://api-3t.paypal.com/nvp from linux cmd

    php code
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "https://api-3t.paypal.com/nvp");
    curl_setopt($ch, CURLOPT_VERBOSE, true);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, 'poststrings');
    curl_setopt($ch, CURLOPT_TIMEOUT, 60);
    $response = curl_exec($ch);

    I want to update it but i am afraid to overwrite some configuration i have made to load mssql support and php.ini
     
  4. eva2000

    eva2000 Administrator Staff Member

    34,613
    7,653
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,770
    Local Time:
    5:07 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    How did you edit your php.ini settings ? As you shouldn't edit it directly but use custom *.ini settings files outlined at centminmod.com/phpfpm.html#customphpini. You might want to create /etc/centminmod/php.d/b_customphp.ini to override centmin mod defaults at /etc/centminmod/php.d/a_customphp.ini and restart PHP-FPM. You may need to create the files named alphabetically below that of the default files to override the settings. But this way all will persist over Centmin Mod and PHP-FPM upgrades as Centmin Mod never touches your custom custom *.ini settings files you created.

    As to MSSQL support you mean for PHP MSSSQL extension ? Centmin Mod 123.09beta01 supports PHP MSSQL via persistent config file variables you set in /etc/centminmod/custom_config.inc which as the name suggests persiste through Centmin Mod upgrades. The variables to set are
    Code (Text):
    PHPMSSQL='y'                 # Disable or Enable MSSQL server PHP extension
    PHPMSSQL_ALWAYS='y'          # mssql php extension always install on php recompiles
    

    Once variables set in persistent config file, run centmin.sh menu option 5 for PHP recompile/updates. Same goes for persistent Nginx related variables added first before recompile/update Nginx via centmin.sh menu option 4.

    Also outlined in Getting Started Guide Step 17. Upgrades don't really make changes to other files needlessly. You really need to try and keep the code/routines that Centmin Mod uses up to date.

    You can try the following by backing up the main files first and then do a fresh Centmin Mod code replacement by backing up and moving /usr/local/src/centminmod. You can see the full list of common Centmin Mod config files you may want to inspect if you edited them at Centmin Mod Configuration Files - CentminMod.com LEMP Nginx web stack for CentOS

    Replace branchname with branch you want either 123.08stable or 123.09beta01. The cp copy commands backup the key files/vhost/ssl etc first
    Code (Text):
    branchname=123.09beta01
    cp -a /etc/my.cnf /etc/my.cnf-old
    cp -a /usr/local/lib/php.ini /usr/local/lib/php.ini-old
    cp -a /usr/local/etc/php-fpm.conf /usr/local/etc/php-fpm.conf-old
    cp -a /etc/centminmod /etc/centminmod-old
    cp -a /usr/local/nginx/conf /usr/local/nginx/conf-old
    cd /usr/local/src
    mv centminmod centminmod-old
    git clone -b ${branchname} --depth=1 https://github.com/centminmod/centminmod.git centminmod
    cd centminmod
    ./centmin.sh

    the last run for centmin.sh syncs any needed changes

    then you can compare all the new and old directory and files and transfer them back manually if needed. For sdiff commands if you only want to see differences side by side add the -s flag after sdiff
    Code (Text):
    sdiff /etc/my.cnf /etc/my.cnf-old
    sdiff /usr/local/lib/php.ini /usr/local/lib/php.ini-old
    sdiff /usr/local/etc/php-fpm.conf /usr/local/etc/php-fpm.conf-old
    diff -qr /etc/centminmod /etc/centminmod-old
    diff -qr /usr/local/nginx/conf /usr/local/nginx/conf-old
    diff -qr /usr/local/src/centminmod /usr/local/src/centminmod-old
    

    example if file differs
    Code (Text):
    diff -qr /etc/centminmod /etc/centminmod-old
    Files /etc/centminmod/email-primary.ini and /etc/centminmod-old/email-primary.ini differ

    then use sdiff to see what the actual difference is

    sdiff side by side view
    Code (Text):
    sdiff /etc/centminmod/email-primary.ini /etc/centminmod-old/email-primary.ini

    sdiff side by side view only differences flag -s
    Code (Text):
    sdiff -s /etc/centminmod/email-primary.ini /etc/centminmod-old/email-primary.ini

    Code (Text):
    sdiff /etc/centminmod/email-primary.ini /etc/centminmod-old/email-primary.ini
    3                                                             | 1


    These steps ensure you're running the latest routines that power Centmin Mod.

    If you can post the output of the diff -qr commands, I can tell whether or not there's a better way to ensure some changes persist after Centminn Mod updates i.e. if you can use persistent config file method via /etc/centminmod/custom_config.inc etc

    There's also a list of other file comparison tools you can use within SSH or locally on own PC listed at List of file comparison tools | Centmin Mod Community For windows I use BeyondCompare
     
  5. Indrit

    Indrit New Member

    12
    4
    3
    Jun 30, 2016
    Ratings:
    +4
    Local Time:
    10:07 PM
    Thank you i will give it a try :)
     
..