Call to undefined function imageconvolution() - php

I use a php script that generates thumbnails. On my local server everything works but when I commit it the remote server throws 'Call to undefined function imageconvolution()'. I read something about GD library and saw that it is enabled on both servers (local and remote). Any suggestions?

Imageconvolution() was introduced in 5.1.0. Have you checked to see that the version running on the server is at least that version?
Edit: Ahhh, Ubunutu aye? That old chestnut.
Ubuntu doesn't compile with PHPs GD support due to security reasons. It uses generic GD. There is a function here that replicates the functionality, but it isn't anywhere near as fast apparently.
If you have proper access to the server, you can compile proper GD support into it. Instructions: http://www.howtoforge.com/recompiling-php5-with-bundled-support-for-gd-on-ubuntu

Related

PHP Serverless Slim can't execute imagettftext

I intend to use a serverless php function to generate an image with TrueType fonts. In order to do that, I chose bref with Serverless framework and composer.
To process the image and include the text, I'm using imagettftext function from gd library. I ran php -S localhost:8000 index.php for local testing purposes. It worked fine, I got the output image as I expected it.
Thus I ran composer install --optimize-autoloader --no-dev and then serverless deploy to create a AWS Lamda function. However, when I called the deployed function's endpoint, it showed a Slim Application Error - without any detail:
A website error has occurred. Sorry for the temporary inconvenience.
So I took a look at AWS Cloudwatch logs and found this error message:
Message: Call to undefined function imagettftext()
Searching about this error, I found out it's often related to gd library missing. Then I compared phpinfo() from local test to the one from deployed function. Both have gd installed, the difference is that the local one has FreeType Support enabled.
Could you help me to find a way to enable this FreeType Support also for the serverless function? Is it possible to require this support through composer.json?
There's an issue open on GitHub at the moment regarding compiling PHP with freetype support, which explains the result you're seeing: https://github.com/brefphp/bref/issues/497.
GD needs to know about freetype as it's compiled into PHP, so I doubt you would be able to include it with composer

How to configure imagick / ImageMagick on ipage?

Ipage says they are running ImageMagick 6.3.3 however, it is not running on the server and there is no way I can find how to enable it. They do not allow to configure any module from control panel.
I contacted support but they could not help saying, it is not 'their' product. Anybody can help setting up Imagick on ipage? I tried to edit php.ini file and reference to php_imagick.dll but that did not solve the problem.
iPage does not support Imagick in PHP
This is their official response after conctacting support
We have ImageMagick binaries. But it is not complied to PHP so IMAGICK
won't work. So, you will not be able to use IMAGICK as PHP built-in
class. You have to use the alternative "convert" utility. Please make
changes accordingly in the script so that it will work fine on our
servers.
So basically you have to use exec() in PHP to use the Imagemagick convert command. Also you cannot use convert command from a shell environment as for as I know.
But there is GD commands available on ipage and for the most part they would be enough for all graphic related functions. In fact in my case, I found that they were rather moreful.
The answer I got from iPage is that PHP Imagick is not available on the Essential Package. To get PHP Imagick I would need to sign up for VPS hosting which is more expensive. For now I am giong to ignore the recommendation from Wordpress to install PHP Imagick. I have installed the Wordpress "ImageMagick Engine" plugin and it is now working with no errors.

PHP Fatal Error: Call to undefined function password_verify()

I have PHP 5.5.6 on my XAMPP and I didn't encounter the error. But after uploading my website to our testing environment the following error occurred:
PHP Fatal Error: Call to undefined function password_verify()
Our testing envt/server has PHP 5.5.9 (I checked it using command php -v)
I also checked the PHP manual and it says nothing to configure and nothing to install when using this functions. Any ideas what might be causing this issue?
password_verify() is built in since PHP 5.5.0 and it's most likely that your server doesn't run the latest PHP version. Be sure to double check the PHP version on your server either via phpinfo() or phpversion().
Please note that your CLI and mod_php (or php-fpm) versions might differ, executing php -v might give you a wrong version number. Create a PHP file and open it with your browser to be absolutely sure.
The reason for the differing versions of the CLI, mod_php and php-fpm are related to the packages which are offered by the operating system and what the actual administrator installed on the system. Personally I prefer to compile PHP on my own and be sure to get best performance but also the same version across the complete system.
Replacement for PHP versions lower than 5.5
https://github.com/superandrew/phpPasswordHashingLib

Old php site not working on new IIS server, need to use GD library but can't figure it out

I have been developing our php based site on a development box that was set up when i started my new job a few months ago. I have just got a new dev box and am having some real trouble getting my IIS server to work with the site.
I am running windows 7 64bit and IIS7.
I get this error when trying to load the site:
Fatal error: Call to undefined function imagecreatefromgif() in filepath:// line:#
I have done some searching around and found that this particular function is part of the GD library and that i needed to enable it in the php.ini file. most sites were saying that i needed to uncomment this line extension=php_gd2.dll but it wasn't there, so i added it. I took the php_gd2.dll file from the old test box and put it in the folder specified as so
extension_dir ="C:\Program Files (x86)\PHP\v5.2\ext"
I should point out that I am using php5.2 by necessity, we use a library called ezpdf to create pdfs and it contains hundreds of references to magic_quotes_runtime the old dev box was actually running php5.0 but i couldnt find anything earlier than 5.2, and as far as i can tell the magic quotes things should be an issue before php5.3.
Anyway, using the php manager in IIS7, i can see that php_gd2.dll is enabled, however if i look at phpinfo() i can see no reference to GD.
No matter what i try i get the same error, does anyone have any ideas!?
GD isn't JUST the .dll you load into php. there's a fair chunk of other code in other libraries that the php .dll references. You'll need the entire GD setup for it to work in IIS, not just the one php_gd.dll.
References to magic_quotes_runtime by themselves aren't 'bad' - a lot of libraries have to handle running under older PHP versions where magic_quotes is enabled by default, and do appropriate compensation for that fact. If ezpdf is, however, recreated magic_quotes behavior, then it's definitely time to upgrade versions or switching to something better. magic_quotes is deprecated for a reason, and re-enabling it in any way/shape/form is a bad idea.

PHP function unavailable - may be missed APACHE compile config

I have just switched from a shared hosting environment to a dedicated service and whilst testing my code I am finding that some PHP functions aren't available:
Fatal error: Call to undefined function mb_strtoupper()
I have full access to WHM and I can recompile PHP with a bunch of options. Being new to this, I felt it be better to leave the options I'm not familiar with as their default setting.
PHPINFO() states I am running version 5.2.9 and APACHE 2.2.
Have I missed an option in configuring APACHE - is there something I need to switch on to gain full access to PHP functions?
this is a question better asked on serverfault.com
however, regarding your version you moust likely just have to activate mb extensions
also make sure your php is compiled with --enable-mbstring

Categories