APC for wampserver 2.4 - php

After 3 hours of searches and differents failed tries, I'm asking help here .. .:(
My configuration:
PHP 5.4.12
Compiler MSVC9
OS: W7 Home premium edition service pack 1
Architecture: x64
Apache: 2.4.4
I've tried many php_apc.dll without success. Is someone found the right one to use or any good alternative to APC?

PHP APC extension for PHP 5.3x to PHP 5.4 and PHP APCu extension for PHP 5.5x
APC installation:
Step 1:
Download APC dll file for PHP 5.3x to 5.4
Step 2:
Extract zip and rename with php_apc.dll
Step 3:
Copy and paste in YOUR_DIR:\wamp\bin\php\php_YOUR_PHP_VER_5.3x_OR_5.4\ext
Step 4:
Enable apc from php.ini
Open php.ini file
YOUR_DIR:\wamp\bin\apache\apache_YOUR_APACHE_VER\bin\php.ini
extension=php_apc.dll
Put above line in php.ini file
OR (Base on your configuration)
YOUR_DIR:\wamp\bin\php\php_YOUR_PHP_VER_5.3x_OR_5.4\php.ini
extension=php_apc.dll
Put above line in php.ini file
Step 5:
Restart Apache
APCu installation for PHP 5.5x:
Step 1:
Download APCu dll file for PHP 5.5x
Step 2:
Extract zip and rename with php_apcu.dll
Step 3:
Copy and paste in YOUR_DIR:\wamp\bin\php\php_YOUR_PHP_VER_5.5x\ext
Step 4:
Enable apc from php.ini
Open php.ini file
YOUR_DIR:\wamp\bin\apache\apache_YOUR_APACHE_VER\bin\php.ini
extension=php_apcu.dll
Put above line in php.ini file
OR (Base on your configuration)
YOUR_DIR:\wamp\bin\php\php_YOUR_PHP_VER_5.5x\php.ini
extension=php_apcu.dll
Put above line in php.ini file
Step 5:
Restart Apache

Installing APC seems fairly simple. I just did it in 10 minutes.
This assumes you are using a 32bit WAMP even on a 64bit Windows. It seems rather hard to find a precompiled 64bit version of APC so if you are using the 64bit WAMP maybe installing the 32bit WAMP would be a good idea.
My Environment is WAMPServer 2.4
The version of PHP I tested this with was 5.3.22 which was running under Apache 2.2.26
I got the dll's from HERE
and selected php_apc-3.1.10-5.3-vc9-x86.zip for my PHP5.3 Versions
and selected php_apc-3.1.10-5.4-vc9-x86.zip for my PHP5.4 Versions
These are compiled with VC9 (msvc 2008) and match the compiler used to create PHP and APACHE
Extract the zips somewhere and then copy the php_apc.dll from the ts (thread safe) folder into your php/ext folder
Edit your php.ini ( using the wampmanager menu links so you get the correct file ) and add this line to the existing section of extension parameters.
extension=php_apc.dll
While in the php.ini add these parameters for apc at the bottom of the ini file
[apc]
; default memory allocation = 32M
apc.shm_size = "32M"
; for dev check for changed code every time so set to "1". "0" for LIVE site.
apc.stat = "1"
This is not actually changing anything as these are actually the defaults, but its a useful place holder for when you decide you want to start fiddling with APC's parameters.
Now to test that the new extension has been loaded, restart apache again using the wampmanager menu, then launch localhost from the menu and click the phpinfo ilnk on the homepage. APC should be the first extension shown in the list of loaded extensions.
Now create a little script to verify apc is working and place it in the \wamp\www folder
filename = test_apc.php
<?php echo '<pre>' . print_r(apc_sma_info(),TRUE) . '</pre>'; ?>
Now run the script from your browser:
http://localhost/test_apc.php
You should see something like this reported:
Array
(
[num_seg] => 1
[seg_size] => 33554368
[avail_mem] => 7396512
[block_lists] => Array
(
[0] => Array
(
[0] => Array
(
[size] => 608
[offset] => 25985176
)
[1] => Array
(
[size] => 6696
[offset] => 26108536
)
[2] => Array
(
[size] => 11912
[offset] => 26116296
)
[3] => Array
(
[size] => 552
[offset] => 26011544
)
)
)
)

