I am a newbie to php, and during an installation of a server I have to add the extension extension=mcrypt.so in php.ini file where I stuck with the following issues 1) I donno where exactly the above mentioned line should be added in the php.ini file.
Asked
Active
Viewed 1.5k times
4
-
1Possible duplicate of [Unable to find the "extensions" portion of my php.ini file, in apache 2.0, where is it?](http://stackoverflow.com/questions/5939149/unable-to-find-the-extensions-portion-of-my-php-ini-file-in-apache-2-0-where) – CherryDT May 12 '16 at 11:43
-
Ubuntu 14.04: `sudo gedit /etc/php5/apache2/php.ini` – Muhammad Shahzad May 12 '16 at 11:58
-
It is best not to use mcrypt, it is abandonware, has not been updated in years and does not support standard PKCS#7 (née PKCS#5) padding, only non-standard null padding that can't even be used with binary data. Instead consider using [defuse](https://github.com/defuse/php-encryption), it is being maintained and is correct. – zaph May 12 '16 at 13:10
2 Answers
4
You will see a group of Dynamic Extensions.
like this:
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
; If you wish to have an extension loaded automatically, use the following
; syntax:
;
;extension=modulename.extension
add your extension below this without ;

Meathanjay
- 2,023
- 1
- 18
- 24
-
1yes done it and one more thing to go 1) Could not save the file “/etc/php5/apache2/php.ini”.You do not have the permissions necessary to save the file. Please check that you typed the location correctly and try again what should be the workaround for the above error? – Shekhar Reddy May 12 '16 at 11:45
-
1
-
1
-
1You have to open this file a root/administrator, which OS are you using? – Meathanjay May 12 '16 at 11:48
-
Use this command: `sudo gedit /path/to/php.ini`. the php.ini will be open in gedit (default editor) and you will be able to save the changes. – Meathanjay May 12 '16 at 11:53
-
1that is where i did all the above changes which u have suggested previously in this thread :) – Shekhar Reddy May 12 '16 at 11:55
1
Add this line to all other extensions:
;extension=some.so
extension=thing.so
extension=mcrypt.so
Also, don't forget to reboot web server after that to make it work.

Alexey Mezenin
- 158,981
- 26
- 290
- 279
-
1My question is where to add it, I am unable to find(where exactly the line to be added) there is lot of stuff in php.ini – Shekhar Reddy May 12 '16 at 11:37
-
Just find section with a lof of commented and uncommented extensions and add your line there. – Alexey Mezenin May 12 '16 at 11:40