开发者

Fatal error: Call to undefined function easter_date()

开发者 https://www.devze.com 2023-02-16 12:51 出处:网络
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));

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 err开发者_运维百科or 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?


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


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

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


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

extension = calendar.so


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 .


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
0

精彩评论

暂无评论...
验证码 换一张
取 消