(Class ' ziparchive ' not found) Linux Apache add zip module

Source: Internet
Author: User
Tags phpinfo ziparchive

Phpexcel when the site migrated to the Linux platform, the error Class ' ziparchive ' not found

reason: Because PHP does not have a ZIP module installed

Workaround: Install the Zip module

resolution Process:

Get to Zip package
wget Http://pecl.php.net/get/zip

unzip the zip package and enter

TAR-ZXVF ZIPCD zip-1.x.x


This is a command that can be installed by yum install php-devel and then execute phpize if the hint is not available.
Phpize


At this point you need to get to the location of the native Php-config, the method is very simplePHP Installation information can be obtained via the phpinfo () functioncan also Find/-name php-config
you may find several, but according to your own installation situation to find the corresponding directory, after the simple compilation, installation. Note: Configure does not add parameters, you will get a path after executing make insatall, there is a generated zip.so
./configure--with-php-config=/usr/local/php5/bin/php/php-config


Compile(I use root permissions, not root privileges to switch attention)
Make


Installation(I use root permissions, not root privileges to switch attention)
Make instal


Find your php.ini file locationalso available through Find/-name php.ini You can also get the php.ini position by phpinfo ();
make three changes to the Extension_dir directory to your file-generated directory, note that if it has been developed, it is recommended to copy the zip.so to the established directorySet extension=zip.so
Extension_dir =/usr/local/lib/php/extensions/extension=zip.so



set the following parameters, you can find the parameter to see if it is turned on, set the value on after opening
Zlib.output_compression = On


This has been configured to restart Apache by command
Service Apache2 Restart


you can then write the <?php echo phpinfo () in the PHP file; ?> Access the file, view the current configuration information, see if the ZIP module is installed successfully, the whole installation process is so, the most error-prone place is compile (make) so be careful to configure the parameters when executing configure, Now that your PHP Zip module has been installed successfully, test the following Excel export for problems.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.