How to Enable File Upload With Xampp
Acquire how to configure the Imagick extension in XAMPP for Windows.
Imagick is a native PHP extension to create and modify images using the ImageMagick API. The name causes some confusion as people think that ImageMagick and Imagick are the same matter, however they aren't. Y'all can employ ImageMagick without Imagick but you lot need both Imagick and ImageMagick installed to run it inside your PHP code.
You can check with PHP code wheter the Imagick extension is installed or non using:
<?php if (!extension_loaded('imagick')){ repeat 'imagick not installed'; }
Or just errors in your code that implements Imagick will tell you ... :
Attempted to load form "Imagick" from the global namespace. Did you lot forget a "utilise" statement?
Class 'Imagick' not found
In XAMPP for Windows, Imagick isn't built-in, therefore is up to you lot its installation and implementation. If you have already searched previously how to install Imagick in XAMPP to arrive work, and yous merely can't do information technology, you're probably out of premises and y'all desire to kill yourself.
Fortunately, in this commodity you'll find the definitive installation of Imagick for XAMPP in Windows.
Pre-installation notes
We demand to mention that the installation of Imagick is non like shooting fish in a barrel (can be a picayune disruptive) and you may get errors during the installation if you don't follow carefully every step by pace. As well, you need to know the following information well-nigh your PHP distribution:
Notation: according to the version of XAMPP that you use, these values can vary.
Name | Default value |
Architecture | x86 (XAMPP Default) |
Thread Safe | Enabled TS: Stands for Thread Safe Enabled NTS: Stands for Thread Condom Disabled |
Compiler | MSVC11 (Visual C++ 2012) Some Imagick version are compiled with a different versions eastward.g VC9, VC11 (in this instance), VC14 |
You can get those values with the phpinfo()
office of PHP executing this function within an empty script:
<?php phpinfo();
In one case you lot know the values, these will instruct with files with which architecture y'all need to download from all the following steps.
Annotation: don't forget neither to execute every setup with administrator rights.
one. Download and install ImageMagick for Windows
Navigate in your browser to the Downloads expanse of the website of Imagick and scroll to the Windows zone. ImageMagick runs in nearly every version for Windows (from Windows server 2009, XP to Windows 10), now from this listing is of import to download the latest available version withX86
architecture and DLL version considering that'due south the compages that XAMPP uses (normally, if not refer to the PHPINFO and download the correct version, e.g ImageMagick-<version>-Q16-x86-dll.exe
):
Download the executable and wait. Till the moment, we don't need to configure anything for PHP, just proceed with the installation of Imagick for Windows and don't forget to check the choice to add together Imagick to the PATH:
Once the setup finishes, yous tin test Imagick in a new control prompt executing (that should print the version in the console):
magick -version
2. Download Imagick for PHP
Now navigate to the Imagick package in the PECL website hither and select the DLL version from the latest available version (in case you've downloaded an older version of ImageMagick and so download a version that accepts your version):
And so a new window will load, in this page scroll to DLL Listing and click on the right version for your PHP version with right compages (of XAMPP not your operative organization) and the Thread Rubber in example that it'southward enabled in your distribution (Refer to phpinfo to know wheter your php distribution uses Thread Safe or not):
This volition start the download of a zip file "php_imagick-<version>-<thread-safe-or-not>-<php-compiled-version>-<architecture>.zip
". From this .zip
you volition need to excerpt only the php_imagick.dll
file. Re-create php_imagick.dll
file and paste in the php/ext
folder inside your xampp installation path (tipically C:\xampp\php\ext
):
Then, proceed to enable the extension in your php.ini
file by adding the following line:
;;;;;;;;;;;;;;;;;;;;;; ; Dynamic Extensions ; ;;;;;;;;;;;;;;;;;;;;;; ; Add the following line where the other extensions are loaded extension=php_imagick.dll
At present the extension is loaded, but Imagick notwithstanding won't work every bit it won't even exist recognized equally an extension if you bank check the phpinfo file considering we need to load all the methods and the binaries that you tin can remember from the next stride.
3. Download required Imagick binaries
At this indicate you may exist asking to yourself, really dude ? 3 different downloads? The problem with Imagick is that there are a lot of builds from dissimilar sources and if you don't download and install the right ones, it wont work or it will be loaded simply if you check the Imagick extension (later on, not yet) in phpinfo you'll see :
ImageMagick number of supported formats: 0
That's why yous need to follow the steps as mentioned, otherwise you won't make Imagick to work. To forbid any implementation error, the binaries needs to come from the same source, in this example windows.php.net
. To download the required binaries, navigate to PECL Deps hither and search in the list for Imagick:
Download the version that matches with the architecture of xampp and check the compiler version. In this instance, nosotros download the third option with a filesize of about 30MB (ImageMagick-vi.9.3-vii-vc11-x86.naught
). At present, extract all the files of this zip in a folder wherever you want, in this case nosotros are going to excerpt the content of the zip in a folder in the desktop.
Once the content of the file is extracted, open up the bin
folder and copy all the .dll files (except ImageMagickObject.dll
) that would be about 146 files (with prefixes CORE_*
and IM_MOD_*
) and so paste the copied files into the apache/bin
folder of xampp (tipically C:\xampp\apache\bin
).
Now start the apache service (or restart it in case it'southward already running) and go to phpinfo
again. Now yous should run across imagick loaded as an extension:
And yous tin finally after hours of suffering, use Imagick with PHP for XAMPP in Windows.
In example of console error
If after the implementation you lot yet getting the following message mistake everytime you apply PHP (at to the lowest degree in the console):
PHP Alert: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_imagick.dll' - The specified module could not be found.
You volition need to add the bin
directory of Apache (C:\xampp\apache\bin
) to the PATH surroundings variable of Windows and the trouble will be solved.
Happy coding !
Source: https://ourcodeworld.com/articles/read/349/how-to-install-and-enable-the-imagick-extension-in-xampp-for-windows
0 Response to "How to Enable File Upload With Xampp"
Postar um comentário