Adding APC Extension to PHP fpr Caching

Adding APC Extension to PHP fpr Caching

by Geoff Diggles -
Number of replies: 19

I am running a Moodle 2.5.2 on Windows Server 2008 R2, with PHP 5.3.19 installed. I am trying to get the APC Cache Plug in working to help improve performance. I have been following the kink in the Moodle Docs (as well as others) from here - http://docs.moodle.org/25/en/Installing_APC_in_Windows

As you will see from the attached pictures I have added the module but cannot get the PHP extension to load in order to be able to configure it in Moodle. I saved the required file for PHP 5.3 into the Ext folder and edited the PHP.ini, restarted and nothing. Is there something I am missing, any help would be greatly appreciated.

 

Thanks

 

Geoff

Attachment php apc.png
Average of ratings: -
In reply to Geoff Diggles

Re: Adding APC Extension to PHP fpr Caching

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Geoff; I think this might be better in the Hardware and Performance forum so I will move it to there and let's see.

In reply to Geoff Diggles

Re: Adding APC Extension to PHP fpr Caching

by John Gifford -

Hi Geoff

If you get it working can you let me know because I'm trying to use APC 3.1.13 with PHP 5.4.11 myself, I get nothing showing up on phpinfo whilst the apc.php script supplied with APC says it's not running.

I did find a note saying that Zend and APC cannot run concurrently so I don't know if that's a consideration for you, my zend is disabled in the php.ini but it still shows up in phpinfo so I don't know if it's running or not. APC promises a lot, up to a 50% decrease in hard drive access but until I can get it running I can't say yes or no to that claim.

John Gifford

In reply to Geoff Diggles

Re: Adding APC Extension to PHP fpr Caching

by jason everling -

Do you have this in your .ini file which enables APC, adding the extension to php.ini will not enable it alone, you have to specify like so in php.ini

apc.enabled=1

Thanks,

JASON

Average of ratings: Useful (1)
In reply to jason everling

Re: Adding APC Extension to PHP fpr Caching

by Geoff Diggles -

Havent done this Jason, where in the PHP.ini does this statement go? Thanks

In reply to Geoff Diggles

Re: Adding APC Extension to PHP fpr Caching

by jason everling -

You can add it to the very bottom of php.ini,

JASON

In reply to jason everling

Re: Adding APC Extension to PHP fpr Caching

by Geoff Diggles -

Thanks will try this tomorrow

In reply to Geoff Diggles

Dll problem?? Adding APC Extension to PHP for Caching

by Geoff Diggles -

Hi Jason

thanks for the information. Added this in to my ini file and indeed the extension loaded according to my phpinfo in IIS7. Unfortunately the site hit masses of errors, first it dropped the images, then complained about permissions to use this dll and then refused to login.

i initially changed the default doc to index.php as this was one of the errors but then the site started failing to load so reverted it. Removed the dll, restarted IIS and site worked again.

 

i start to think is the dll file I have downloaded not right. I downloaded php_apc-31.110-5.3-vc9-x86. My php folder is c:\program files (x86)\php\v5.3. This is on windows server 2008 R2 64bit.

anyone know of the best place to get the correct dll or if indeed they think this is not the issue can point me in the right direction.

thanks

 

Geoff

(Edited by Mary Cooch - to mention dll in subject title -original submission Thursday, 19 December 2013, 8:15 AM)

In reply to Geoff Diggles

Re: Dll problem?? Adding APC Extension to PHP for Caching

by Geoff Diggles -

Faulting application name: php-cgi.exe, version: 5.3.19.0, time stamp: 0x50ad3cc7
Faulting module name: php_apc.dll, version: 5.3.6.0, time stamp: 0x4e2b415d
Exception code: 0xc0000005
Fault offset: 0x00005900
Faulting process id: 0x494
Faulting application start time: 0x01cefcbfc83f4040
Faulting application path: C:\Program Files (x86)\PHP\v5.3\php-cgi.exe
Faulting module path: C:\Program Files (x86)\PHP\v5.3\ext\php_apc.dll
Report Id: 14c07604-68b3-11e3-8bb3-000c296fad61

Got this error when I got dll to load. Site came up with error 500 but this was in logs. Currently investigating but if anybody has any ideas, input would be appreciated.

In reply to Geoff Diggles

Re: Dll problem?? Adding APC Extension to PHP for Caching

by jason everling -

Try the versions in this page, depending on which version you are running on windows, either thread-safe (ts) or non-thread-safe (nts)

http://windows.php.net/downloads/pecl/releases/apc/3.1.13/

JASON

In reply to jason everling

Re: Dll problem?? Adding APC Extension to PHP for Caching

by Geoff Diggles -

Thanks for the reply, unfortunately no luck, when I load the nts versions the extension appears in phpinfo but then when the site loads, the front page doesn't load the graphics and on login the next page says 404 not found or 500 internal server error . Remove the file and the site goes back to normal. Very odd

In reply to Geoff Diggles

Re: Adding APC Extension to PHP fpr Caching

by Michael Aherne -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Geoff, I realise this is far from an answer to your actual question, but if you're able to upgrade PHP on your server to 5.5 you could use the built-in opcache extension, which might be easier than trying to get APC working. Just a thought!

In reply to Michael Aherne

Re: Adding APC Extension to PHP fpr Caching

by Geoff Diggles -

Thanks for the reply, would installing 5.5 cause issues for the current php.ini settings are does it just add components.

In reply to Geoff Diggles

Re: Adding APC Extension to PHP fpr Caching

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Installing 5.5 does overwrite your php.ini so you just need to reset things in there.  But the opcache is installed automatically and you just have to enable it in php.ini.  Fairly easy process.

In reply to Geoff Diggles

Re: Adding APC Extension to PHP fpr Caching

by Michael Aherne -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

If you're not running any non-core PHP modules you'll probably find you can just use your existing php.ini settings on 5.5. (BTW, I should make it clear that I'm not running a production Moodle server on Windows, just on my local development machine, so I'm no expert on this!)

If you do try this, it's probably worth pointing out that you need to configure the opcache extension as a Zend extension and not a standard one (as far as I remember it's not entirely clear from the documentation):

[ExtensionList]
zend_extension=C:\[path]\[to]\php-5.5.6\ext\php_opcache.dll

Hope this is useful!

In reply to Michael Aherne

Re: Adding APC Extension to PHP fpr Caching

by Geoff Diggles -

Thanks for the info.

In reply to Geoff Diggles

Re: Adding APC Extension to PHP fpr Caching

by Geoff Diggles -

Tried to upgrade to PHP 5.5. Downloaded the latest x86 nts version and renamed all my old PHP folders. Installed 5.5 and then changed the PHP.ini file. Configured IIS to point at the new PHP version, as soon as I started IIS and then went to browse to moodle the site just came up with an error not recognising the new version.

In reply to Geoff Diggles

Re: Adding APC Extension to PHP fpr Caching

by Simon Allison -

is the new folder in the environment variables - path section? 

you probably need to restart afterwards 

In reply to Simon Allison

Re: Adding APC Extension to PHP fpr Caching

by Geoff Diggles -

Thanks for the reply, in the interim I have installed wincache and optimised all my PHP settings. This has made a difference so far.

In reply to Geoff Diggles

Re: Adding APC Extension to PHP fpr Caching

by Simon Allison -

I put wincache on and had some wierd experiences of php/IIS crashing, and could not find any errors related.   I had turned it off just recently and the server has not gone down since!     

There was a newer DLL i tried but that didnt make any difference ....  

would like to see how you get on though!  ;)