Related

Symfony 3 Using Behat without Entity - No Database Connection [duplicate]

I am getting this error when I start my xampp server.
C:\xampp\php\ext\php_oci8.dll' - %1 is not a valid Win32 application.
I downloaded php_oci8-2.0.8-5.6-ts-vc11-x86 and extracted php_oci8.dll into C:\xampp\php\ext directory.
Also, I downloaded instantclient-basic-nt-12.1.0.2.0 (32 bit version) and added the same to the PATH variable of windows.
C:\OracleBasicClient\instantclient-basic-nt-12.1.0.2.0\instantclient_12_1 added to PATH
Still, I'm getting this error and not sure why it is coming.
My windows is 64 bit.
PHP info (xampp)
System Windows NT 6.1 (Windows 7 Professional) i586
Compiler MSVC11 (Visual C++ 2012)
Architecture x86
Thread Safety enabled
What am I possibly doing wrong and how can I fix it?
Your error shows a built-type mismatch.
Resolve it by following these steps:
Make sure you download and install oracle instantclient at: http://www.oracle.com/technetwork/topics/winsoft-085727.html, but note:
Take note of your Oracle database version; use Version 12.1.x for Oracle database 12c and Version 11.1.x for 11g releases.
In either case, make sure you download the Basic Lite version of the Oracle instantclient.
After that, do add location of your Oracle instantclient to your System variable Path under your Environment Variables. Do equally ensure that you have both the PHP of your xampp and its ext available and set there as well (if not, do add them).
Then, proceed to add a new System variable with TNS_ADMIN as variable name and the location to Oracle instantclient as variable value.
Also, define your User variables PATH with the same the location to Oracle instantclient as value.
After this stage, restart your computer for a full propagation of the newly defined environment variables.
Once on, you may open your Windows Command Prompt and run where oci* to ensure that you had your environment variables well defined; the response should look like this:
C:\Users\flex>where oci*
C:\oraclexe\app\oracle\product\11.2.0\server\bin\oci.dll
C:\oraclexe\app\oracle\product\11.2.0\server\bin\ocijdbc11.dll
C:\oraclexe\app\oracle\product\11.2.0\server\bin\ocijdbc11.sym
C:\oraclexe\app\oracle\product\11.2.0\server\bin\ociw32.dll
C:\instantclient_11_2\oci.dll
C:\instantclient_11_2\oci.sym
C:\instantclient_11_2\ocijdbc11.dll
C:\instantclient_11_2\ocijdbc11.sym
C:\instantclient_11_2\ociw32.dll
C:\instantclient_11_2\ociw32.sym
If not, your must have missed something and need to revisit the process, ensuring to completing it effectively.
You may now proceed to your php.ini file (provided environment variables are well defined) and enable your oci extensions (php_oci8.dll and php_oci8_11g.dll) by uncommenting them; you can achieve that by simply removing the semi column (;) before the said extensions.
Do remember to save your php.ini file, then, restart or start your apache if it isn't already running.
To check your PHP oci8 configurations are enabled, you may go back to your Windows Command Prompt and run: php --ri oci8; the response should be similar to the one below:
C:\Users\flex>php --ri oci8
OCI8 Support => enabled
OCI8 DTrace Support => disabled
OCI8 Version => 2.1.1
Revision => $Id: 86f22a208f89dcd5b305e82929a7429683968b11 $
Oracle Run-time Client Library Version => 11.2.0.4.0
Oracle Compile-time Instant Client Version => 10.2
Directive => Local Value => Master Value
oci8.max_persistent => -1 => -1
oci8.persistent_timeout => -1 => -1
oci8.ping_interval => 60 => 60
oci8.privileged_connect => Off => Off
oci8.statement_cache_size => 20 => 20
oci8.default_prefetch => 100 => 100
oci8.old_oci_close_semantics => Off => Off
oci8.events => Off => Off
Statistics =>
Active Persistent Connections => 0
Active Connections => 0
Alternatively, you can create a PHP file with <?php phpinfo(); ?> as content, then open it in your browser and search for oci8 occurrences; it should show enabled there as well.
It seems that you downloaded the DLL for a different architecture and pointed to it in your php.ini, instead of using the bundled DLL and simply un-commenting the default entry in php.ini.
I just downloaded the same version, XAMPP 3.2.2 x86, with PHP 7.1, and it ships with the DLL file that you need, which is installed to C:\xampp\php\ext\php_oci8_12c.dll.
You appear to have done everything else correctly.
To fix the issue, ensure that the effective php.ini (by default, C:\xampp\php\php.ini) references only the default file (remove the erroneous entry you added for php_oci8.dll), like so:
extension=php_oci8_12c.dll ; Use with Oracle Database 12c Instant Client
Restart Apache and the problem should be resolved.

