Class ZipArchive not found (Where to get the pre-built zip library) - php

Check these images first: http://imgur.com/a/TOVbU
Where can I get the zip dll. I tried downloading its source code but it requires php.h.
I don't want to mess around with C right now as I have so much in PHP.
Is there anywhere, obviously a trusted source I can get this library?
Notice in my phpinfo() page it only says zlib. and I have php_zip.dll in my ext folder.

You need to restart your web server after modifying php.ini. Settings changes only then take effect.
The screenshot shows "zlib", which is not the same as "Zip". Also make sure that you're editing the correct php.ini file. CLI and Webserver PHP processes may use different ones. Enable display_startup_errors.

I fixed this by just using a pure php library alternative found here: http://www.phpconcept.net/pclzip/pclzip-downloads
In case anyone ever comes across the same problem. The site has also some nice libraries.

Related

does uncommenting works to install PHP extension

this is not a bug in my program but a general doubt. I've heard and read that in Windows people uncomment extension names in PHP.ini to enable them. Does this works in Ubuntu too?
Actually I've tried it in my Ubuntu and it didn't work, just want to be sure it doesn't works like this in Ubuntu or it was my fault somewhere (which doesn't matters now ).
In my case I didn't even touched the ini file but just recompiled the php from source with passing extension arguments. Why didn't I have to enable them?
Tried searching SO but didn't find any questions related to this.
With Windows, pretty much all the extensions are already compiled as DLLs. So when you uncomment the line in the ini file and restart the service, it simply loads the file.
When you compile from source in Linux, you aren't building all the extensions by default. You usually have to explicitly specify which extensions you want to enable and they are compiled along with PHP. So the extension has to be compiled successfully and be accessible to be used. The ini file is simply the instruction of whether or not to TRY loading that extension when PHP starts.
Also, there are some basic extensions that are part of the typical PHP build / configure / make process. You can consult the docs to figure out which ones are default but a good practice is to explicitly enable those that you want.
Don't build EVERY extension if you don't need them though. The more extensions that get loaded, the more memory that PHP needs/uses when starting up.
the simple answer is yes it works but if only the extension is in your ubuntu.

Symfony config.php keeps asking for enabling intl extension, though it is enabled?

I have come across this question which states exactly my problem, except that I'm using Wamp, not Xampp.
Symfony 2: Install and enable the intl extension
Though I enabled php_intl extension through the Wamp drop down menu, and making sure that the extension was not commented out in my php.ini configuration file, Symfony just keeps recommending me to enable intl extension.
I have visited the link in the accepted question:
http://php.net/manual/en/intl.requirements.php
Still no luck. I have visited the ICU Homepage and even attempted to download it, and then I just don't know what file to download or what link to follow.
I'd like someone who can point me to the right direction. I'm quite new to PHP (only two sites developed with it), and am a total beginner with Symfony. And I also can't understand all those tricks with Pearl, PECL, Composer, etc. I feel completely lost.
Thanks for any help.
Check the comments when you are using the app/check.php script:
* Configuration file used by PHP: /etc/php5/cli/php.ini
** ATTENTION **
* The PHP CLI can use a different php.ini file
* than the one used with your web server.
* To be on the safe side, please also launch the requirements check
* from your web server using the web/config.php script.
Make sure intl is enabled in the right php.ini file.
For getting started with Symfony I strongly recommend the video's from KNP University (knpuniversity.com). I thought they were excellent to get me started with Symfony. For composer enter $ php composer.phar list in the terminal to view all the options that come with composer.
After having searched and searched again and again, I have found that the history information of my browser fooled me.
First, I have copied the icu*.dll files from my %WAMP_INSTALL_DIR%\bin\php\php5.4.12 to my %WAMP_INSTALL_DIR%\bin\apache\Apache2.4.4\bin as mentioned here: intl extension php_intl.dll with wamp, and restarted all of my services.
Then, I had the idea of clearing my history, after having copied the files as above-mentioned, and it worked!
I do hope this will help others.

