Jump to content

Error with maintenance.php


PetitJedi

Recommended Posts

Hi all


I looked for a solution on the forum but I did not find anything that could solve the problem.

I am under a version 5.5 with a php 5.6

 

When I go to the admin backoffice and I launch the maintenance options manually, I don't have any particular concerns (it's logn but it does the job (reset hours for example or reset Pirep driver count)
On the other hand, if I want to use the cronjob and launch the suggested line (php -f /homepages/33/d797466141/htdocs/hdd/vavirtual/crew/admin/maintenance.php) it does not work.
I sent the output of the cronjob to a file and here is what I have (many of these lines) :

 

<b>Strict Standards</b>:  date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in <b>/homepages/33/d797466141/htdocs/hdd/vavirtual/crew/core/common/FinanceData.class.php</b> on line <b>127</b><br />

 

but I also have this:
 

<div id="codon_crit_error" 
    style="font-family: 'Lucida Sans',Verdana;border:#999 1px solid;background-color:#fff;padding:20px 20px 12px 20px;">
    <h1 style="font-family: verdana; font-weight:16px;font-size:18px;color:#6B001B;margin:0 0 4px 0;">An Error Was Encountered</h1>
       <p style="font-size: 16px; color: #001B6B">Unauthorized access - Invalid Permissions.</p>
       <p style="font-size: 10px;"><center><a href="https://crew.airfrancevirtuel.com">Return to Homepage</a></p>

</div>

I understand that he has a problem with permission ... but to access which folder or file? (to be able to change permissions)

in the CORE logs I find these same alerts

 

[25-May-2020 04:15:02 Europe/Berlin] PHP Strict Standards:  date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in /homepages/33/d797466141/htdocs/hdd/airfrancevirtuel/crew/core/common/FinanceData.class.php on line 127

 

In line 127 i have :

if ($time == date('Ym')) {

 

the complete function from which the line comes:

    public static function getExpensesForMonth($timestamp) {
        
        $time = date('Ym', $timestamp);
        # If it's the current month, just return the latest expenses
        if ($time == date('Ym')) {
            return self::getAllExpenses();
        }

        $sql = 'SELECT * FROM ' . TABLE_PREFIX . 'expenselog
                WHERE `dateadded`=' . $time;

        $ret = DB::get_results($sql);
        
        if(!$ret) {
            return array();
        }

        return $ret;
    }

 

of course cron is activated in local.config.php    Config::Set('USE_CRON', true);

 

today it starts to worry me about launching the scripts via the admin interface manually :)

If you have an idea so that the cronjob can run without error and allow me to focus on something else ... your help would be appreciated :)

 

thank you for reading me until the end :)

 

Best regards

Link to comment
Share on other sites

Thank you for taking the time to respond
yes my timezone is good

 

date.timezone = Europe/Paris

 

this is one of the first things I checked when I saw the logs

<b>Strict Standards</b>:  strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in <b>/homepages/33/d797466141/htdocs/hdd/vavirtual/crew/core/common/StatsData.class.php</b> on line <b>158</b><br />
<br />
<b>Strict Standards</b>:  date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in <b>/homepages/33/d797466141/htdocs/hdd/vavirtual/crew/core/common/StatsData.class.php</b> on line <b>160</b><br />

and at the end of the script execution there is

<p style = "font-size: 16px; color: #001B6B"> Unauthorized access - Invalid Permissions. </p>

What permissions does he need? on which folder or file because nothing specified: '(

 

Thanks for your help

 

Regards

Link to comment
Share on other sites

7 hours ago, PetitJedi said:

date.timezone = Europe/Paris

What version of phpVMS are you using? I think you are using v2 so go to this line:

https://github.com/phpvms/phpvms_v2/blob/master/core/common/StatsData.class.php#L137

and before it, put this:

date_default_timezone_set("Europe/Paris");

and see if that makes any difference.

 

7 hours ago, PetitJedi said:

What permissions does he need? on which folder or file because nothing specified: '(

Was this writing red by and chance? I think it may be referring to the admin panel's permissions if it's thrown an exception. You could setting 777 to the cache folder only but I don't think it's related.

Link to comment
Share on other sites

Thank you web541 for your return.


As I said in the introduction to my post, I am in version 5.5 and php 5.6

