The Encrypt library requires the Mcrypt extension error - xampp

I am getting this error message in CI and I am using XAMPP:
An Error Was Encountered
The Encrypt library requires the Mcrypt extension.
I already look for other similar post but still have not found the right answer.
I try this adding this script in my php.ini XAMPP:
extension=php_mcrypt.dll
line 887.
and restart my xampp. but the same error still appears.
Thanks.

I was getting this error because i had switched from XAMPP(php5) to XAMPP(php7),
for this I replaced my old CI->system->libraries->encrypt.php with new file here:encrypt.php, and it worked.
In this new file we check if mcrypt_encrypt is supported or not in __construct function with code below
$this->_mcrypt_exists = ( ! function_exists('mcrypt_encrypt')) ? FALSE : TRUE;
and based on that we use different function between mcrypt_encode and _xor_encode like that.
Just to know, if you see this old file in __construct function you will see actual error checking
if (($this->_mcrypt_exists = function_exists('mcrypt_encrypt')) === FALSE)
{
show_error('The Encrypt library requires the Mcrypt extension.');
}
It worked for me.

It finally works after I move the server from PHP 7 to PHP 5 xampp server.

Related

Site inaccessible after upgrading from 3.8.3 to 3.8.7

The site auto update got to 100% but there was an error at the end.
Now I cannot access the backend or the frondend and only get this error.
Fatal error: Class 'Joomla\CMS\Plugin\CMSPlugin' not found in /home/.sites/92/site2697155/web/plugins/system/sessiongc/sessiongc.php on line 23
Can someone help me to restore my site?
Try to change session_handle in configuration.ftp to "none"
public $session_handler = 'none';
To do this, you can use FTP and modify configuration.php directly
But i guess your issue caused by 3rd plugin
Try to use FTP and rename folder
/home/.sites/92/site2697155/web/plugins/system/sessiongc
to
/home/.sites/92/site2697155/web/plugins/system/sessiongc.bak
And try to check your site.

Strange error with Symfony-2.8

I am using Symfony 2.8.18. I was always able to debug the previous error messages I had. I searched on Google for same errors but I did not find anything. Everything worked perfectly before. I restarted my local server and get the following error message:
Warning: class_implements(): Class �]� does not exist and could not be
loaded
Here is a link to the screenshot of the message: strange bug screenshot.
I deleted the cache by removing the corresponding folders and by using the following command:
php app\console doctrine:cache:clear-metadata && php app\console doctrine:cache:clear-query && php app\console doctrine:cache:clear-result
But it did not solve my problem. I do not know how to understand this error message.
Do you have any ideas on how to debug the code?
I did not change anything but it seems one or several files were corrupted. The solution was to:
Remove the vendor folder;
Run composer install.
My problem was solved by doing this.

laravel 4 header status always return 200 (OK)

I have a code below:
return Response::json($message,401);
It always return 200 OK status in my server.
The strange thing is it returned correct status code in my localhost (PHP 5.5), but when I deploy to web server (PHP 5.4.30), it always return 200 status code.
When I trace back the code, I found a difference in this file:
\vendor\symfony\http-foundation\Symfony\Component\HttpFoundation\Response.php
public function sendHeaders() {
// headers have already been sent by the developer
if (headers_sent()) {
return $this;
}
......
}
headers_sent() -> return false on my localhost, but return true on web server.
Update:
Not only Json resonse having problem, when I try to change the code as below:
http_response_code(401);
echo $message;
It will still always return with 200 code.
But if I run the script outside of laravel as below:
<?php
http_response_code(401);
echo $message;
?>
It's working fine.
Is this problem because of the difference in PHP version ?
If so, is there any way to workaround it ?
Thank you.
Make sure your server meets the Laravel requirements:
PHP >= 5.4, which seems to be the case.
Install the PHP JSON extension if not already installed (apt-get install php5-json).
Install the MCrypt PHP Extension if not already installed (apt-get install php5-mcrypt).
Make sure the app/storage directory is writable by the web server.
Also make sure you have no trailing PHP closing tags (?>) in your PHP files, as they are known to cause the headers already sent problem.

LAMP Laravel ErrorException mcrypt_get_iv_size(): Module initialization failed

I installed laravel in my new pc and i'm getting this error:
ErrorException mcrypt_get_iv_size(): Module initialization failed
I copied the project from my old pc. mcrypt is installed and enabled, and other pages that do not use laravel are working. I'm running ubuntu 14.04
I created a new laravel project (using laravel new command) and when i try to access i get:
"Whoops, looks like something went wrong."
I opened the log and the error was:
production.ERROR: exception 'ErrorException' with message
'mcrypt_get_iv_size(): Module initialization failed
any ideas?
On app/config/app.php just change:
'cipher' => MCRYPT_RIJNDAEL_256,
Run php artisan key:generate on your command line to refresh your application key.
Then clear your cache and sessions and try again.
I had this same problem today, and it was because of how Laravel 4.2 uses the new encryption method.
Make sure you run php 7.0, and add this string "MCRYPT_RIJNDAEL_256" (without the quotes) to the cipher in app.php. after generate a new key (php artisan key:generate) and add the new key.
This works for me.
Another solution:
Add "tomgrohl/laravel4-php71-encrypter": "^1.1" to the require of your composer.json
Run composer update
Add 'AES-256-CBC' to the cipher in app/config/app.php
Done!

syntax error at server for the code works fine at localhost... it is weird! :/

I have an interesting issue :/ I use CodeIgniter and the code below is working fine at my localhost, but when I upload to server I come cross with an error message like
Parse error: syntax error, unexpected
T_OBJECT_OPERATOR in
/home3/blabla/public_html/blablabla/applications/frontend/models/our_work_model.php
on line 99
function next_project($sort_work)
{
$query = $this->db->select('wname')->order_by('sort', 'asc')->getwhere('works', array('sort >' => $sort_work, 'case_study != ' => ""), 1, 0); //line 99
any idea? appreciate helps! thanks!
I know chaining like that only works in PHP5 - is the server perhaps running an older version of PHP?
Given your last question: __construct() { issue for PHP4 and PHP5. maybe an another reason
I'd say you're running PHP4.
How do you know that your CodeIgniter installation is actually using PHP 5? It could be the case that there are several PHP installations in that machine. To test it, create a PHP file in your server with the following code:
<?php
phpinfo();
?>
Then let us know what version it is showing.
initially i was getting a blank page. so i removed this
error_reporting((E_ALL & ~E_DEPRECATED));
yes if you are using codeigniter and you have to make ove code to this
error_reporting((E_ALL));
and then you will get the error above. and i found it was due to php5 being unused.

Resources