1
votes

I have one problem with my project, when try to upload a new version in my host (HostGator).

This is the error:

PHP Startup: SourceGuardian: Unable to initialize module
Module compiled with module API=20131226
PHP compiled with module API=20100525
These options need to match

I change in cPanel the version of PHP 5.4 to 5.6, but when I check the version of PHP in server from connection with putty, I receive the follow message:

PHP 5.4.45 (cli) (built: Apr 17 2017 15:59:08)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
    with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v10.2.4, Copyright (c) 2002-2018, by ionCube Ltd.
    with Zend Guard Loader v3.3, Copyright (c) 1998-2013, by Zend Technologies

Maybe this can be the problem? I read about this error, but I cant get a solution. I don't know if I doing something wrong.

4
Just a note that you should use PHP 7.2 since other versions will become deprecated - http://php.net/supported-versions.phpdebute
Thanks for the adviceCarlos Deseda

4 Answers

3
votes

Simply modifying HTACCESS file:

First of all, Hostgator will deprecate versions older than 7.2 by October 2020.

Second, if the following solution doesn't solve your problem, be sure there's no .htaccess file in a parent folder with different instructions (MySQL module seems to be indicated by the first version indicated in the folder hierarchy, and PHP by the last one).

Use the following code in htaccess file (lines with # at beginning are commented):

  # Use PHP 5.4 (will no longer be available in Oct 2020)
#AddHandler application/x-httpd-php54 .php
#<IfModule mod_suphp.c>
#    suPHP_ConfigPath /opt/php54/lib
#</IfModule>

  # Use PHP 5.6 (will no longer be available in Oct 2020)
#AddHandler application/x-httpd-php56 .php
#<IfModule mod_suphp.c>
#    suPHP_ConfigPath /opt/php56/lib
#</IfModule>

  # Use PHP 7.1 (will no longer be available in Oct 2020)
#AddHandler application/x-httpd-php71 .php
#<IfModule mod_suphp.c>
#    suPHP_ConfigPath /opt/php71/lib
#</IfModule>

  # Use PHP 7.2
#<IfModule mime_module>
#  AddHandler application/x-httpd-ea-php72 .php .php7 .phtml
#</IfModule>

  # Use PHP 7.3
#<IfModule mime_module>
#  AddHandler application/x-httpd-ea-php73 .php .php7 .phtml
#</IfModule>

  # Use PHP 7.4 (automatically asigned to new domains since ~Sept 2020)
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php74 .php .php7 .phtml
</IfModule>

Thanks to @anayarojo for the tip for v7.2 (in April 2020).

1
votes

The php binary invoked from the command line may or may not be the same php binary used by Apache. You should use the following PHP script (save it to a publicly accessible web directory and load it in a web browser) to determine which PHP version Apache is configured to run:

<?php
    phpinfo();
?>
1
votes

Just add this lines to your .htaccess for newer versions of php to work:

For PHP 7.2:

AddHandler application/x-httpd-ea-php72 .php .php7 .phtml 

For PHP 7.3:

AddHandler application/x-httpd-ea-php73 .php .php7 .phtml 
0
votes

cPanel provides 2 different methods of setting the php version. One is called "Select PHP version" which sets the global php version to be used as default for new domains, cron jobs etc, the other is "MultiPHP Manager" which allows you to set different versions of php to be used with different domains under the same cPanel account. You need to make sure "MultiPHP Manager" also lists the correct php version for your domain (It can override "Select PHP version" setting).