10

I'm trying to get the easter_date from this year. This is my code:

<?php
$year = date ("Y");
$easter = date ("d-M-Y", easter_date ($year));
echo "Easter " . $year . ": " . $easter . "";
?>

When I execute the code following error appears: Fatal error: Call to undefined function easter_date() in

My phpVersion is 5.3.3. I'm using Linux(Ubuntu).

Have you got an idea what is missing?

5 Answers 5

30

If you use a Dockerfile based on php:7.1, you can install the calendar extension easily:

RUN docker-php-ext-install calendar && docker-php-ext-configure calendar
Sign up to request clarification or add additional context in comments.

1 Comment

Works well when based on php:5.6 too.
21

Seems like your php has been compiled without --enable-calendar support

http://ru.php.net/manual/en/calendar.installation.php

Comments

2

I simply had to enable the calendar extension in php.ini:

extension = calendar.so

Comments

1

Have you looked here? http://www.php.net/manual/en/calendar.installation.php

To get these functions to work, you have to compile PHP with --enable-calendar .

Comments

0

You may but need not to recompile php with --enable-calendar. You can just install php-calendar package.

For your system (Linux/Ubuntu), you may run:

sudo apt-get install php-calendar

2 Comments

apt-get doesn't exist on OSX
OSX was just a typo. OP's system is obviously Linux, Ubuntu. I fixed the typo. However, if your system is macOS and you use either Brew or MacPorts you can install php-calendar package using the respective package manager.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.