No oci8 module in phpinfo()

I try to set up connection with oracle database, but I still can't even set up the module. I have rhel 7. 2 server, and I followed whole tutorial for setting up oracle instantclient and configured it with php. One thing I completely don't understand is that oci8 module displays after php -i execution:
oci8
OCI8 Support => enabled
OCI8 DTrace Support => disabled
OCI8 Version => 2.1.3
Revision => $Id: 59f993160cf983dd24bb391b68a65a17303d2dba $
Oracle Run-time Client Library Version => 12.1.0.2.0
Oracle Compile-time Instant Client Version => 12.1
Directive => Local Value => Master Value
oci8.connection_class => no value => no value
oci8.default_prefetch => 100 => 100
oci8.events => Off => Off
oci8.max_persistent => -1 => -1
oci8.old_oci_close_semantics => Off => Off
oci8.persistent_timeout => -1 => -1
oci8.ping_interval => 60 => 60
oci8.privileged_connect => Off => Off
oci8.statement_cache_size => 20 => 20
But there is no such module in phpinfo() inside the script. How to fix it?
PHP Version 7.0.13
Server Apache (httpd)
LD library path:
[![enter image description here][2]][2]
The common problem would be that LD_LIBRARY_PATH isn't set for Apache.
Try adding it to /etc/sysconfig/httpd like:
LD_LIBRARY_PATH=/full/path/to/oracle-client
If I have my versions right, this version of Apache (i) doesn't like the export keyword for setting variables (ii) requires a full path since it won't expand environment variables. If I'm wrong, try either or both of those.
There is a lot of information about setting the environment in the free Underground Oracle & PHP Manual, see, for example 'Setting Oracle Environment Variables for Apache' on p 108
You say you followed 'whole tutorial'. There are many tutorials. I'd recommend Oracle's installation instructions.
The answer is:
setsebool -P allow_execstack 1
You also can enable executable stack for only oci8.so with:
execstack -c /usr/lib64/php/modules/oci8.so
https://serverfault.com/questions/314336/centos-6-php-can-not-load-gdchart-so-and-oci8-so-compiled-by-me
make sure that the oci8.so is in the php extension folder
in centos is /usr/lib64/php/modules
in ubuntu xammp is /opt/lampp/lib/php/extensions/no-debug-non-zts-20170718
cd <extension folder >
sudo chmod 755 oci8.so
It works for me after
ps ax | grep "fpm"
check the pid of "php-fpm: master process"
sudo kill -9 <pid>
start php-fpm again
sudo service php-fpm start
inspired by https://stackoverflow.com/a/21693610/2538630

Unable to load dynamic library 'C:\xampp\php\ext\php_oci8.dll' - %1 is not a valid Win32 application

