{"id":3495,"date":"2014-03-11T12:14:50","date_gmt":"2014-03-11T17:14:50","guid":{"rendered":"http:\/\/icesquare.com\/wordpress\/?p=3495"},"modified":"2014-07-06T14:22:13","modified_gmt":"2014-07-06T19:22:13","slug":"xampp-php-fatal-error-class-ziparchive-not-found","status":"publish","type":"post","link":"https:\/\/icesquare.com\/wordpress\/xampp-php-fatal-error-class-ziparchive-not-found\/","title":{"rendered":"XAMPP &#8211; PHP Fatal error:  Class &#8216;ZipArchive&#8217; not found"},"content":{"rendered":"<p>I just finished writing a program written in PHP today. When I moved to the another environment, I found that the script didn&#8217;t work. After some investigations, I found that the program stopped running because of the following error:<\/p>\n<div style=\"margin:80px;\"><\/div>\n<pre>\r\nPHP Fatal error:  Class 'ZipArchive' not found in ...\r\n<\/pre>\n<p>The error is obvious, some PHP extensions were missing. Therefore, I ran the following to see which modules were being loaded by the php:<\/p>\n<pre>\r\n#Make sure that the php is living in \/opt\/lampp\/\r\n#which php\r\n\/opt\/lampp\/bin\/php\r\n\r\n#php -m\r\n[PHP Modules]\r\n...\r\n...\r\nxsl\r\nzlib\r\n<\/pre>\n<p>Okay, the problem is clear, <strong>zip<\/strong> is missing.<\/p>\n<p>For some (stupid) reasons, XAMPP (1.8.1) removes the zip support from the package. I don&#8217;t understand why because it was available in the older version (1.7.3). Removing a popular package will create troubles and backward compatibility issues. Anyway, the XAMPP is a non-professional product. It is not designed for production uses.<\/p>\n<p>Before we go further, please make sure that your PHP is 5.4.7. It is because this tutorial is version specific.<\/p>\n<pre>\r\n#php -v\r\n\r\nPHP 5.4.7\r\n<\/pre>\n<p>Here are the details:<\/p>\n<pre>\r\n#As always, we want to switch to root user first\r\nsudo su\r\n\r\n#Switch to the extension directory\r\ncd \/opt\/lampp\/lib\/php\/extensions\/no-debug-non-zts-20100525\r\n\r\n#Download the missing zip.so\r\n#This zip.so was extracted from a 32-bit Linux environment, and was complied using PHP 5.4.7 32-bit i686\r\n#It will not work with a different PHP version.\r\nwget http:\/\/icesquare.com\/download\/zip.so\r\n\r\n#Modify the permissions\r\nchmod a+x zip.so\r\nchown root:root zip.so\r\n<\/pre>\n<p>Now, we will need to modify the php.ini<\/p>\n<pre>\r\n#nano \/opt\/lampp\/etc\/php.ini\r\n\r\n#Look for the zip.so and remove the comment\r\n\r\n#From\r\n;extension=\"zip.so\"\r\n\r\n#To\r\nextension=\"zip.so\"\r\n<\/pre>\n<p>Next, we will need to verify that the extension is being loaded by php:<\/p>\n<pre>\r\n#php -m\r\n[PHP Modules]\r\n...\r\n...\r\nxsl\r\nzip < ------------ This one\r\nzlib\r\n<\/pre>\n<p>If everything looks good, we will need to restart the apache.<\/p>\n<pre>\r\n#\/opt\/lampp\/lampp reloadapache\r\n<\/pre>\n<p>That&#8217;s it! Now the error is gone. You can also verify it by including phpinfo() in your code. It should display the details about the zip package.<\/p>\n<p>My last word: Stay away from XAMPP when possible. It is using 32-bit stone-age technology, full of security-related bugs (because they release one or two versions ever year), and is packaged in a very non-professional way (such as backward compatibility). Consider to move to native Apache + PHP + MySQL. Believe me, you will see at least 10% of the performance improvement.<\/p>\n<p>&#8211;Derrick<\/p>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I just finished writing a program written in PHP today. When I moved to the another environment, I found that the script didn&#8217;t work. After some investigations, I found that <a class=\"more-link\" href=\"https:\/\/icesquare.com\/wordpress\/xampp-php-fatal-error-class-ziparchive-not-found\/\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":3502,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[94,146,144,6],"tags":[58],"class_list":["post-3495","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-computer-problems-computer-help-pc-support","category-everyday-computer-problem","category-sever-problem","category-technology","tag-xampp"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/p1sqzr-Un","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":3134,"url":"https:\/\/icesquare.com\/wordpress\/php-network-error\/","url_meta":{"origin":3495,"position":0},"title":"PHP Network Error","author":"Derrick","date":"February 21, 2013","format":false,"excerpt":"One of my PHP web applications stopped working today. After I investigated the issues, I noticed that this is a very famous, yet unsolved error. I have no idea why it happens, but I do have a work around solution for it. Basically, this article applies to you if you\u2026","rel":"","context":"In &quot;Computer Problems&quot;","block_context":{"text":"Computer Problems","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/computer-problems-computer-help-pc-support\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":305,"url":"https:\/\/icesquare.com\/wordpress\/installing-xampp-on-fedora-12-64-bit\/","url_meta":{"origin":3495,"position":1},"title":"Installing XAMPP on Fedora 12 64-bit system","author":"Derrick","date":"December 8, 2009","format":false,"excerpt":"I was installing XAMPP on Fedora 11 64-bit today, and I saw this famous message: sudo \/opt\/lampp\/lampp startapache XAMPP is currently only availably as 32 bit application. Please use a 32 bit compatibility library for your system. The message is very clear that XAMPP doesn't like 32-bit system. So, we\u2026","rel":"","context":"In &quot;Computer Problems&quot;","block_context":{"text":"Computer Problems","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/computer-problems-computer-help-pc-support\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2156,"url":"https:\/\/icesquare.com\/wordpress\/cant-connect-to-local-mysql-server-through-socket-varlibmysqlmysql-sock-2\/","url_meta":{"origin":3495,"position":2},"title":"Can&#8217;t connect to local MySQL server through socket &#8216;\/var\/lib\/mysql\/mysql.sock&#8217; (2)","author":"Derrick","date":"December 21, 2011","format":false,"excerpt":"When I tried to connect to the MySQL server through PHP, I got the following error: Can't connect to local MySQL server through socket '\/var\/lib\/mysql\/mysql.sock' (2) To give you some background, here is my situation. My Fedora Linux is a 64-bit machine, and I have installed a 32-bit version of\u2026","rel":"","context":"In &quot;Computer Problems&quot;","block_context":{"text":"Computer Problems","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/computer-problems-computer-help-pc-support\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2788,"url":"https:\/\/icesquare.com\/wordpress\/phpfatal-error-allowed-memory-size-of-x-bytes-exhausted-tried-to-allocate-y-bytes\/","url_meta":{"origin":3495,"position":3},"title":"[PHP]Fatal error: Allowed memory size of x bytes exhausted (tried to allocate y bytes)","author":"Derrick","date":"May 4, 2012","format":false,"excerpt":"[ad#adbrite] A user complained to me that my PHP web applications stopped working today. After I digged into the error log, I found that following message: PHP Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 261900 bytes) in Unknown on line 0 Obviously, this is related\u2026","rel":"","context":"In &quot;Computer Problems&quot;","block_context":{"text":"Computer Problems","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/computer-problems-computer-help-pc-support\/"},"img":{"alt_text":"","src":"\/wordpress\/wp-content\/uploads\/2011\/12\/computer-problem.jpg","width":350,"height":200},"classes":[]},{"id":1063,"url":"https:\/\/icesquare.com\/wordpress\/xampp-error-1-couldnt-start-apache-sorry-ive-no-idea-whats-going-wrong\/","url_meta":{"origin":3495,"position":4},"title":"XAMPP: Error 1! Couldn&#8217;t start Apache! &#8230; Sorry, I&#8217;ve no idea what&#8217;s going wrong.","author":"Derrick","date":"November 14, 2010","format":false,"excerpt":"Today I helped my friend to install XAMPP on a Debian system. When I tried to start the Apache webserver, I got the following message: #\/opt\/lampp\/lampp startapache XAMPP: Starting Apache with SSL (and PHP5)... XAMPP: Error 1! Couldn't start Apache! XAMPP: Starting diagnose... XAMPP: Sorry, I've no idea what's going\u2026","rel":"","context":"In &quot;Computer Problems&quot;","block_context":{"text":"Computer Problems","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/computer-problems-computer-help-pc-support\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":832,"url":"https:\/\/icesquare.com\/wordpress\/think-twice-before-upgrading-your-server-to-php-5-3-3\/","url_meta":{"origin":3495,"position":5},"title":"Think twice before upgrading your server to PHP 5.3.3","author":"Derrick","date":"September 6, 2010","format":false,"excerpt":"I upgraded to PHP 5.3.3 today, and I was shocked! I found a huge security hole default setting change that may leak the source code to public, which never happened in the earlier version. Here is an example. Suppose my code looks like this: <?php echo \"This is a good\u2026","rel":"","context":"In &quot;Computer Problems&quot;","block_context":{"text":"Computer Problems","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/computer-problems-computer-help-pc-support\/"},"img":{"alt_text":"Good Example","src":"\/wordpress\/wp-content\/uploads\/2010\/09\/php_5-3-3_goodExample-300x163.png","width":350,"height":200},"classes":[]}],"jetpack_featured_media_url":"https:\/\/icesquare.com\/wordpress\/wp-content\/uploads\/2014\/03\/xampp-logo.jpg","_links":{"self":[{"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/posts\/3495","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/comments?post=3495"}],"version-history":[{"count":12,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/posts\/3495\/revisions"}],"predecessor-version":[{"id":3641,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/posts\/3495\/revisions\/3641"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/media\/3502"}],"wp:attachment":[{"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/media?parent=3495"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/categories?post=3495"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/tags?post=3495"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}