How to read a nonlocal excel with PHPExcel - php

I have the following problem, the project is that a run will be placing data in excel and these data must be on a page monitoring , the tool I'm using is the PHPExcel library works without problem, the problem is the user will have the excel on your machine and the page will be on the server so you should be able to connect to the user's computer but by placing the address the library has problems, I do not know if any other function to help me redirect , now I exercise locally and does not work.
Don't problem:
$objPHPExcel = $objReader->load("D.xlsx");
With Problem:
$objPHPExcel = $objReader->load("localhost:8081/excel/ticket/D.xlsx");
Or
$objPHPExcel = $objReader->load("10.204.8.14:8081/excel/ticket/D.xlsx");
Message:
Uncaught exception 'PHPExcel_Reader_Exception' with message 'Could not open localhost:8081/excel/ticket/D.xlsx for reading! File does not exist.' in C:\xampp\htdocs\excel\ticket\Classes\PHPExcel\Reader\Excel2007.php:347 Stack trace: #0 C:\xampp\htdocs\excel\ticket\prueba.php(15): PHPExcel_Reader_Excel2007->load('localhost:8081/...') #1 {main} thrown in C:\xampp\htdocs\libreria_excel\ticket\Classes\PHPExcel\Reader\Excel2007.php on line 347
The URL is OK.
Thank you very much and greetings!

Related

How to fix PHP Excel export error in application system

Normaly in my application system i am able to export content via PHP Exel. Now i can export the .xlsx file but if i would like to open it ill get the message : Can not open file because format or filename extension is invalid.
Error Code :
Fatal error: Uncaught exception 'Exception' with message 'Could not close zip file php://output.' in
/net/myvm0364/disc1/www/pc2/application/include/847dfknsa_2434_phpExcel/PHPExcel/Writer/Excel2007.php:346
Stack trace: #0
/net/vmits0364/disc1/www/pc2/application/include/exportMember.php(188):
PHPExcel_Writer_Excel2007->save('php://output') #1 {main} thrown in
/net/myvm0364/disc1/www/pc2/application/include/847dfknsa_2434_phpExcel/PHPExcel/Writer/Excel2007.php
on line 346
Did somebody know what i have to do ?
I have seen a similar case before on my server (then I used CSV because do not solve problem). The reason is that the excel file is too large (about 40000 or 50000 records, or file size larger than 15MB), making your server can't handle, so excel file will be broken.
Example:
The file content if successfully created is 20MB, but when the file creates 15MB, your server is overload, it will stop the process here. You can still create an excel file but can't open it.
You can try creating an excel file with a capacity of about 1MB or less than, if it work the problem may not be due to your code.
Hope can help you.
So sorry because bad english.

PHP connect to MS Access database - Provider not found

I know there are tons of questions about this on SO. But I've been trying to fix this since a month with no luck.
At work we have this very old website that uses an access database, and I cannot do anything about it.I want to work on some changes on my local PC using wamp server. So I donwloaded the website along with the db. Here is how it's supposed to connect :
$conn = new COM('ADODB.Connection');
$db = realpath("dbalerts.mdb");
$conn->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=$db");
But it's giving me this error:
Fatal error: Uncaught exception 'com_exception' with message 'Source: ADODB.Connection
Description:Provider cannot be found. It may not be properly installed.'
in C:\wamp\www\testaccess\index.php:5 Stack trace: #0 C:\wamp\www\testaccess\index.php(5): com->Open('Provider=Micros...') #1 {main} thrown in C:\wamp\www\testaccess\index.php on line 5
It's a test folder whith an index.php where only that code is written. In the same folder is dbalerts.mdb
I tried everything I know. I downloaded AccessDatabaseEngine.exe from MS website which is supposed to have the driver. And it installed properly with no errors( had to uninstall office because it was 64bit)
I am on a win8 machine
Any ideas how I can fix this all while still using COM and ADODB? Because I can't go through changing the connections of every .php file in that website (it's old and poorly designed so not adaptable to changes)

cpanel php class not creating object

We used "cPanel API2" library to create park domain in our server and it was working fine until last cPanel up-gradation.
We created file mytest.live.php on server to create a object of "CPANEL class" for troubleshooting the issue, but unfortunately it returns error as below.
<?php
require_once "/usr/local/cpanel/php/cpanel.php";
$cpanel = new CPANEL(); ?>
And Output Returns:
Fatal error: Uncaught exception 'RuntimeException' with message 'There was a problem fetching the env variablecontaining the path to the socket' in /usr/local/cpanel/php/cpanel.php:146 Stack trace: #0 /home/cityusa/public_html/mytest.live.php(4): CPANEL->__construct() #1 {main} thrown in /usr/local/cpanel/php/cpanel.php on line 146
So please help for resolve this issue.
You should try naming your file as ".live.php" or ".livephp". That worked for me.

Imagick PHP Exception 1630 on Chrome: Read exception

I have trouble resolving an issue with Imagick (php version of imagemagick) while generating a new image.
I retrieve my image via a $_POST
I convert the string with base64
I stock in on the server
I generate a new Imagick() with the newly created image
Weirdly, the script works perfectly fine on Firefox + IE (a new image is generated) but it generates a fatalerror on Googgle Chrome (desktop + mobile):
Fatal error: Uncaught exception 'ImagickException' with message 'Read
Exception `MYSERVERPATH/10562112e9c44d0.png' #
error/png.c/MagickPNGErrorHandler/1630' in MYSERVERPATH/result.php:41
Stack trace: #0
MYSERVERPATH/result.php(41):
Imagick->__construct('/httpdjail/var/...') #1 {main} thrown in
MYSERVERPATH/result.php on line 41
My line 41 is:
$image = new Imagick(MY SERVER PATH. $file);
I'm quite new at coding PHP, then any help would be very appreciated :).
Thanks a lot for your help!
I retrieve my image via a $_POST
This feels very bad,
Your error seems to hint at MYSERVERPATH is not getting converted to the string that you should have in there hence imagemagik doesn't know where it is hence errors out.

PhpThumb error - PHP Fatal error: Class 'PhpThumb' not found

I had downloaded from official website, uploaded to my hosting server. I got this error message.
[08-Mar-2012 21:26:07] PHP Fatal error: Class 'PhpThumb' not found in /home/sokad
/public_html/libs/phpthumb/thumb_plugins/gd_reflection.inc.php on line 179
Fatal error: Uncaught exception 'RuntimeException' with message 'Cannot show image, headers
have already been sent' in /home/sokad/public_html/libs/phpthumb/GdThumb.inc.php:569 Stack
trace: #0 /home/sokad/public_html/resize.php(14): GdThumb->show() #1 {main} thrown in
/home/sokad/public_html/libs/phpthumb/GdThumb.inc.php on line 569
require_once 'libs/phpthumb/ThumbLib.inc.php';
$thumb = PhpThumbFactory::create($url);
$thumb->adaptiveResize($width, $height);
$thumb->show();
I found that a lot of website also got same problem. Any idea how to solve it?
scan your "phpthumb" directory for all "error_log" files or "_notes" directories, and delete them. In my case I had an error_log file at the thumb_plugins, as soon as I deleted it, it worked on the remote side.
I came to this conclusion because there was no reason why it whould work differently locally and remotely, the only difference? these files.
Good Luck

Categories