CentOS Icon CentOS Logo
CentOS Text
   
  
www.centos.org Forum Index
   CentOS 6 - General Support
  Problem to open Microsoft Offce file (.xls, .doc) when download through php script

 

 Bottom   Previous Topic   Next Topic
  •  Rate Thread
      Rate this Thread
      Excellent
      Good
      Average
      Bad
      Terrible
Poster Thread
  •  myecho
      myecho
Problem to open Microsoft Offce file (.xls, .doc) when download through php script
#1
Newbie
Joined: 2012/5/16
From
Posts: 5
Dear All,

I've develop web server that running on Centos 6.2, PHP Version 5.3.13, Apache/2.2.15 and mysql 5.1.59, CMS: Joomla 1.5 and using component Jdownloads for upload & download file.

I face some problem to open Microsoft Offce file (.xls, .doc) when download through php script. error message appear (The file are you trying to open, ' file.xls', is in different format than specified by the file extension. Verify that the file is not corrupted.......)

The size is same with original file size.I try download direct to the server via ftp, file is ok, no corrupted, error appear when i download through php script.
But when i download and open .pdf or .zip file is ok. no error message.

i also try to install same joomla component in other hosting, it working fine, no error message when i download same Microsoft file. Seem like my develop server is not correctly encode Microsoft office file when i download through php script.

My /etc/php.ini --> php.ini
My /etc/httpd/conf/httpd.conf --> httpd.conf


Any suggestion? Thanks
Posted on: 2012/5/16 13:37
Create PDF from Post Print
Top
  •  myecho
      myecho
Re: Problem to open Microsoft Offce file (.xls, .doc) when download through php script
#2
Newbie
Joined: 2012/5/16
From
Posts: 5
Here my PHP info --> info.php
Posted on: 2012/5/16 16:08
Create PDF from Post Print
Top
  •  pschaff
      pschaff
Re: Problem to open Microsoft Offce file (.xls, .doc) when download through php script
#3
Moderator
Joined: 2006/12/13
From Tidewater, Virginia, North America
Posts: 18773
Welcome to the CentOS fora. Please see the recommended reading for new users linked in my signature.

Quote:

myecho wrote:
...
I've develop web server that running on Centos 6.2, PHP Version 5.3.13, Apache/2.2.15 and mysql 5.1.59, CMS...

Current CentOS versions are:
# rpm -q php httpd mysql
php-5.3.3-3.el6_2.8.x86_64
httpd-2.2.15-15.el6.centos.1.x86_64
mysql-5.1.61-1.el6_2.1.x86_64

Apparently you are using something other than standard CentOS packages, at least for php and mysql.
_________________
Phil

Recommended reading: FAQ & Readme first ; Search hint: google "your topic site:centos.org"; Smart Questions
Posted on: 2012/5/16 17:21
Create PDF from Post Print
Top
  •  myecho
      myecho
Re: Problem to open Microsoft Offce file (.xls, .doc) when download through php script
#4
Newbie
Joined: 2012/5/16
From
Posts: 5
Thanks pschaff for your feedback. that mean i need to downgrade my php and mysql version from php-5.3.13-5 to php-5.3.3-3 and from mysql-5.5.24-6 to mysql-5.1.61-1 right?

[root@nimsportal ~]# rpm -q php httpd mysql
php-5.3.13-5.el6.art.i686
httpd-2.2.15-15.el6.centos.1.i686
mysql-5.5.24-6.el6.art.i686


[root@nimsportal ~]# uname -a
Linux nimsportal.com 2.6.32-220.13.1.el6.i686 #1 SMP Tue Apr 17 22:09:08 BST 2012 i686 i686 i386 GNU/Linux



Really appreciate your advice? thanks
Posted on: 2012/5/17 0:52
Create PDF from Post Print
Top
  •  pschaff
      pschaff
Re: Problem to open Microsoft Offce file (.xls, .doc) when download through php script
#5
Moderator
Joined: 2006/12/13
From Tidewater, Virginia, North America
Posts: 18773
One is an upgrade and one a downgrade. It appears you are using the aggressive and intrusive Atomic repo, so I would be reluctant to advise, and I really can't say if it would help with your issue with extensions in any case. Was just pointing out that you are outside known CentOS territory.

If more help is needed then please provide more information about your system by running "./getinfo.sh package" and showing us the output file, and perhaps explain why you found it necessary to use Atomic packages in place of core packages in the first place.
_________________
Phil

