troubleshooting Question

Problem reading .csv file from zip archive using PHP

Avatar of Kim Walker
Kim WalkerFlag for United States of America asked on
17 Comments1 Solution2217 ViewsLast Modified:
I'm having a problem reading the contents of a .csv file from a zip archive in PHP. The zip archive contains several .csv files and is approximately 5K in size. My script works when looping through echoing the file names, but as soon as I add the line to read the contents of a file, the page hangs up and eventually results in a "Network Error (tcp_error)" "Operation timed out."

Here is my code, it's pretty basic and practically copied from the documentation.
if (is_file($rpt) ) {
	if ($zip = zip_open($rpt) ) {
		while ($zip_entry = zip_read($zip) ) {
			if (zip_entry_name($zip_entry) == 'config.csv') {
				if (zip_entry_open($zip,$zip_entry) ) {
					if ($buff =  zip_entry_read($zip_entry) ) {
						echo $buff;
			} else {
				echo zip_entry_name($zip_entry)."\n";
Here are the contents of the zip file I'm trying to read:
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 17 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 17 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros