Apache-LAMP uses the php zip library, but cannot find =. =

Source: Internet
Author: User
Tags zip extension
I am a very watery web programmer, and I have never written any project. I can't find the answer for a long time. The environment is as follows: Archlinux3.16.3Apache2.4.10PHP5.6.0 needs to be selected on the page to select other places... I am a very watery web program, and I have never written any project. I can't find the answer for a long time.

The environment is as follows:

  • Archlinux 3.16.3
  • Apache 2.4.10
  • PHP 5.6.0

The requirement is to download the zip file from other places to the server through page selection, and then decompress and output it to the client. I have a question during the compilation process.fwriteFiles written to/tmp/xx.zip are invisible to common users on the server. Simple use

exec('ls /tmp/*.zip', $result);print_r($result);

Can be displayed, andfile_get_contentsAnd other methods to ensure that the file exists.

The problem is that you have enabled the zip extension in php. ini and executed the following code locally:

$zip = zip_open($target);if($zip) {    while($entry = zip_read($zip)) {        echo zip_entry_name($entry) . ': ' .            zip_entry_filesize($entry) . '/' .            zip_entry_compressedsize($entry) . ', by' .            zip_entry_compressionmethod($entry) . "\n";    }    zip_close($zip);}

Note: It is executed locally, that isphp file.phpBut in the Apache directory, access through the browser will not work. Error message:PHP Fatal error: Call to undefined function zip_open()

Reply content:

I am a very watery web programmer, and I have never written any project. I can't find the answer for a long time.

The environment is as follows:

  • Archlinux 3.16.3
  • Apache 2.4.10
  • PHP 5.6.0

The requirement is to download the zip file from other places to the server through page selection, and then decompress and output it to the client. I have a question during the compilation process.fwriteFiles written to/tmp/xx.zip are invisible to common users on the server. Simple use

exec('ls /tmp/*.zip', $result);print_r($result);

Can be displayed, andfile_get_contentsAnd other methods to ensure that the file exists.

The problem is that you have enabled the zip extension in php. ini and executed the following code locally:

$zip = zip_open($target);if($zip) {    while($entry = zip_read($zip)) {        echo zip_entry_name($entry) . ': ' .            zip_entry_filesize($entry) . '/' .            zip_entry_compressedsize($entry) . ', by' .            zip_entry_compressionmethod($entry) . "\n";    }    zip_close($zip);}

Note: It is executed locally, that isphp file.phpBut in the Apache directory, access through the browser will not work. Error message:PHP Fatal error: Call to undefined function zip_open()

There is no problem with local execution. If URL access is used, the function does not exist, indicating that the cli environment and Apache are not using a PHP.

Find the PHP location in the cli environment to see if it is the same as that in mod_php. If it is the same, please:

Restart Apache.

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.