| Author |  | 
| durinango 
 
 
 Joined: 12 Feb 2018
 Posts: 9
 Location: oslo
 
 | 
|  Posted: Mon 12 Feb '18 12:40    Post subject: Upgrade PHP issue |   |  
| 
 |  
| Hi guys, 
 I have a webserver running ApacheLounge 2.4.29.
 
 httpd -v
 Server version: Apache/2.4.29 (Win32)
 Apache Lounge VC15 Server built:   Oct 20 2017 11:15:09
 
 and php version 5.4.10 which works fine but it is insecure so i need to upgrade.
 
 However, when i change to version 5.6.33 apache won't start and i get these error message in the eventlog:
 
 The Apache service named  reported the following error:
 >>> httpd.exe: Syntax error on line 189 of C:/Programs/Apache Software Foundation/ApacheLounge2.4.29/conf/httpd.conf: Cannot load C:/Programs/PHP-5.6.33/php5apache2_4.dll into server: The Apache service named is not a valid Win32 application.
 
 
 I have tried all variants of php 5.6.33, threadsafe, non threadsafe, x64, x86 but they all give same error.
 
 This is the config in httpd.conf
 
 LoadModule php5_module "C:/Programs/PHP-5.6.33/php5apache2_4.dll"
 PHPIniDir "C:/Programs/PHP-5.6.33"
 
 The server is running Winodws Server 2008 R2 standard 64 bit.
 
 What can be the issue here ? Which version should i try to upgrade to ?
 
 Thanks!
 |  | 
| Back to top |  | 
| James Blond Moderator
 
  
 Joined: 19 Jan 2006
 Posts: 7442
 Location: EU, Germany, Next to Hamburg
 
 | 
|  Posted: Mon 12 Feb '18 12:42    Post subject: |   |  
| 
 |  
| PHP 5.6 is compiled with VC11 while the apache you are using is compiled with VC15. 
 if you need that PHP version use mod_fcgid. see https://www.apachelounge.com/viewtopic.php?t=2394
 
 if you still have a question please ask again.
 |  | 
| Back to top |  | 
| durinango 
 
 
 Joined: 12 Feb 2018
 Posts: 9
 Location: oslo
 
 | 
|  Posted: Mon 12 Feb '18 13:02    Post subject: |   |  
| 
 |  
| Thanks, but i i can probably run later versions of PHP too but i cannot manage to get them working either... 
 I tried php 7.2.2 but still i get same error ?
 
 Thanks
 |  | 
| Back to top |  | 
| James Blond Moderator
 
  
 Joined: 19 Jan 2006
 Posts: 7442
 Location: EU, Germany, Next to Hamburg
 
 | 
|  Posted: Mon 12 Feb '18 13:25    Post subject: |   |  
| 
 |  
| 
* Can you start php.exe from the command line?
 * Did you try mod_fcgid?
 
 |  | 
| Back to top |  | 
| durinango 
 
 
 Joined: 12 Feb 2018
 Posts: 9
 Location: oslo
 
 | 
|  Posted: Mon 12 Feb '18 14:24    Post subject: |   |  
| 
 |  
| Tried mod_fcgid but ran into some issues with extension for oracle db servers oci8 dll 
 I can run php.exe -v (or -m) from the commandline.
 
 Looking for the easiest path to upgrade....
 |  | 
| Back to top |  | 
| James Blond Moderator
 
  
 Joined: 19 Jan 2006
 Posts: 7442
 Location: EU, Germany, Next to Hamburg
 
 | 
|  Posted: Mon 12 Feb '18 16:16    Post subject: |   |  
| 
 |  
|  	  | durinango wrote: |  	  | Tried mod_fcgid but ran into some issues with extension for oracle db servers oci8 dll 
 | 
 
 Okay, that is one extension.
 
 Get it running
 
 in php.ini set
 
  	  | Code: |  	  | error_reporting = "E_ALL"
 display_startup_errors =  "On"
 display_errors = "On"
 | 
 
 
 
 
  	  | durinango wrote: |  	  | I can run php.exe -v (or -m) from the commandline. | 
 
 When you run php -m is the oracle extension loaded?
 
 you can also check with
 
 
  	  | Code: |  	  | php.exe -i >> output.txt | 
 
 and look in output.txt for oracle extension.
 
 
 did you follow http://php.net/manual/en/oci8.installation.php ?
 
 
  	  | php.net wrote: |  	  | When using Oracle 10gR2 client libraries on Windows, uncomment the php.ini line extension=php_oci8.dll. When using Oracle 11gR2 or later client libraries, uncomment extension=php_oci8_11g.dll or extension=php_oci8.dll. With Oracle 12c libraries use extension=php_oci8_12c.dll or extension=php_oci8_11g.dll or extension=php_oci8.dll. Only one of these DLLs may be enabled at a time. DLLs with higher versions may contain more functionality. Not all DLLs may be available for all versions of PHP. Make sure extension_dir is set to the directory containing the PHP extension DLLs. 
 If using Instant Client, set the system PATH environment variable to the Oracle library directory.
 | 
 
 maybe see also https://stackoverflow.com/questions/39664801/php-oci8-extensions-not-working-with-php-7-64-bit
 
 Last edited by James Blond on Sat 17 Feb '18 11:19; edited 1 time in total
 |  | 
