eZ Community » Forums » Developer » Php 5.3 and cronjobs
expandshrink

Php 5.3 and cronjobs

Php 5.3 and cronjobs

Tuesday 15 May 2012 7:11:06 pm - 2 replies

Again.. hi!

Here's another issue!

I just migrated an 2011.12 installation with eZ Flow previously installed on a vps running on Apache/2.2.3 (CentOS) with php version 5.2.17 into a new vps Apache/2.2.15 (Unix) php 5.3.3 and, as one could imagine, things aren't going very smoothly!

One problem at a time. Let's start with this:

The most worring thing is the cronjob that rotates the items in the page is not working anymore.

The scheduled task

cd /var/www/vhosts/domain.it/httpdocs/; /usr/bin/php -q runcronjobs.php -dall ezflow

sends out this error:

PHP Warning:  Directive 'safe_mode' is deprecated in PHP 5.3 and greater in Unknown on line 0

I have aknowledged that safe_mode has been deprecated as of php 5.3 but how to handle the thing from eZ point of view?

From my past experiences I have learned that in order to run cronjobs, safe_mode needs to be set to off and so I did but... now it's deprecated ... so.... is this a big deal?!

Modified on Wednesday 16 May 2012 9:14:07 am by Lo' F.

Wednesday 16 May 2012 9:13:40 am

I Had to migrate the installation into a new purchased vps, with all these unexpected server and php changes and upgrades...

I maybe rushed into the problem blaming on safe_mode but it probably might be related to something else and of course need your precious help one more time. (This is kind of an urgency and so had to left my previous post behind.. the one to do with the rewriterule, in there, there is no difference between the two VPSs. I'll be back to that soon, need to deal with this first)  happy.gif Emoticon

Anyway...

When I set the cron tabs to rotate the flow of the items, I focused on the WARNING massage instead of the FATAL ERROR.

Here's the whole message I got at first:

PHP Warning: Directive 'safe_mode' is deprecated in PHP 5.3 and greater in Unknown on line 0
PHP Fatal error: Allowed memory size of 373293056 bytes exhausted (tried to allocate 74798 bytes) in /var/www/vhosts/domain.it/httpdocs/lib/ezutils/classes/ezini.php on line 666

So I though it would have been enough increasing the memory_limit to 512M but not enough either as I keep getting errors..

PHP Warning: Directive 'safe_mode' is deprecated in PHP 5.3 and greater in Unknown on line 0
PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 66607 bytes) in /var/www/vhosts/domain.it/httpdocs/lib/ezutils/classes/ezini.php on line 673
 
Fatal error: eZ Publish did not finish its request
The execution of eZ Publish was abruptly ended, the debug output is present below.
Error: (eZINI::saveCache)
Couldn't create cache file 'var/cache/ini/site-9e6a5f274e4c5f5946f815a4c087cd0b.php', perhaps wrong permissions?
 
No timing points defined
Peak memory usage: 524,016.1953 KB
Group ini_load: 
Load cache: 0.0048 sec (0.0246%), 0.0048 avg sec (1)
Find INI Files: 1.3684 sec (7.0368%), 0.0003 avg sec (4136)
Parse: 17.0554 sec (87.7061%), 0.0041 avg sec (4135)
Save Cache: 0.0002 sec (0.0008%), 0.0002 avg sec (1)
Group General: 
INI string conversion: 0.2444 sec (1.2569%), 0.0000 avg sec (8270)
String conversion: 0.1379 sec (0.7093%), 0.0000 avg sec (8270)
String conversion w/ mbstring: 0.0656 sec (0.3374%), 0.0000 avg sec (4135)
 
Total script time: 19.4461 sec

...

I might be able to figure it out but meanwhile like to share... this forum has always been my lucky star!

Thanks!

 

p.s. In my previous vps never had this kind of problems, in fact there the memory_limit is set to 256M.

Modified on Wednesday 16 May 2012 9:18:25 am by Lo' F.

Wednesday 16 May 2012 1:01:43 pm

1. safe_mode you can just remove from your php.ini. In php 5.3 the directive is deprecated, and in fact safe_mode is off by default and it can not be turned on

2. memory usage: yes, php 5.3 uses more memory than php 5.2. But it is also faster, so most users don't complain too much blunk.gif Emoticon

But going from less than 256 to more than 512 seems a lot.

Maybe the problem is that there is something going wrong and looping.

I see you have an error msg about an ini file which could not be created.

a- which user are you using to run cronjobs? Make sure it has all permissions to create cache files (I generally recommend to sun cronjobs using the www-data/httpd user, same ones as for the Apache process)

b- check that when copying file overs, your file timestamps have not shifted to be in the future (this often happens with ftp clients that set file modification date after upload). That would mightily confuse eZ

c- have you installed the same set of php extensions on the new server? Not having mbstring enabled f.e. might have a bad effect on performances

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu