473,789 Members | 2,893 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[function.getima gesize]: failed to open stream & unable to display XML content

6 New Member
Hi,

My application is working fine on server A, which is using PHP 4.4.1. However, after it is copied over to server B, which is using PHP 4.4.6, I got several problems related to pdf and xml.

1) I got this message when i tried to generate a pdf, with image:

getimagesize(http://www.myweb.com/image/photo_2.jpg) [function.getima gesize]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /var/www/vhosts/myweb.com/httpdocs/folder/myphoto.php on line 103

FPDF error: Missing or incorrect image file: http://www.myweb.com/image/photo_2.jpg

The image is actually there (tested with the direct URL) with all the folder and file permission set to 777. Wonder why it can't read the image?


2) I got this message when i tried to display the contents from a xml file:

Not Found
The requested URL /document/xml/profile.xml was not found on this server.

The xml file is actually exists (tested with the direct URL) with all the folder and file permission set to 777. Any idea about what is missing?
Thanks in advance!
May 18 '07 #1
7 21638
Motoma
3,237 Recognized Expert Specialist
I would suggest using relative URLs to start with, and if those work, begin working your way up to full pathnames for these files.

Hi,

My application is working fine on server A, which is using PHP 4.4.1. However, after it is copied over to server B, which is using PHP 4.4.6, I got several problems related to pdf and xml.

1) I got this message when i tried to generate a pdf, with image:

getimagesize(http://www.myweb.com/image/photo_2.jpg) [function.getima gesize]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /var/www/vhosts/myweb.com/httpdocs/folder/myphoto.php on line 103

FPDF error: Missing or incorrect image file: http://www.myweb.com/image/photo_2.jpg

The image is actually there (tested with the direct URL) with all the folder and file permission set to 777. Wonder why it can't read the image?


2) I got this message when i tried to display the contents from a xml file:

Not Found
The requested URL /document/xml/profile.xml was not found on this server.

The xml file is actually exists (tested with the direct URL) with all the folder and file permission set to 777. Any idea about what is missing?
Thanks in advance!
May 18 '07 #2
stephcsh
6 New Member
I would suggest using relative URLs to start with, and if those work, begin working your way up to full pathnames for these files.
Thanks, Motoma!
The pdf issue is resolved by using the relative URL.

As I tried to apply same method to my second problem (xml), it doesn't seem to work. It returned me this error: Couldn't resolve host '..'

This is how I tried to read the content of the xml file:
[PHP]
$xmlSource= "../../../../myprofile.xml";
$ch = curl_init();
curl_setopt($ch , CURLOPT_URL,$xm lSource);
[/PHP]

Could you give me any guidance?
Thanks a lot!!
May 21 '07 #3
pbmods
5,821 Recognized Expert Expert
This is how I tried to read the content of the xml file:
[PHP]
$xmlSource= "../../../../myprofile.xml";
$ch = curl_init();
curl_setopt($ch , CURLOPT_URL,$xm lSource);
[/PHP]

Could you give me any guidance?
Thanks a lot!!
Try using file_get_conten ts instead.
May 21 '07 #4
stephcsh
6 New Member
Try using file_get_conten ts instead.
Hi pbmods,

I had just tried with the function you suggested. It couldn't work as well.
I think the main problem I'm having here is that it couldn't find the file to read from, which I tried with either absolute URL or relative URL. What else can I do?
May 21 '07 #5
pbmods
5,821 Recognized Expert Expert
I think the main problem I'm having here is that it couldn't find the file to read from, which I tried with either absolute URL or relative URL. What else can I do?
Alrightey. Here's what I would do:
  • Create a PHP file in the same directory as the XML file you're trying to access.
  • Set the contents of that PHP file to:
    Expand|Select|Wrap|Line Numbers
    1. <?php echo __FILE__; ?>
  • Run the script.
  • Whatever it outputs, copy that and use that as the argument for file_get_conten ts (or what_have_you).
  • Change the path filename to match your XML file.

If that don't work, It's time to accelerate your server...

... at 9.8m/s^2.
May 21 '07 #6
stephcsh
6 New Member
Alrightey. Here's what I would do:
  • Create a PHP file in the same directory as the XML file you're trying to access.
  • Set the contents of that PHP file to:
    Expand|Select|Wrap|Line Numbers
    1. <?php echo __FILE__; ?>
  • Run the script.
  • Whatever it outputs, copy that and use that as the argument for file_get_conten ts (or what_have_you).
  • Change the path filename to match your XML file.

If that don't work, It's time to accelerate your server...

... at 9.8m/s^2.
Wow, it works!
Now, I'm using file_get_conten ts instead of CURL; and document_root instead of URL.
A strange situation it is. The server just doesn't understand the "http://www.mywebsite.c om".
Anyway, thank you very much for your help! Really appreciate it! =)
May 21 '07 #7
pbmods
5,821 Recognized Expert Expert
Really appreciate it! =)
No prob. Keep it comin' :)
May 21 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3697
by: Philip D Heady | last post by:
What is with this error message?????? First part validates, second part fails... getimagesize (filename...) failed to open stream: No such file or directory } elseif ($photo) { $ext = strtolower(substr($photo, -3)); if ($ext == "peg") { $ext = "jpg"; }
9
4965
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my webserver runs that part of the script (see attached file, snippet.php), though, it doesn't go through. I don't get an error message or anything...it just returns a "1" (whereas it should return a "0") as far as I can tell. I have read the PHP...
0
2334
by: Eclectic | last post by:
I am using the latest version of PHP and GD (reinstalled both today - march 29 2005) and am using GD to create thumbnails on the fly. I am having no issues with GD, however, I am now trying to retrieve the width and height of other images withought ANY sucess ... I am recieving the same error repeatedly : "... failed to open stream: No such file or directory ..." I am replacing spaces with '%20' as PHP.net suggests, and have parsed...
4
1817
by: FayeC | last post by:
I have tried to use a php code (found it online) to create a gallery but I am wondering if thereare any other PHP options besides using EXIF. The reason is that the images I am using for the gallery are not taken using a camera and therefore don't have the EXIF data. And since the images will be uploaded by a third party who is not very computer savvy the option of having them edit the images to add the EXIF data is not a very feasible...
0
2350
by: Seok Bee | last post by:
Dear Experts, In my web application, I'm having a button to view an attachment. After I retrieve the record from database (Ms. Access), I have a button to view the attachment (if there is any). The button work fine when I run it at my local machine. However, when I moved all the programs over to the server, I am unable to view the attachment, although I have the file physically at the server. The error message that I got is: ...
6
3539
by: Seok Bee | last post by:
Dear Experts, In my web application, I'm having a button to view an attachment. After I retrieve the record from database (Ms. Access), I have a button to view the attachment (if there is any). The button work fine when I run it at my local machine. However, when I moved all the programs over to the server, I am unable to view the attachment, although I have the file physically at the server. The error message that I got is: ...
7
2653
by: lawrence k | last post by:
I've got a music studio for a client. Their whole studio is run with Macintosh computers. Macintosh computers allow file names to have open white spaces, such as "animal hospital.mp3". I have a download script, so customers on the website can download MP3s to their harddrive (rather than merely listen to it in their browsers):
0
2218
by: RobUK | last post by:
We have Apache on the local network managing several websites that are accessed using virtual domains (configured in the local machine's hosts file, eg. 192.168.1.10 points to dev.somedomain.com). I am reworking the way that I access images on the site by specifying the http://etc address of the image instead of the local relative address. This is so that I can eventually have a separate server serving images to all websites (a lot of images...
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10408
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10199
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10139
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9020
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6768
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5417
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3697
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.