| Back to top |  | 
| durinango 
 
 
 Joined: 12 Feb 2018
 Posts: 9
 Location: oslo
 
 | 
|  Posted: Fri 16 Feb '18 10:17    Post subject: |   |  
| 
 |  
| Hi 
 Thanks for this reply, i got php working but still this oracle module does not work.
 
 It works without any additional config if i run php as module in a previous version.
 
 This is the apache config:
 
  	  | Code: |  	  | LoadModule fcgid_module modules/mod_fcgid.so
 
 <IfModule fcgid_module>
 
 
 FcgidMaxProcesses 300
 FcgidMaxProcessesPerClass 300
 
 FcgidOutputBufferSize 65536
 FcgidConnectTimeout 10
 FcgidProcessLifeTime 0
 FcgidMaxRequestsPerProcess 0
 FcgidMinProcessesPerClass 0
 FcgidFixPathinfo 0
 FcgidProcessLifeTime 0
 FcgidZombieScanInterval 20
 FcgidMaxRequestLen 536870912
 FcgidIOTimeout 120
 FcgidTimeScore 3
 
 FcgidPassHeader Authorization
 
 FcgidInitialEnv PHPRC "C:\Programs\php-5.6.33-nts-Win32-VC11-x64"
 FcgidInitialEnv PATH "C:\Programs\php-5.6.33-nts-Win32-VC11-x64;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;"
 FcgidInitialEnv SystemRoot "C:\\Windows"
 FcgidInitialEnv SystemDrive "C:"
 
 FcgidInitialEnv TEMP "C:\\WINDOWS\\TEMP"
 FcgidInitialEnv TMP "C:\\WINDOWS\\TEMP"
 FcgidInitialEnv windir "C:\\WINDOWS"
 
 DefaultInitEnv PHPRC "C:/Programs/php-5.6.33-nts-Win32-VC11-x64"
 DefaultInitEnv PATH "C:/Programs/php-5.6.33-nts-Win32-VC11-x64;C:/Programs/Apache Software Foundation/ApacheLounge2.4.29/bin;C:/WINDOWS/system32;C:/WINDOWS;D:/oracle/product/11.2.0/dbhome_1/BIN"
 DefaultInitEnv ORA_HOME "D:/oracle/product/11.2.0/dbhome_1"
 
 
 <Files ~ "\.php$">
 Options Indexes FollowSymLinks ExecCGI
 AddHandler fcgid-script .php
 FcgidWrapper "C:/Programs/php-5.6.33-nts-Win32-VC11-x64/php-cgi.exe" .php
 </Files>
 </IfModule>
 
 
 | 
 php.ini:
 
 
  	  | Code: |  	  | extension_dir = "C:\programs\php-5.6.33-nts-Win32-VC11-x64\ext"
 
 extension=php_oci8_11g.dll
 
 
 | 
 The error message i get is this:
 
 PECL oci8 extension (http://pecl.php.net/package/oci8) is required to use Oracle clustering functionality.
 
 I have tried different versions of the php_oci8_11g.dll.
 
 C:\Programs\php-5.6.33-nts-Win32-VC11-x64>php -m
 [PHP Modules]
 bcmath
 calendar
 Core
 ctype
 date
 dom
 ereg
 filter
 ftp
 hash
 iconv
 json
 libxml
 mcrypt
 mhash
 mysqlnd
 oci8
 odbc
 pcre
 PDO
 Phar
 Reflection
 session
 SimpleXML
 SPL
 standard
 tokenizer
 wddx
 xml
 xmlreader
 xmlwriter
 zip
 zlib
 
 [Zend Modules]
 
 
 C:\Programs\php-5.6.33-nts-Win32-VC11-x64>
 
 So it seems like the module is found by php at least.
 
 ORACLE_HOME is set to D:\oracle\product\11.2.0\dbhome_1
 as a system envirinment variable.
 |  | 
| Back to top |  | 
| Jan-E 
 
 
 Joined: 09 Mar 2012
 Posts: 1283
 Location: Amsterdam, NL, EU
 
 | 
|  Posted: Fri 16 Feb '18 11:27    Post subject: |   |  
| 
 |  
| Try this in C:\Programs\php-5.6.33-nts-Win32-VC11-x64 
 where oci.dll
 
 Does it find a oci.dll? is that the same as the one in D:\oracle\product\11.2.0\dbhome_1\BIN ?
 
 You might try adding D:\oracle\product\11.2.0\dbhome_1\BIN to your FcgidInitialEnv PATH
 |  | 
| Back to top |  | 
| durinango 
 
 
 Joined: 12 Feb 2018
 Posts: 9
 Location: oslo
 
 | 
|  Posted: Fri 16 Feb '18 13:44    Post subject: |   |  
| 
 |  
| Hi 
 Thanks for this reply, i used the Process monitor to check what was going on:
 
 https://ibb.co/dK0Cy7
 
 So like you suggest php has issues finding the oci.dll file.
 
 so before i saw you post i took everything of D:\oracle\product\11.2.0\dbhome_1\BIN and copied it to C:\Programs\php-5.6.33-nts-Win32-VC11-x64
 
 Now i do not get same errormessages, instead i get fatal error messages from php.
 
 Tried to add the path to FcgidInitialEnv PATH but same fatal error.
 
 maybe something in the code that is not compatible with this version of php ?
 
 What other possibilities is there to just upgrade for security reasons ?
 |  | 
| Back to top |  | 
| durinango 
 
 
 Joined: 12 Feb 2018
 Posts: 9
 Location: oslo
 
 | 
|  Posted: Fri 16 Feb '18 14:13    Post subject: |   |  
| 
 |  
| This is using the running/working version: 
 https://ibb.co/d3b51S
 
 I cannot see that there are any other config in php.ini that would point to this path...
 |  | 
| Back to top |  | 
| Jan-E 
 
 
 Joined: 09 Mar 2012
 Posts: 1283
 Location: Amsterdam, NL, EU
 
 | 
|  Posted: Fri 16 Feb '18 14:30    Post subject: |   |  
| 
 |  
| If you are switching from a x86 PHP 5.3 to a x64 PHP 5.6, you will also have to switch to the 64-bits oci.dll. |  | 
| Back to top |  | 
| durinango 
 
 
 Joined: 12 Feb 2018
 Posts: 9
 Location: oslo
 
 | 
|  Posted: Fri 16 Feb '18 14:31    Post subject: |   |  
| 
 |  
| Seems like i already is using 64 bit version of php ? The 32 bit won even start.
 |  | 
| Back to top |  | 
| Jan-E 
 
 
 Joined: 09 Mar 2012
 Posts: 1283
 Location: Amsterdam, NL, EU
 
 |  | 
| Back to top |  | 
| Jan-E 
 
 
 Joined: 09 Mar 2012
 Posts: 1283
 Location: Amsterdam, NL, EU
 
 | 
|  Posted: Fri 16 Feb '18 14:52    Post subject: |   |  
| 
 |  
| If you are using mod_fcgid, you could also use PHP 5.6 x86/Win32. That should be working OK with your current OCI setup. |  | 
| Back to top |  | 
| Jan-E 
 
 
 Joined: 09 Mar 2012
 Posts: 1283
 Location: Amsterdam, NL, EU
 
 | 
|  Posted: Fri 16 Feb '18 14:56    Post subject: |   |  
| 
 |  
|  	  | durinango wrote: |  	  | Seems like i already is using 64 bit version of php ? The 32 bit won even start.
 | 
 Hmm. You changed this reply.
 
 Your PHP and OCI should match. Both x86 or both x64.
 |  | 
| Back to top |  | 
| durinango 
 
 
 Joined: 12 Feb 2018
 Posts: 9
 Location: oslo
 
 | 
|  Posted: Fri 16 Feb '18 14:57    Post subject: |   |  
| 
 |  
| I tried the 32 bit version using fcgid but the i got internal server error 500 and if i used cmd and tried to execute php.exe i wouldnt even start. But i will try this new oracle client!
 |  | 
| Back to top |  | 
| durinango 
 
 
 Joined: 12 Feb 2018
 Posts: 9
 Location: oslo
 
 | 
|  Posted: Mon 26 Feb '18 13:19    Post subject: |   |  
| 
 |  
| Did not solve the issue completely but maybe theres something in the php code thats not longer compatible. 
 So this time i copied the files from the instaclient folder into the php folder, (oci.dll file and more).
 |  | 
| Back to top |  |