I am getting this error when I start my xampp server.
C:\xampp\php\ext\php_oci8.dll' - %1 is not a valid Win32 application.
I downloaded php_oci8-2.0.8-5.6-ts-vc11-x86 and extracted php_oci8.dll into C:\xampp\php\ext directory.
Also, I downloaded instantclient-basic-nt-12.1.0.2.0 (32 bit version) and added the same to the PATH variable of windows.
C:\OracleBasicClient\instantclient-basic-nt-12.1.0.2.0\instantclient_12_1 added to PATH
Still, I'm getting this error and not sure why it is coming.
My windows is 64 bit.
PHP info (xampp)
System Windows NT 6.1 (Windows 7 Professional) i586
Compiler MSVC11 (Visual C++ 2012)
Architecture x86
Thread Safety enabled
What am I possibly doing wrong and how can I fix it?
Your error shows a built-type mismatch.
Resolve it by following these steps:
Make sure you download and install oracle instantclient at: http://www.oracle.com/technetwork/topics/winsoft-085727.html, but note:
Take note of your Oracle database version; use Version 12.1.x for Oracle database 12c and Version 11.1.x for 11g releases.
In either case, make sure you download the Basic Lite version of the Oracle instantclient.
After that, do add location of your Oracle instantclient to your System variable Path under your Environment Variables. Do equally ensure that you have both the PHP of your xampp and its ext available and set there as well (if not, do add them).
Then, proceed to add a new System variable with TNS_ADMIN as variable name and the location to Oracle instantclient as variable value.
Also, define your User variables PATH with the same the location to Oracle instantclient as value.
After this stage, restart your computer for a full propagation of the newly defined environment variables.
Once on, you may open your Windows Command Prompt and run where oci* to ensure that you had your environment variables well defined; the response should look like this:
C:\Users\flex>where oci*
C:\oraclexe\app\oracle\product\11.2.0\server\bin\oci.dll
C:\oraclexe\app\oracle\product\11.2.0\server\bin\ocijdbc11.dll
C:\oraclexe\app\oracle\product\11.2.0\server\bin\ocijdbc11.sym
C:\oraclexe\app\oracle\product\11.2.0\server\bin\ociw32.dll
C:\instantclient_11_2\oci.dll
C:\instantclient_11_2\oci.sym
C:\instantclient_11_2\ocijdbc11.dll
C:\instantclient_11_2\ocijdbc11.sym
C:\instantclient_11_2\ociw32.dll
C:\instantclient_11_2\ociw32.sym
If not, your must have missed something and need to revisit the process, ensuring to completing it effectively.
You may now proceed to your php.ini file (provided environment variables are well defined) and enable your oci extensions (php_oci8.dll and php_oci8_11g.dll) by uncommenting them; you can achieve that by simply removing the semi column (;) before the said extensions.
Do remember to save your php.ini file, then, restart or start your apache if it isn't already running.
To check your PHP oci8 configurations are enabled, you may go back to your Windows Command Prompt and run: php --ri oci8; the response should be similar to the one below:
C:\Users\flex>php --ri oci8
OCI8 Support => enabled
OCI8 DTrace Support => disabled
OCI8 Version => 2.1.1
Revision => $Id: 86f22a208f89dcd5b305e82929a7429683968b11 $
Oracle Run-time Client Library Version => 11.2.0.4.0
Oracle Compile-time Instant Client Version => 10.2
Directive => Local Value => Master Value
oci8.max_persistent => -1 => -1
oci8.persistent_timeout => -1 => -1
oci8.ping_interval => 60 => 60
oci8.privileged_connect => Off => Off
oci8.statement_cache_size => 20 => 20
oci8.default_prefetch => 100 => 100
oci8.old_oci_close_semantics => Off => Off
oci8.events => Off => Off
Statistics =>
Active Persistent Connections => 0
Active Connections => 0
Alternatively, you can create a PHP file with <?php phpinfo(); ?> as content, then open it in your browser and search for oci8 occurrences; it should show enabled there as well.
It seems that you downloaded the DLL for a different architecture and pointed to it in your php.ini, instead of using the bundled DLL and simply un-commenting the default entry in php.ini.
I just downloaded the same version, XAMPP 3.2.2 x86, with PHP 7.1, and it ships with the DLL file that you need, which is installed to C:\xampp\php\ext\php_oci8_12c.dll.
You appear to have done everything else correctly.
To fix the issue, ensure that the effective php.ini (by default, C:\xampp\php\php.ini) references only the default file (remove the erroneous entry you added for php_oci8.dll), like so:
extension=php_oci8_12c.dll ; Use with Oracle Database 12c Instant Client
Restart Apache and the problem should be resolved.