Recommended reading: FAQ & Readme first ; Search hint: google "your topic site:centos.org"; Smart Questions
Posted on: 2012/5/17 11:04
Create PDF from Post Print
Top
  •  myecho
      myecho
Re: Problem to open Microsoft Offce file (.xls, .doc) when download through php script
#6
Newbie
Joined: 2012/5/16
From
Posts: 5
Thanks for your reply, After fail to downgrade my php version, i decide to format my server to Centos 5.8, I install php, mysql, phpmyadmin in my server. Below are detail of my php version

[root@nimsportal ~]# rpm -q php httpd mysql
php-5.2.17-1.el5.art
httpd-2.2.22-jason.1
mysql-5.5.24-6.el5.art


but unfortunately I still face some problem to open Microsoft Offce file (.xls, .doc) when download through php script. The file still corrupt. I try open the file using notepad, I found some blank space at the top of the file, i remove the blank space at the top and save to .xls. then document is ok, not corrupted, i try download .txt file, still some extra blank space at the top of file.

I also try to install this component ( upload & download file component) to other hosting, is ok, no extra space in the top file when i download, and the file exactly same with original file (not corrupted)

Seem like whatever i download my server add blank space at the top file, any suggestion? Thanks.
Posted on: 2012/5/19 4:00
Create PDF from Post Print
Top
  •  pschaff
      pschaff
Re: Problem to open Microsoft Offce file (.xls, .doc) when download through php script
#7
Moderator
Joined: 2006/12/13
From Tidewater, Virginia, North America
Posts: 18773
You now have a mix of packages from Jason Litka and Atomic. Either you did not install real CentOS-5.8 or you added 3rd party repos that replace core packages afterward. What media did you use to reinstall the server?

I still have no idea about whether or not your Microsoft files would work correctly without the foreign packages.
_________________
Phil

Recommended reading: FAQ & Readme first ; Search hint: google "your topic site:centos.org"; Smart Questions
Posted on: 2012/5/19 16:20
Create PDF from Post Print
Top
  •  myecho
      myecho
Re: Problem to open Microsoft Offce file (.xls, .doc) when download through php script
#8
Newbie
Joined: 2012/5/16
From
Posts: 5
Ic, I download from centos website (http://www.centos.org/modules/tinycontent/index.php?id=32) ,then burn the .iso image to DVD, after i install centos 5.8 in my server, my php version is 5.1, then i try to yum update php, but the result is:
No Packages marked for Update
So i decide to add 3rd party repos, so that i can update my php version, may in know what the trusted/stable repos? so that i can update my php version correctly. Thanks
Posted on: 2012/5/19 17:08
Create PDF from Post Print
Top
  •  pschaff
      pschaff
Re: Problem to open Microsoft Offce file (.xls, .doc) when download through php script
#9
Moderator
Joined: 2006/12/13
From Tidewater, Virginia, North America
Posts: 18773
Having no idea why you need to update from the distro packages it is difficult for anyone to advise, but whatever you do, you need to use a consistent set of packages from as few 3rd party repos as possible, and not mix incompatible repos. Atomic is particularly problematic to me because they replace lots of core packages, set themselves up as priority=1, and silently overwrite any user changes to the repo configs if their release package is updated. All around much too aggressive and presumptuous for my taste.

Please read about Installing Software and Repositories, and note the warnings and advice about installing and configuring the yum priorities plugin. Non-core repos should have a higher numeric value, which is a lower priority. Lower is "better" as in golf scores.

If you can describe your requirements, and explain why the core packages do not meet them, then perhaps someone can advise on what repo[s] might best suit your needs. I will say that many people who need updates to core packages find IUS or Remi to be good sources.
_________________
Phil

Recommended reading: FAQ & Readme first ; Search hint: google "your topic site:centos.org"; Smart Questions
Posted on: 2012/5/19 17:24
Create PDF from Post Print
Top
 Top   Previous Topic   Next Topic

 


 You cannot start a new topic.
 You can view topic.
 You cannot reply to posts.
 You cannot edit your posts.
 You cannot delete your posts.
 You cannot add new polls.
 You cannot vote in polls.
 You cannot attach files to posts.
 You cannot post without approval.




"Linux" is a registered trademark of Linus Torvalds. | All other trademarks are property of their respective owners. | All other content is Copyright @ 2004-2009 by the CentOS Project or "each individual contributor (forums, comments, etc.) unless otherwise assigned".| Theme based on a theme by 7dana.com