I am working on a website which is hosted on a VPS with CENTOS 5.4 i686 virtuozzo installed. I have a drupal installation on the server which gets around 100s of authenticated users at the same time.But at a certain point of time the server stopped responding and the site went offline. So, I tried installing the opcode cache - Alternative PHP Cache.
While the rest parts of the server work fine, the Drupal installation crashes as soon as I install PECL APC with the following message
Fatal error:Cannot run code from this file in conjunction with non encoded files in /home/apogee/public_html/2010/themes/zen/zen/block.tpl.php.
Could you please tell me a way to properly configure Drupal to use APC ?
Thanks
niting
I think the error comes from Zend Encoder...if you don't need it installed then uninstall it and see if that fixes things. If you do need it (closed-source module?), then not sure if that and APC can play nicely together...
you must be disable APC on php.ini
apc.enabled=0
APC and Zend Optimizer can't work with together
David Strauss at four kitchens has done some work on getting Pressflow (Performance tuned Drupal distribution) to work well with APC https://wiki.fourkitchens.com/display/PF/Tuning+APC.
With that much concurrent usage it may be worth your while to look into pressflow.
I have a couple of websites using APC and I've never seen that kind of error -- even with the Drupal-based ones.
After a bit of searching, it seems related to Zend Optimizer and/or Encoder (see the last answer on this thread, for instance), and not to Drupal itself.
I suppose you should use either Zend products, or APC, but not a combinaison of both.
Related
So, we have a Laravel 5.1 based project we want to release soon, but we're noticing poor performance, and we're trying to optimize the server setup.
As listed in the title, we're deploying this on a CentOS 6.7 server, with Nginx 1.8.1 and PHP 7 with PHP-FPM. Since CentOS 6.7's repositories do not offer PHP 7, we're using IUS' replacement packages.
One of the things we noticed that might be causing poor performance is the fact that Zend Opcache, despite being enabled and working (we have a good hit rate), does not seem to be caching all of the files in our project. We're using opcache-gui to help visualize the contents of the cache and, while many of the project's files are there (including files from third party libraries), most are missing, including our main controller and many of the supporting classes. In fact, when we disable Opcache, the response times remain virtually the same. The opcache blacklist is currently empty, so that's not the reason why they're not being included.
We've attempted to forcefully cache the missing files using opcache_compile_file(), and while the files do get compiled and cached, they never get any hits.
It was my understanding that Opcache would cache all of the files being executed, but that doesn't seem to be what's happening here. I've looked at the opcache settings, but could not find one that would obviously influence this kind of behavior, apart from the blacklist.
Is there anything else that I'm missing? Any other criteria that PHP would rely on when deciding on what to cache or not?
Any help on the matter would be appreciated!
Can you check the value of opcache.max_file_size? Maybe that's your issue, as compiled files are larger than original file.
Can you test the files you don't see in opcache-gui with http://php.net/opcache-is-script-cached?
Also, as a test, can you try to force the compile? Use http://php.net/opcache-compile-file for this matter. It's just to see if there's a true and if it can compile it in the first place.
I am running a web server with Debian and I'm hosting a ZF1 project.
The PHP process crashes from time to time without any reason, so my hosting provider suggests that I should switch from APC to APCu caching. I'm not very familiar with PHP caching and I can't really find any documentation on the topic, but I read a few similar questions here.
As far as I understand the APCu caches only user data (whatever that means) and it's not the full features of the APC. Considering this, my question is will APCu increase the load of the server and will the PHP extension work out of the box without touching the ZF1 code?
http://zend-framework-community.634137.n4.nabble.com/Does-ZF-1-12-support-PHP-5-5-td4661902.html
You should upgrade to the latest PHP on a test environment, if it works well (most likely scenario), you can switch. PHP 5.5 has built-in opcode cache (http://php.net/manual/en/intro.opcache.php), so you won't lose performance. Very little difference can be between the performance of APCu and APC.
Also, function names are not identical (apcu_fetch for instance), so you have to modify the code to reflect this.
I'm trying to figure something out:
I am using Ubuntu server 11.10 virtualized on Win7 (I don't think that matters but more info is better than less) to work on a Drupal 6 website I inherited and need to make significant changes to.
I want to set up a development copy of this Drupal website on my Ubuntu server so I can work without worrying about torching the production website.
I successfully got the production files downloaded and onto my machine, I got the production MySQL database exported and imported into the dev MySQL server, and I set up a symbolic link from the directory /home/myname/thewebsite.com to /var/www/thewebsite.com so I can easily access it.
When I got the website they didn't know the admin password so I dug around online and reset it in the dev db using phpmyadmin and finally log in.
When logging in and poking around the site there are lots of errors, which when googled lead me to believe that PHP 5.3 is causing them and that there are some modules in use that only work with PHP 5.2
After looking around a lot online and on stackoverflow there seems to be no easy way to install PHP 5.2 on Ubuntu Server 11.10. With no packages for 5.2 available through apt-get or aptitude what should/can I do?
1) Install 5.2 from source - how do I get it to interface with MySQL and Apache2? Also, I've never installed anything significant from source. Is there a walkthrough?
2) Replace the repositories with old ones? Will this work on 11.10? The newest instructions I found were for 10.04
3) Use already built PHP 5.2 packages for Ubuntu? Couldn't find these
4) Pay someone who knows more to do it for me? (Just kidding, this isn't really an option...)
Cheers and thanks for your help!
PHP dropped support for 5.2 in August 2011; operating system providers such as Ubuntu will not supply a version that is out of support, so you absolutely won't get an official copy of PHP 5.2 on the current version of Ubuntu (or any other OS).
If you're running an older version of Ubuntu (eg 10.04), you might be able to do it; it would still be a downgrade, because PHP 5.3 has been the default version for quite a long time now.
If you're on a newer version of Ubuntu, ie 11.10 as you state, it is going to be a problem for you.
The Drupal developers dropped the ball badly on this one. I guess it was because Drupal 7 tool so long to finish; they were expecting D7 to be out much sooner, and so they never bothered fixing up D6 to work with PHP5.3. As it turned out, this was a big mistake, because in fact D7 still wasn't officially released when PHP dropped support for 5.2.
But even so, they should have fixed it, because they're still officially supporting Drupal 6, so they need it to work with the current version of PHP. This is definitely Drupal's problem, not PHP's, Ubuntu's or yours.
But you still need to deal with it.
I found this question over on AskUbuntu.com, which gives an answer applicable to 11.04. It isn't quite 11.10 you were asking for, but it it a lot more recent than the best you'd found, so it might be helpful.
Alternatively, you could research exactly what it is about Drupal6 and your specific modules that doesn't work in PHP5.3. The language differences between 5.2 and 5.3 that can break things are not big, so I would expect any code changes required to be fairly small. You might find you can fix the code yourself. And maybe even submit the changes to the community -- Drupal is open source, after all.
Another tack you could take is to consider whether this saga represents an opportunity for you to move the site to Drupal 7?
This may or may not be feasible, depending on the modules you're using, etc, but if it is possible, it will solve the problem, because D7 is of course fully compatible with PHP5.3.
And just to cheer you up, I'll close by mentioning that PHP are on the verge of releasing PHP 5.4. Hopefully the Drupal devs will be more on the ball this time.
I have installed PHP5 - PHP5-MEMCACHE - PHP-APC.
Can they work like that together? Will the loading be fast with these modules ?
I tried to use them, I don't "see" particular differences, maybe the CPU is used less with these modules. My website doesn't have high traffic, but If i can save resources is better!
Thank you
APC keeps cache of PHP bytecode. Memcache keeps cache of your vars, that you set.
So answer is Yes, they can. They're made for different things.
They work together very well, you just need to use them properly :
Memcached is a distributed cache system. What that means in a nutshell is that if you have a cluster of servers all of them can access the same cache pool
APC is an opcache and local cache system. Meaning it optimizes the php scripts so when going through the compiler less operations are made and the code is executed way faster. Another use of APC is local cache, which means you can store values in the cache and access them from the machine running the code.
Yes, they can work together. Whether they will on a production system is another story...
Personally, I had to give up trying to get the following to work for any extended period of time:
Ubuntu 10.04
NGINX 0.7.65
PHP 5.3.2
php-apc
php5-memcache
It will run for awhile, but after stress testing php errors out. I can restart php-fastcgi via /etc/init.d/php-fastcgi and things will role along for some time more, but it always crashes again sooner than later.
I can run either/or without issue, but the two together won't cooperate for me. FYI I tried using binaries (apt-get packages), installing as PECL extensions, downloading source, but all roads lead me to the same sad fate. I also tried running the memache daemon local & remotely on my web host, but same outcome.
I'm working on mmo game based on JavaScript and PHP. We are using both of them. I can't tell you more, beacause I am only frontend developer, however I think if APC and memcache were bad we were not using it.
I currently purchased a dedicated server hosted at iWeb and got it administered by them.
I recently asked after registration to add php_apc and php_imagick to the available libraries. It seems according to them that it is not possible as it is not supported with cPanel.
I would apparently need to do that myself... is there any risks to install those two libraries ? What kind of problem could it raise if there is any ? In case I would have to debug this myself.
Installing Imagemagick to your system in itself won't be too much of a problem.
However, adding support for it and APC to PHP may be a tricky procedure; it may be best for you to just no longer use the PHP provided by cPanel and install PHP yourself, which will go into /usr/local, and run the configure script for it yourself, compiling in whatever extensions you need. It'll mean that you'll need to keep PHP up to date yourself, but it'll also mean that you won't have all your customisations to it wiped the next time cPanel upgrades it.
If there are better suggestions I'd also be interested to hear them.