I am using WAMPSERVER on my windows.I have downloaded the APC and also APCU PHP extensions and enabled it.Now when I run my Symfony2 project I received error
Unable to use ApcUniversalClassLoader as APC is not enabled
in phpinfo it is showing like this block
and in my php.ini file I have a added following line of code
[APC]
;specifies the size for each shared memory segment 8MB to start
apc.shm_size=128M
;max amount of memory a script can occupy
apc.max_file_size=1M
apc.ttl=0
apc.gc_ttl=3600
; means we are always atomically editing the files
apc.file_update_protection=0
apc.enabled=1
apc.enable_cli=1
apc.cache_by_default=1
apc.include_once_override=0
apc.localcache=0
apc.localcache.size=512
apc.num_files_hint=1000
apc.report_autofilter=0
apc.rfc1867=0
apc.slam_defense=0
apc.stat=1
apc.stat_ctime=0
apc.ttl=7200
apc.user_entries_hint=4096
apc.user_ttl=7200
apc.write_lock=1
can someone tell me what I am missing?
Related
I'm running a php script via terminal and I get this error message Allowed memory size of 536870912 bytes exhausted.
So i then added ini_set("memory_limit", "4096M"); to the php file and that did not work.
Then i run php --ini to see which loaded cli file (/etc/php/7.4/cli/php.ini) is being used and after editing said file i found that there is no memory limit set in it ini_set("memory_limit", "-1");
I have no idea what's going on (not very linux savvy). Where is it drawing the conclusion that it only has 512M of available memory?
Edit #1: I also did a phpinfo() which said the php.ini file is at /etc/php/7.4/apache2/php.ini so I edited that file as well, still getting the same result (restarted apache and initiated a new terminal window as well)
Edit #2: the script is run by php mylocalphpfile.php -params
Ubuntu 20, php 7.4
Ok found out that the forked script from Github has some references to other dependencies in which the memory_limit is being forced to be 512M.
Removed that line of code form the lib and now it's working.
After installing APC on a VPS with CentOS/Nginx/8G Ram, apc.php always shows uptime = 0 minutes, this is my apc configuration :
apc.enabled=1
apc.shm_size=512M
apc.num_files_hint=10000
apc.user_entries_hint=10000
apc.max_file_size=5M
apc.stat=0
apc.optimization=0
apc.shm_segments=1
apc.enable_cli=1
apc.cache_by_default=1
apc.include_once_override=1
I restared nginx afeter updating php.ini, the website seems to be faster than before, do you thing "uptime=0" is normal value ?
I recently got stuck on this php error I am receiving :
PHP Warning: PHP Startup: Unable to load dynamic library 'c:\PHP\php_soap.dll' - The specified procedure could not be found. in Unknown on line 0
I have declared the dll in both my ini files. I'm running windows 7 and the site is hosted on iis using a MSSQL Database. I'm using PHP 5.4.1 (Company Policy)
My ini file for the changes :
; Directory in which the loadable extensions (modules) reside.
extension_dir = "c:\PHP"
extension=php_soap.dll
[soap]
; Enables or disables WSDL caching feature.
soap.wsdl_cache_enabled = 0
; Sets the directory name where SOAP extension will put cache files.
soap.wsdl_cache_dir="/tmp"
; (time to live) Sets the number of second while cached file will be used
; instead of original one.
soap.wsdl_cache_ttl=86400
Please help, I've tried everything. Even re-installing.
Thank you.
Are you sure php_soap.dll is in the folder c:\PHP\? If not, you need to adjust the extension_dir config setting in php.ini to the proper extension folder.
I have installed Symfony 2 and I have activated the opcache (ZendOPtimizer) extension and when I intent to generate the cache of a web page O've got this error :
Warning: filemtime(): stat failed for C:/Apache24/htdocs/symfony/app/cache/dev/annotations/Acme-DemoBundle-Controller-SecuredController.cache.php in C:\Apache24\htdocs\symfony\vendor\doctrine\common\lib\Doctrine\Common\Annotations\FileCacheReader.php line 97
This is my opcache config :
zend_extension="c:\php\ext\php_opcache.dll"
opcache.enable=1
opcache.use_cwd=0
opcache.validate_timestamps=0 ; file stat
opcache.revalidate_freq=2 ; seconds
opcache.revalidate_path=0
opcache.save_comments=0
opcache.load_comments=0
opcache.dups_fix=0
opcache.inherited_hack=0
opcache.log_verbosity_level=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.enable_file_override=1
opcache.max_wasted_percentage=5 ; percent waste until restart
opcache.consistency_checks=0
opcache.force_restart_timeout=180
opcache.blacklist_filename=paypal.php
opcache.fast_shutdown=1
opcache.optimization_level=0xffffffff
opcache.enable_slow_optimizations=1
opcache.max_file_size=0
When I disable this extension, the generation of the cache works
Versions :
Symfony 2.3.3
PHP 5.5
Apache 2.4.6 For Windows
I had exactly the same problem on my Mac, using the homebrew php55 version.
As mentioned in the Optimizer documentation, the option opcache.enable_file_override=1 may break some frameworks. It seems that is the case for Symfony2. Switching the value to 0 solved the problem.
1 - Make sure you have disabled APC or it'll create conflicts.
2 - Make sure you've restarted apache entirely after activating opcache.
Some basic information:
Linux: 2.6.32 (64bit)
PHP: 5.4.15
Apache: 2.4.4
MySQL: 5.6.11
APC: 3.1.9
Wordpress: 3.5.1, with Woocommerce(2.0.10)
The problem is, when I enable APC, the following errors occur:
Warning: register_shutdown_function(): Invalid shutdown callback 'wpdb::__destruct' passed in /usr/local/httpd/htdocs/wp-includes/wp-db.php on line 537
Fatal error: Call to undefined method wpdb::init_charset() in /usr/local/httpd/htdocs/wp-includes/wp-db.php on line 542
Here is my APC config in php.ini:
[APC]
; Reference: http://www.php.net/manual/en/apc.configuration.php
extension=apc.so
apc.enabled=1
apc.shm_segments=1
; 32MB per Wordpess install. Ref: http://gregrickaby.com/the-perfect-apc-configuration/
apc.shm_size=320M
;Relative to the number of cached files (you may need to watch your stats for a day or two to find out a good number)
apc.num_files_hint=10000
;Relative to the size of WordPress
apc.user_entries_hint=10000
;The number of seconds a cache entry is allowed to idle in a slot before APC dumps the cache
apc.ttl=7200
apc.user_ttl=7200
apc.gc_ttl=3600
;Setting this to 0 will give you the best performance, as APC will
;not have to check the IO for changes. However, you must clear
;the APC cache to recompile already cached files. If you are still
;developing, updating your site daily in WP-ADMIN, and running W3TC
;set this to 1
apc.stat=1
;This MUST be 0, WP can have errors otherwise!
apc.include_once_override=0
;Only set to 1 while debugging
apc.enable_cli=0
;Allow 2 seconds after a file is created before it is cached to prevent users from seeing half-written/weird pages
apc.file_update_protection=2
;Leave at 2M or lower. WordPress does't have any file sizes close to 2M
apc.max_file_size=2M
;Ignore files
apc.filters = "/usr/local/httpd/htdocs/apc.php,/usr/local/httpd/htdocs/phpinfo.php,wp-cache-config"
apc.cache_by_default=1
apc.use_request_time=1
apc.slam_defense=0
;apc.mmap_file_mask=/tmp/apc.XXXXXX
apc.stat_ctime=1
apc.canonicalize=1
apc.write_lock=1
apc.report_autofilter=0
apc.rfc1867=0
apc.rfc1867_prefix =upload_
apc.rfc1867_name=APC_UPLOAD_PROGRESS
apc.rfc1867_freq=0
apc.rfc1867_ttl=3600
apc.lazy_classes=0
apc.lazy_functions=0
apc.file_md5=0
Here are some combination of what I tried:
apc.stat = 0, apc.stat_ctime=0
apc.stat = 1, apc.stat_ctime=1
apc.stat = 0, apc.stat_ctime=1
apc.stat = 0, apc.stat_ctime=0
However, APC still cannot be used. Only when I disable APC, the site works properly.
Can anyone please tell me what is the problem?
Thank you in advance.
APC config in image
Probably APC does not interpret that syntaxis of register_shutdown_function correctly. There are two ways of defining static method callbacks with this function:
register_shutdown_function('someClass::someMethod');
register_shutdown_function(array('someClass', 'someMethod'));
You could refer to the documantation and commetns for more information: http://php.net/manual/en/function.register-shutdown-function.php
Wordpress also worked for me when I disabled apc from php.ini