Call to undefined function oci_connect, php_oci8_12c.dll, windows 8.1, php5.6.6

I have a simple php script:
<?php
$db_user = 'myusername';
$db_pass = 'mypassword';
$db_sid = 'mysid';
$conn = oci_connect( $db_user, $db_pass, $db_sid );
?>
When I run it (from a browser or from the command line), I get the error:
Call to undefined function oci_connect
I'm using php 5.6.6 which came with php_oci8_12c.dll already there.
I have extension=php_oci8_12c.dll in my php.ini
I have installed instant client (12.1) - tried 32 bit version AND 64 bit version
I have ORACLE_HOME and TNS_ADMIN environment variables pointing at the instant client folder ( C:\instantclient_12_1 ).
I also have C:\instantclient_12_1 in my path
I have a tnsnames.ora in that same folder with this relevant entry in it:
MYSID =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = myhost.net)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = MYSERVICE)
)
)
I have also downloaded SQLDeveloper from http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html
SQLDeveloper works, recognizes the above mentioned tnsnames.ora and connects and successfully runs a query on the same database that my php script is trying to access.
I have spent several hours over several days trying different things to no avail.
I'm using:
php 5.6.6
windows 8.1
IIS (so no answers involving apache please)
cmd (run as administrator)
Oracle Database 11g Enterprise Edition 11.2.0.3.0
Some other information that might prove useful:
I would ideally like to use oci 1.4.10 to match the production server, but not too worried about that for now.
pear install oci8-1.4.10.tgz
gives me this error:
The DSP oci8.dsp does not exist
I can't find any explanation on that error that means anything to me.
What am I missing - can anyone help me
EDIT:
I have tried the various suggestions in other posts on stackoverflow, namely:
extension=oci8.so with and without extension=php_oci8_12c.dll
I don't have the line extension=php_oracle.dll in my php.ini file
EDIT:
phpinfo tells me that I am using the correct php.ini file:
Loaded Configuration File => C:\php5.6.6\php.ini
This line from phpinfo might also be of use:
Configure Command => cscript /nologo configure.js "--enable-snapshot-build" "--enable-debug-pack" "--disable-zts" "--disable-isapi" "--disable-nsapi" "--without-mssql" "--without-pdo-mssql" "--without-pi3web" "--with-pdo-oci=c:\php-sdk\oracle\x86\instantclient_12_1\sdk,shared" "--with-oci8-12c=c:\php-sdk\oracle\x86\instantclient_12_1\sdk,shared" "--with-enchant=shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet=shared" "--with-mcrypt=static" "--without-analyzer" "--with-pgo"
EDIT:
It seems that dsp files are VC++ project files - I am now venturing on learning how to create a php extension, and hopefully when I've done that I'll have enough knowledge to compile the oci8 1.4.10 source code into a dll that works on windows 8 - unless somebody rescues me with the answer to this question - this looks like it is going to take me some time :-)
EDIT:
Adding display_startup_errors = On to php.ini tells me that the oci dll is not a valid Win32 application
Edit: Hmm. Trying this on Windows 8 appears to generate the same error as you specified. I'm currently investigating...
My mistake (I had enabled the wrong extension_dir line). It works in Win8 just as documented below.
The following steps should be all you need to get OCI working with PHP (I've just verified this on a freshly installed Windows 2008 R2 Standard x64 virtual machine):
Download and extract PHP (I used C:\php from php-5.6.7-nts-Win32-VC11-x86.zip).
Download and extract InstantClient (I used C:\instantclient_12_1 from instantclient-basic-nt-12.1.0.2.0.zip).
Add the above paths to the system path.
Copy c:\php\php.ini-production to c:\php\php.ini.
in php.ini:
enabled line extension_dir = "ext".
enabled line extension=php_oci8_12c.dll.
Install Microsoft Visual C++ 2010 Runtime (x86). This is needed for the OCI8 extension.
Install Microsoft Visual C++ 2012 Runtime (x86). This is needed for PHP.
At this point running php --ri oci8 in a command prompt shows me the following output:
C:\>php --ri oci8
oci8
OCI8 Support => enabled
OCI8 DTrace Support => disabled
OCI8 Version => 2.0.9
Revision => $Id: f5a3ee1083d1ffa6adb5143efda6eafa210b8414 $
Oracle Run-time Client Library Version => 12.1.0.2.0
Oracle Compile-time Instant Client Version => 12.1
Directive => Local Value => Master Value
oci8.max_persistent => -1 => -1
oci8.persistent_timeout => -1 => -1
oci8.ping_interval => 60 => 60
oci8.privileged_connect => Off => Off
oci8.statement_cache_size => 20 => 20
oci8.default_prefetch => 100 => 100
oci8.old_oci_close_semantics => Off => Off
oci8.connection_class => no value => no value
oci8.events => Off => Off
Statistics =>
Active Persistent Connections => 0
Active Connections => 0
And checking for the oci_connect function:
C:\>php -r "var_dump(function_exists('oci_connect'));"
bool(true)
In addition to what was said to fix the problem, I would like to add the php CLI side of things, as some people need to run OCI-enabled applications in CLI mode. In my case, I had to copy an instance of oci.dll into the wamp/bin/php/php<version>/ folder for php --ri oci8 to show that oci8 was correctly loaded. That doesn't prove that other files were not needed to correctly run a full-fledged application (see my technical footnote).
Including the path to the instantclient 12 distribution wouldn't do it.
Technical notes:
My environment being: Windows 7 + WAMP3 (php 5.6.15, apache 2.4.17), I was, after a number of experiments, able to narrow down the minimal set of three files that needed to be copied to the bin directory (Apache's for non-cli apps) from the instantclient 12 distribution, to allow instantiate an Oracle adapter within Zend Framework, perform an SQL query and read the recordset.
This set is: oci.dll, oraociei12.dll and orans.dll.
In particular, copying just oci.dll wouldn't allow the application to work (unknow Exception raised)

PHP extension works from browser not from CMD

I'm still struggling integrate APC with EasyPHP for testing Doctrine + CI.
Installed APC
configured php.ini
see it in phpinfo()
Added this to my php.ini :
[APC]
apc.shm_segments=1
apc.optimization=0
apc.shm_size=128
apc.ttl=7200
apc.user_ttl=7200
apc.num_files_hint=1024
apc.enable_cli=1
created a test file test.php :
<?php
print_r(apc_sma_info());
?>
accessing with browser (getting result on screen) :
Array ( [num_seg] => 1 [seg_size] => 33554368 [avail_mem] => 33237360 [block_lists] => Array ( [0] => Array ( [0] => Array ( [size] => 33237336 [offset] => 317048 ) ) ) )
running from command prompt : D:\devl\EasyPHP-5.3.5.0\www>php test.php
Fatal error: Call to undefined function apc_sma_info() in D:\devl\EasyPHP-5.3.5.
0\www\test.php on line 2
any ideas why?
I do not know EasyPHP - but there are often different php.ini files for Apache and Cli...
Please check this first for your WAMP stack.
apache and CLI may have different php.ini files, so check which is the loaded php.ini in the cli environment.

Categories