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.fwrite
Files 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_contents
And 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.php
But 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.fwrite
Files 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_contents
And 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.php
But 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.