Where to find php_printer.dll?

I have a class that makes use of the php_printer extension but I can't find it anywhere and at php.net it says it's currently unavailable. I googled it, but all I downloaded from other sites was not efficient. It seemed to me it was outdated. I copied the .dll file in the extensions folder and set the configuration in php.ini but I still couldn't use its built-in functions.I have PHP 5.3.1 installed.
Then you did not google very well. There still are repositories of precompiled binaries elsewhere:
https://github.com/maryo/php-5.5-windows-extensions
http://windows.php.net/downloads/pecl/snaps/printer/0.1.0-dev/
http://downloads.php.net/pierre/
Just saying it does not work is insufficient. I understand that compiling from source is effortful on Windows (pecl install printer given a proper compiler setup), but at the very least run the PHP interpreter on the commandline after editing the php.ini. It would give you a useful error message in case of linking errors, or none in case you edited the wrong config file. (Too few details to answer.)
See also: PHP 5.4.7 Compiling ext php_printer
download and unzip the extenssions file
http://museum.php.net/php5/pecl-5.2.6-nts-Win32.zip
http://downloads.php.net/pierre/ appears to have one that dates to 2010.
I'd consider looking for some other solution though, it doesn't look like a very widely supported extension and it's not been updated for at least a year.

Can the php.ini default file be downloaded by itself for different versions?

Instead of copying php.ini files over from old PHP versions whenever I upgrade PHP, I would like to be able to download the newest php-recommended.ini file from somewhere by itself. I have searched for this option on php.net but I could not find it.
It seems like it should be an easy question, but I have not been able to answer it.
Thanks for any help!Metropolis
You can grab it from GitHub:
https://github.com/php/php-src
It will be in the root of the trunk/tag/branch you're dealing with.

Installing PHP extensions on shared hosting

I need to enable the mcrypt functions on my website, except I'm on a shared host (running linux) and obviously don't have access to the php.ini file. There does seem to be options for installing PEAR modules but a search told me mcrypt wasn't available. Is there any way I can do this, short of begging technical support to help me?
Update: Looking around a bit more, it looks like I might be able to use the dl() function to dynamically load a library at run time. Since I'm only using the mcrypt functions in one spot, I could probably get away with doing this since the performance hit (I assume there is a hit) should be minimal. The only problem now is how to get the libmcrypt.so file?
Another update: I've downloaded the libmcrypt.tar.bz2 file from Sourceforge and run ./configure, make, and then copied the libmcrypt.so.4.4.8 file into my home directory (as libmcrypt.so), but now I can't find where to put it so that the dl() function will find it.
The MCrypt Sourceforge page should have it
http://mcrypt.sourceforge.net/
To compile it just:
wget http://superb-east.dl.sourceforge.net/sourceforge/mcrypt/libmcrypt-2.5.8.tar.gz
tar -xzvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make
sudo make install
EDIT:
Can you reference it with a direct path?
What have you tried?
Edit2: It seems that you can only load moduals from the extensions directory set in the php.ini and you cannot override extensions_dir with ini_set so you will either have to convince your host to install it or if they allow you to have your own php.ini (many do usually in [username]/php.ini) then you could set the extensions_dir in there and load the modual with that.
Really the best way is to tell your ISP to include mcrypt support. Even if you bundle your own PHP extension and load it with dl(), there is no guarantee it is going to work after a PHP upgrade, as PHP is sometimes very version-number picky.
dl() will not help you either, since it only loads libraries from certain paths, and those paths are usually only writable by the system administrators for security reasons.
I very much doubt that there is a way to use binary libraries without the consent of the hoster.
PHP in versions before 5.2.5 allowed you to use a path in the dl() function so that you could easily load libraries in a shared environment.
This changed for 'security' reasons with 5.2.5 and as far as I am aware your only option is to get your system administrator to add the module to the extensions_dir.
This issue is described at bugs.PHP.net

Categories