the file is not the same since I am not in version 2 😉
I added the line you suggest at location L136 (so just after {and before $ key ... (getMonthsInRange function)

 

For the color of the permission error, no it is not red.
Here is the code if it helps you in terms of color (brown and blue)

<b>Notice</b>:  A non well formed numeric value encountered in <b>/homepages/33/d797466141/htdocs/hdd/vavirtual/crew/core/common/StatsData.class.php</b> on line <b>153</b><br />
        <div id="codon_crit_error" 
            style="font-family: 'Lucida Sans',Verdana;border:#999 1px solid;background-color:#fff;padding:20px 20px 12px 20px;">
            <h1 style="font-family: verdana; font-weight:16px;font-size:18px;color:#6B001B;margin:0 0 4px 0;">An Error Was Encountered</h1>
            <p style="font-size: 16px; color: #001B6B">Unauthorized access - Invalid Permissions.</p>
            <p style="font-size: 10px;"><center><a href="https://crew.airfrancevirtuel.com">Return to Homepage</a></p>
        </div>

 

I ran the script manually from the command line and returned the output to a log file.
It is now empty (good..I have to check that the hours are updated for example ) .. apart from the code set above.

 

However, I have the line

<b>Notice</b>:  A non well formed numeric value encountered in <b>/homepages/33/d797466141/htdocs/hdd/vavirtual/crew/core/common/StatsData.class.php</b> on line <b>153</b><br />

that I didn't have.

 

Line 153 corresponds to this function

public static function getMonthsSinceDate($start) {
        
        $key_month = date('MY', $start);
        $key = 'months_since_' . $key_month;
        $months = CodonCache::read($key);
        if ($months === false) {
            if (!is_numeric($start)) {
                $start = strtotime($start);
            }
            $end = date('Ym');
            do {
                # Get the months
                $month = date('M Y', $start);
                $months[$month] = $start; # Set the timestamp
                $start = strtotime('+1 month +1 day', strtotime($month));
                # Convert to YYYYMM to compare
                $check = intval(date('Ym', $start));
            } while ($check <= $end);
            CodonCache::write($key, $months, 'long');
        }
        return $months;
    }

 

and more specifically to:

$key_month = date('MY', $start);

'M' in date format? it's not numeric... doesn't it wait 'n' ?

 

thank you so much for your help


regards

Edited by PetitJedi
Link to comment
Share on other sites

5 hours ago, PetitJedi said:

As I said in the introduction to my post, I am in version 5.5 and php 5.6

Oops I must have skimmed over that, I just took it from the lines that the error was occurring and just assumed.

 

5 hours ago, PetitJedi said:

For the color of the permission error, no it is not red.
Here is the code if it helps you in terms of color (brown and blue)

Ahh yeah that's definitely a phpVMS error and not a PHP one (even though there were PHP ones that you stated) which could indicate a problem with your database.

 

5 hours ago, PetitJedi said:

and more specifically to:

Are you sure? Line 153 here https://github.com/DavidJClark/phpvms_5.5.x/blob/master/core/common/StatsData.class.php#L153 looks like this:

$year = date('Y', $start); # Get the months

which is very similar. I think it is probably an issue with your database or at least one of the tables, have you installed recently or have you been running it for a while? That line and the non-numeric error is saying that it cannot find the date your VA started (or it cannot interpret it), and when it can't do that it will try and get the date of the first PIREP submitted. Have you had access to the admin panel before this or did it just pop up?

 

And just to check, the timezone issue is now gone?

Edited by web541
Link to comment
Share on other sites

No worries about the version worry

 

For line 153, we do not have the same line numbers because line breaks have been deleted.
However regarding the file it is the function getYearsSinceStart and therefore, yes I have the right line with just 'Y'

 

I don't seem to have any basic concerns. She has been in office for over a year.
In addition, manual maintenance scripts via the administration interface work. It’s really that when I want to go through CRON

I did not previously install the cron for maintenance

 

I looked at the date of my first worsep and it is "normal", whether it is the submitdate or modifieddate (yyyy-mm-dd hh: mm: ss)

 

You also talked about the date of creation of the VA which he could not find or could not identify. Can you tell me where is this value that I verify the information?

And for your last question the timezone seems solved ... a big thank you 😉

 

Hoping that my answers will allow you to see more clearly and to be able to direct me towards new tracks

 

regards

Edited by PetitJedi
Link to comment
Share on other sites

  • Administrators

I would recommend you do not remove/delete line breaks. It is easier for us to help you if your files are close to the default files we have available.

Have you made any other changes to StatsData.class.php? If not, replace your present file with the default and let us know what errors may show up.

 

think your error references this line in the default file: https://github.com/DavidJClark/phpvms_5.5.x/blob/master/core/common/StatsData.class.php#L171

 

Link to comment
Share on other sites

  • Administrators

Yes, I doubt that will fix the issue either. But it helps if everyone has the same line numbers on default files - easier to help others when they encounter an issue.

 

I have never used the Cron job option. I rarely run the maintenance items manually either. All my stats stay up to date.

Link to comment
Share on other sites

So I put the "original" file and relaunched the cron ..
identical result in the logs and "apparently" no change in the figures (no change in the number of flights or flight time for example)

 

in my log file, it's the same error

<b>Notice</b>:  A non well formed numeric value encountered in <b>/homepages/33/d797466141/htdocs/hdd/airfrancevirtuel/crew/core/common/StatsData.class.php</b> on line <b>171</b><br />
        <div id="codon_crit_error" 
            style="font-family: 'Lucida Sans',Verdana;border:#999 1px solid;background-color:#fff;padding:20px 20px 12px 20px;">
            <h1 style="font-family: verdana; font-weight:16px;font-size:18px;color:#6B001B;margin:0 0 4px 0;">An Error Was Encountered</h1>
            <p style="font-size: 16px; color: #001B6B">Unauthorized access - Invalid Permissions.</p>
            <p style="font-size: 10px;"><center><a href="https://crew.airfrancevirtuel.com">Return to Homepage</a></p>
        </div>

 

 

@ProAvia

If I do not launch reset hours for example, the calculation of the hours and the number of flights does not update automatically.
That's why I want to activate the cronjob

Edited by PetitJedi
Link to comment
Share on other sites

  • Administrators

The issue might be specific to your website host.....

 

First - back up the StatsData.class file

 

Change

$key_month = date('MY', $start);

To

$key_month = date('i', $start);

Save the newly edited file, try it again and let us know of the outcome...... If it doesn't work, revert to the backup file.

Link to comment
Share on other sites

4 hours ago, ProAvia said:

The issue might be specific to your website host.....

 

First - back up the StatsData.class file

 

Change


$key_month = date('MY', $start);

To


$key_month = date('i', $start);

Save the newly edited file, try it again and let us know of the outcome...... If it doesn't work, revert to the backup file.

 

You could also just comment out the line and add the new one, if the new bit of code fails, you just have to delete the new code and uncomment the old

Link to comment
Share on other sites


thank you for your feedback

The result is the same..


No calculation of reset hours (among other things) and always the same error message on line 171

putting in 'i' doesn't change anything 😢

 

@ProAvia the server is a dedicated server, so no memory timeout or other concerns (normally)

there are +110,000 pireps and through the backoffice it works

 

I'm losing my Latin 😞 

(it’s a French expression, I’m not sure it is understood by English speakers .. sorry :) )

 

regards

Link to comment
Share on other sites

18 hours ago, PetitJedi said:

You also talked about the date of creation of the VA which he could not find or could not identify.

It gets that from the submitdate column of the first PIREP in your database.

Now that you mention it, it could be related to your financial expenses so potentially one of your PIREPS may have a submit date that's not actually a valid date in yyyy-mm-dd hh:mm:ss so you may want to check that (or run a query), first check the very first PIREP in your database.

 

If that doesn't work, try this:

Change this line in admin/maintenance.php:

FinanceData::updateAllExpenses();

put this:

CodonCache::delete('start_date');
CodonCache::delete('months_since_start');
FinanceData::updateAllExpenses();

and now run the cron.

 

 

If that doesn't work, see if the error goes away by commenting this out in admin/maintenance.php

FinanceData::updateAllExpenses();

TO THIS:

// FinanceData::updateAllExpenses();

 

Link to comment
Share on other sites

so for the first point, my first worsep (id = 1) is in good shape

On the other hand, as I recovered the worseps from our old system I have a lot of worseps which have the exact same date (I don't think that this poses any problems) including the very first one.
I changed her date with one day less ... just in case ...
-->Test result: no change

modification of the maintenance.php script
-> no change

commenting // FinanceData :: updateAllExpenses ();

So, I no longer have the error

<b>Notice</b>:  A non well formed numeric value encountered in <b>/homepages/33/d797466141/htdocs/hdd/airfrancevirtuel/crew/core/common/StatsData.class.php</b> on line <b>171</b><br />     

but always    

<div id="codon_crit_error" 
			style="font-family: 'Lucida Sans',Verdana;border:#999 1px solid;background-color:#fff;padding:20px 20px 12px 20px;">
			<h1 style="font-family: verdana; font-weight:16px;font-size:18px;color:#6B001B;margin:0 0 4px 0;">An Error Was Encountered</h1>
			<p style="font-size: 16px; color: #001B6B">Unauthorized access - Invalid Permissions.</p>
            <p style="font-size: 10px;"><center><a href="https://crew.airfrancevirtuel.com">Return to Homepage</a></p>
		</div>

 

and I still haven't updated the hours, number of flights, etc. In short, the maintenance part 😢

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...