Thursday, February 9, 2017

php 7 upgrade

php7 vc15   + apache 2.4.29 vc15

  1. Download PHP, apache, unzip to c:\apache24   and c:\php7\
  2. Add  c:\apache24\bin,   c:\apache24\  and c:\php7\   to PATH environment variable
  3. Update php.ini,   
  4. Update httpd.conf (Apache config file) to load php7apache2_4.dll module in PHP folder and set PHPIniDir to PHP directory
  5. Copy (libeay32.dll) libssh2.dll and (ssleay32.dll) into apache/bin  [I only find libssh2.dll]
  6. Restart Apache.






curl is not loaded by default, so you have to do below manually:
=========================================================

1)Edit php.ini file Enable( uncomment) php_curl.dll and php_openssl.dll extensions


2)go to c:/php7/

Copy libssh2.dll  into c:/apache24/bin folder.

3) test by:  curl_test.php

   
    // Script to test if the CURL extension is installed on this server

     // Define function to test
        function _is_curl_installed() {
    if  (in_array  ('curl', get_loaded_extensions())) {
        return true;
    }
    else {
        return false;
    }
    }

    // Ouput text to user based on test
     if (_is_curl_installed()) {
        echo "cURL is installed on this server";
      } else {
      echo "cURL is NOT installed on this server";
    }
    ?>





====================================================
upgrade is not success, because of mongodb.dll not loaded.




1)

http://windows.php.net/download

apache always use thread safe

VC14 x64 Thread Safe (2017-Jan-18 21:06:35)





2) control panel ---  system ----- advance system --------- environmental variable 

    under system variable, find "path", 
   change c:\php5;  to c:\php7;



3)apache config file,

    edit "httpd.conf"

=======================================
#LoadModule php5_module "c:/php5/php5apache2_4.dll"
#Loadfile "c:/php5/php5ts.dll"

LoadModule php7_module "c:/php7/php7apache2_4.dll"
Loadfile "c:/php7/php7ts.dll"
=============================

    
   
  AddType text/html .php
  AddHandler application/x-httpd-php .php



================================
at bottom add:

#PHPIniDir "c:/php5"
PHPIniDir "c:/php7"

=============================================


4). php.ini  updated.

    ;extension_dir = "c:/php5/ext/"
     extension_dir = "c:/php7/ext/"





.................................................
5) mongodb dll update

c:/php7/ext/ folder you need to download 2 mongodb.dll
also, need to add below to php.ini

extension=php_mongodb.dll
;extension=php_mongo.dll ( do not support php7)



go to

https://pecl.php.net/package/mongodb/1.2.5/windows

choose php 7.1, x64 thread safe
php_mongodb-1.2.5-7.1-ts-vc14-x64.zip

download and unzip and copy php_mongodb.dll to c:/php7/ext/ folder


------------------------------------
for php_mongo.dll,  can not find one for php 7.1, so just use
php_mongo-1.6.14-5.6-ts-vc11-x64.zip
[will not load, at php.info()]

https://pecl.php.net/package/mongo/1.6.14/windows

----------------------------------------------






6) C:\php5\session_cache folder must copy or create (huge project use this folder to handle session stuff, so must have it, default php install do not have this folder)

No comments: