I've been trying to install mcrypt extension for php5 on Ubuntu 14.04 ARM server running nginx.
PROBLEM
In phpinfo() I can only see the authors of mcrypt but the module itself is missing. I can't use mcrypt functionalities anywhere on that server.
WHAT I TRIED
Running php5 -m shows that mcrypt is installed.
In /etc/php5/fpm/php.ini I have the following extension = /usr/lib/php5/20121212+lfs/mcrypt.so. This I read in google after I tried only with extension = mcrypt.so. Neither gave result.
In /etc/php5/fpm/conf.d/20-mcrypt.ini I have this extension=/usr/lib/php5/20121212+lfs/mcrypt.so as well.
I restarted php5-fpm and nginx multiple times, I also tried php5enmod mcrypt which doesn't show any warnings or errors.
I created symlink between the .so and .ini file.
Any ideas?
Ok so it turns out that my only escape was to purge php5-fpm, reboot the server, then apt-get install php5-fpm, now everything is loaded correctly. I have no idea why this happens. If anyone has explaination I'll be happy to update my answer with it.
Related
I have php project I want to develop in osx and I have used memcache
I have implemented in linux but when I try to migrate to osx i can't find memcache
I have tried to install it with brew or pecl doesn't work
I have tried xampp as well and doesn't work
Sure I have done
sudo apachectl restart
added memcache.co to php.ini
I use php 5.6 and php 7.0 and just note I use memcache not memcached
It should be installed with PECL:
pecl install memcache
locate the php.ini file:
php --ini
then edit the php.ini file and add the complete path to memcache.so (as shown at the end of the installation output)
I'm really stuck on this I've been searching for hours...
I recently installed an Apache server on a remote Ubuntu box for my website and I wanted to get started with PHP and MySQL. MySQL is installed and running. PHP installed fine, that works, but I can't figure out how to enable the MySQL extension. I've already done sudo apt-get install php5-mysql and/or sudo apt-get install php5-mysqlnd but neither of those seemed to actually install anything, at least according to my Apache server. When I run php -m I see mysql, mysqli, and mysqlnd. I've also tried uncommenting the lines for loading the extensions in the Apache php.ini file but none of the mysql.so or mysqli.so or whatever exist in the default extension directory. There is another PHP extensions directory with those files in it, but when I tried pointing my Apache server to that extension directory, I got errors saying this:
/usr/local/lib/php/extensions/no-debug-zts-20131226/mysqli.so: undefined symbol: core_globals in Unknown on line 0
I've tried everything I've seen so far and nothing has worked. That error was the closest I got. Any help is appreciated.
Also here's my phpinfo() output: http://pastebin.com/VM8kyrKV
I also get this when I run sudo apt-get install php5-mysqlnd:
php5_invoke: Enable module mysqlnd for cli SAPI
php5_invoke: Enable module mysqlnd for apache2 SAPI
php5_invoke: Enable module mysql for cli SAPI
php5_invoke: Enable module mysql for apache2 SAPI
php5_invoke: Enable module mysqli for cli SAPI
php5_invoke: Enable module mysqli for apache2 SAPI
php5_invoke: Enable module pdo_mysql for cli SAPI
php5_invoke: Enable module pdo_mysql for apache2 SAPI
Which seems to look good but it's still not working... I can't find any mysql module files anywhere except the ones for CLI PHP.
Edit:
Long story short, don't compile your own binaries... I started over only using apt-get to install things and everything just worked.
I've already done sudo apt-get install php5-mysql and/or sudo apt-get install php5-mysqlnd but neither of those seemed to actually install anything, at least according to my Apache server.
Your output from phpinfo() shows both the mysql and mysqlnd modules are active. This suggests the install was successful and you just need to uncomment the line to load mysqli.so. Make sure you're editing the file for the Apache instance (/etc/php5/apache2/php.ini if I'm remembering correctly) and not the CLI instance. And of course don't forget to restart the service after any changes!
I am trying to get curl to work on my Oracle Linux OS, but I am running into some walls. I am loading my phpinfo() page using an Apache + Django combined server. Furthermore, I have made sure to uncomment the extension=php_curl.dll line in the php.ini file, and I have added the extension=curl.so line. I have also attempted to compile php again using ./configure --with-curl=/usr/include/curl/, followed by the make and sudo make install method calls. However, this recompiling is not reflecting in the phpinfo() page, which still shows a later build date and a different configuration command. As an added note, I am pretty sure I have curl installed. I've run sudo yum install php-curl and sudo yum install curl, and both have responded to me, saying that the php-common and curl packages, respectively, have already been installed.
Does anyone have any advice? Thanks.
I had a similar problem and the solution was to install libcurl & libcurl-devel.
Trying to set up Laravel and keep getting hit with this error. I installed mcrypt through brew and it is located in /usr/local/Cellar. Any thoughts? .. It's not showing up in terminal command php -m either, if that matters. I'm running Mountaion Lion with macs native web server.
Ubuntu or any Debian based Linux users can install the required package with apt-get:
sudo apt-get install php5-mcrypt
Remember to restart the web server afterwards:
sudo service apache2 restart
If it still doesn't work, try to link the configuration file to the appropriate configuration folder for the web server. Thanks to dave1010 for this hint in the comments.
sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/apache2/conf.d/ # for Apache
sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/cli/conf.d/ # for CLI
And again, restart the web server:
sudo service apache2 restart
Perhaps, if not working yet, you need also the line showed by #RahulPrasad, with php5enmod mcrypt.
You need to enable it in your php.ini file as well and probably restart Apache.
In php.ini you will find ;mcrypt.so and remove the ; from it.
Or, if it's not in there, just add mcrypt.so somewhere.
Also the salt option has been deprecated as of PHP 7.0.0. It is now preferred to simply use the salt that is generated by default.
Try sudo php5enmod mcrypt && sudo service apache2 restart
You've installed mcrypt when you actually wanted the php56-mcrypt php module.
You stated in your question that you can see mcrypt installed in /usr/local/Cellar and that you're using OSX. So, the easiest way to install the mcrypt PHP module on OSX using Homebrew is:
// assuming you have php56
brew install php56-mcrypt
If homebrew can't find the correct package you may need to tap the PHP repositories found on GitHub:
brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
Now when you issue the command brew search mcrypt, you should see something like:
libtomcrypt mcrypt php53-mcrypt php54-mcrypt php55-mcrypt php56-mcrypt
Several other posters have mentioned the need to edit your php.ini file. This will be unnecessary as homebrew will take care of activating the module for you. It places the configuration file at /usr/local/etc/php/5.6/conf.d/ext-mcrypt.ini
You don't have the mcrypt PHP extension installed.
For a Mac, I followed these instructions:
mcrypt on Mac 10.7 or 10.8.
They look like a lot, but it's not, it's very easy to follow in it works!
You may have installed mycrypt but not have the php_mcrypt module installed / enabled.
Just a note for people who have recently upgraded to PHP 7 - The MCRYPT library has been deprecated. If you upgraded to PHP 7 and are now seeing this error, that is why. You should switch to an alternative library, some alternatives are mentioned in this thread.
Go to the CLI folder in your php instalation, and find php.ini in there and enable mcrypt. Terminal sometimes uses another php.ini, which is usually in the CLI folder.
I installed php and mcrypt with Homebrew, but I still experienced this error after doing brew update a few times. I think my setup has just gotten a bit borked over time.
It turns out my php was being configured from /private/etc/php.ini, not /usr/local/etc/php/5.4/php.ini as Homebrew recommends. Mcrypt is not even being included from /usr/local/etc/php/5.4/ext-mcrypt.ini which doesn't make a lot of sense considering php -i produces this for me:
Configuration File (php.ini) Path => /usr/local/etc/php/5.4
Loaded Configuration File => /usr/local/etc/php/5.4/php.ini
Scan this dir for additional .ini files => /usr/local/etc/php/5.4/conf.d
Additional .ini files parsed => /usr/local/etc/php/5.4/conf.d/ext-mcrypt.ini
My solution:
Edit /private/etc/php.ini as a superuser
Add extension="/usr/local/Cellar/php54-mcrypt/5.4.28/mcrypt.so" and save
Restart Apache with sudo apachectl restart
This is what finally worked for me:
brew reinstall --with-homebrew-curl --with-httpd php56
brew reinstall --build-from-source php56-mcrypt
I also had to do sudo chmod 777 /usr/local/etc/php/5.6/conf.d because I got errors when the second brew reinstall tried to add the ext-mcrypt.ini to that directory.
I have a server (Ubuntu 11.10 x64) running PHP 5.3.8 with Apache2 / MySQL. I'm currently working on a project where I'm required to do some specific character encoding, but I found out that none of the multibyte (mb_* functions) are working.
However, when I look in phpinfo(), I see that multibyte support is enabled.
I've tried things like apt-get install php5-mbstring, php-mbstring, php-multibyte, etc. etc. but none seem to work.
Can anyone point me in the right direction for this? Thanks in advance!
edit: Fixed it by recompiling PHP (this was my last resort, which I initially wanted to avoid)
./configure --enable-mbstring
The weird this is, phpinfo() already showed that it was enabled. I don't know why it didn't work before :/
A lot of newer Linux servers do not have PHP Multibyte modules installed by default. A simple solution is often to install php-mbstring.
On Red Hat flavors (CentOS, Fedora, etc.) you can use yum install php-mbstring.
Make sure you restart your Apache server afterwards. Use service httpd restart on RH flavors.
In the case of your installation is php5.6 is similar to solution of neilsimp1:
Running sudo apt-get install php7.0-mbstring and then sudo service php7.0-fpm restart did the trick for me.
sudo apt-get install php5.6-mbstring
and then restart apache service
sudo service apache2 restart.
Sometimes people receiving this kind of error : Fatal error: Call to undefined function mb_convert_encoding() in /public_html/this/this.php at line 188. Normally this kind of errors comes in PHP Sites and PHP framework aswell.
It looks like PHP mbstring not installed on your server.
Solution :
In my case I have just uncomment ;extension=php_mbstring.dll in php.ini file and issue has been resolved.
Don't forget to restart apache server after uncomment ;extension=php_mbstring.dll
Code taken from this blog: http://chandreshrana.blogspot.in/2016/01/call-to-undefined-function.html
Check if MBString is Installed
You can know if it is actually installed or not with the -m (Show compiled in modules) arg...
php -m | grep mbstring
If installed, you will see mbstring as the output from the above, or blank if it is not installed.
Install MBString
If you have the newest PHP (PHP8 right now), you can install with...
apt-get install php-mbstring
yum install php-mbstring
If you have PHP7, and you need an older MBString, then install with...
apt-get install php7.0-mbstring
yum install php7.0-mbstring
Restart the Server
Restart the server after install with this at your command line:
/etc/init.d/apache2 restart
Refer back to step 1 to check that MBString actually installed.