Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

GeertvdV's avatar

Laravel project - php mcrypt extention required

Hello,

I'm trying to run a laravel project. But when I run the command: "php artisan serve" I get the following message: Mcrypt PHP extension required. I tried adding a php mcrypt extention from the website: https://pecl.php.net/package/mcrypt/1.0.2/windows There i received a file php_mcrypt.dll Also I added the mcrypt extension "extension=php_mcrypt.dll" to the php.ini file. Keep in mind, i'm using php 7.2.24 This is required for the project to run. The mcrypt file from the website is made so it can run on php versions above 7.1 (i'm aware that mcrypt was removed from 7.2^)

I still get the message that the mcrypt extention is required. Does anyone how to fix this?

Thank you for your time.

0 likes
15 replies
Sinnbeck's avatar

What are you running? Xampp, ubuntu, something else?

GeertvdV's avatar

sorry i forgot to tell that, i'm running xampp.

siangboon's avatar

I do not have mycrypt extension but the command is working fine for me...

I just glance through Laravel documentation page, mycrypt is only listed in version 5.0 server requirement...

https://laravel.com/docs/5.0#server-requirements

i guess you may have multiple php version installed, double check which php version you use or run the php -m to list the modules and check mycrypt is there.

double check the right php version for the right laravel version, and web version and CLI may different also...

if you need to run particular php version different from the version in your existing environment, just include the full path for example c:\php5\php artisan serve

1 like
GeertvdV's avatar

@siangboon Hello, yeah i'm really struggeling with it right now. Becouse...When i download a older version of PHP, like php 7.1 ore less. It says that this project needs php 7.2^. So the PHP version needs to be high, but then i have no mcrypt which this project also needs. Thats why i'm trying to install this mcrypt file, but i can't figure it out. I keep getting the error message.

siangboon's avatar

run php -m to check whether the mcrypt is install.

show more information (screenshot the error) or the version in used may help others to understand more...

php -v

and

php artisan -V
GeertvdV's avatar

@siangboon Hi i can't send photos on this forum. But i got php: PHP 7.2.24 (cli) (built: Oct 22 2019 11:18:58) ( ZTS MSVC15 (Visual C++ 2017) x64 ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

and the only message i get when i do php artisan -v is: Mcrypt PHP extension required.

I havent figured out what to do

siangboon's avatar

Please do not upload file that require others to download... i'm very hesitate to download file just to answer question, i think others may think so also...

my suggestion is, download and use php version 5.4 and run the full path command instead of just php inside your project folder

c:\php5\php artisan serve

where "c:\php5\php" is the full path of php 5.4 version


{
    "license": "MIT",

    "require": {
        "php": ">=5.4.0",
        "laravel/framework": "4.2.x",
        "d11wtq/boris": "1.0.8",
        "barryvdh/laravel-debugbar": "1.*@dev",
        "barryvdh/laravel-twigbridge": "0.3.*",
        "barryvdh/laravel-elfinder": "*",
        "barryvdh/laravel-httpcache": "*",
        "barryvdh/laravel-ide-helper": "~1.8",
        "barryvdh/laravel-translation-manager": "0.1.x@dev",
        "barryvdh/laravel-vendor-cleanup": "*",
        "phpoffice/phpword": "dev-master",
        "knplabs/knp-snappy": "0.2.x@dev",
        "barryvdh/laravel-snappy": "0.1.x@dev",
        "anahkiasen/former": "~3.4@dev",
        "league/stack-robots": "~1.1",
        "guzzlehttp/guzzle": "^6.0.0",
        "rhumsaa/uuid": "~2.8",
        "doctrine/dbal": "~2.4",
        "league/flysystem": "~1.0",
        "league/fractal": "0.12.*",
        "picqer/exact-php-client": "^3.0.0",
        "barryvdh/laravel-async-queue": "^0.3.0",
        "league/flysystem-aws-s3-v3": "^1.0",
        "eluceo/ical": "^0.9.0",
        "fruitcakestudio/laravel-recaptcha": "^0.1.0",
        "fabpot/goutte": "^3.1",
        "fruitcakestudio/omnipay-sisow": "~2.0",
        "league/glide": "^1.2",
        "omnipay/mollie": "^3.2",
        "mollie/mollie-api-php": "^2.0",
        "intervention/validation": "^1.2",
        "phpoffice/phpspreadsheet": "^1.2",
        "geocoder-php/common-http": "^4.2",
        "php-http/guzzle6-adapter": "^2.0",
        "swisnl/geocoder-php-nationaal-georegister-provider": "^1.2",
        "php-http/curl-client": "^2.0",
        "guzzlehttp/psr7": "^1.6",
        "php-http/discovery": "^1.7",
        "php-http/message": "^1.7",
        "psr/http-factory": "^1.0",
        "http-interop/http-factory-guzzle": "^1.0"
    },
    "autoload": {
        "classmap": [
            "app/commands",
            "app/controllers",
            "app/exceptions",
            "app/models",
            "app/interfaces",
            "app/libraries",
            "app/database/migrations",
            "app/database/seeds",
            "app/strategies",
            "app/jobs"
        ],
        "psr-0": {
            "": ["app/src",  "app/libraries", "app/observers", "app/transformers"]
        }
    },
    "scripts": {
        "post-install-cmd": [
            "php artisan vendor-cleanup",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "php artisan vendor-cleanup",
            "php artisan clear-compiled",
            "php artisan ide-helper:generate",
            "php artisan ide-helper:meta",
            "php artisan elfinder:publish",
            "php artisan optimize"
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ]
    },
    "config": {
        "preferred-install": "dist",
        
    "github-oauth": {
            "github.com": "ea65b078d98a2a459569bdfa242ddf2c3841d9a6"
        }
    },
    "minimum-stability": "stable"
}
Snapey's avatar

Is this an old project that you are being asked to work on?

What version is it (look for laravel in composer.json)

GeertvdV's avatar

@snapey yes, its a old project that needs to be upgraded. but for me to upgrade it i need to get it running locally. @siangboon sorry, i'm pretty new to all of this. I don't know how i should post everything but i learn from it. I'll try to run it, thanks.

siangboon's avatar

"php": ">=5.4.0",

"laravel/framework": "4.2.x",

the composer.json show that your Larvel version is very old... you can run php 7.2 but the chance you hit error is very high, "mcrypt" is the example, as it's deprecated and removed from version 7.2 onward...

this is my third time to suggest to use php 5.4 and that's. All the Best!

GeertvdV's avatar

Thank you very much for your help. I'm going to try that right now.

GeertvdV's avatar

@siangboon I tried to run it with php 5.4.5, but its such a difficult project to run. (if you haven't made it yourself) When i run it i get the error: Parse error: syntax error, unexpected '$value' (T_VARIABLE) in C:\Users\lapto\Documents\haptap\vendor\aws\aws-sdk-php\src\functions.php on line 36

This error is common, when i look it up they say it needs php 5.5^ Gonna try it now.

siangboon's avatar

i had setup a Laravel 5.5 project with php 7.0 last 2 days, and hitting similar compatibility issue, i think it is similar to yours although the error is different....

This thread help to solve my issue:

https://stackoverflow.com/questions/48787078/laravel-5-parse-error-syntax-error-unexpected-expecting-variable-t-var

If your server doesn't have php 7.1 and above and you are only restricted to use php7.0 do as below:

Delete vendor folder Delete composer.lock file Add this to composer.json file under config c> "platform": { "php": "7.0.0" } As well, ensure PHP version under require is set to 7.0.0 as shown below in config.platform.php:

"config": { "platform": { "php": "7.0.0" } } Run composer install using CMD This now will make sure that only dependencies compatible with php7.0 are installed.

perhaps you can change the version number and give a try.

Please or to participate in this conversation.