473,803 Members | 3,518 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 21639
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
4967
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
2338
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
2351
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
3540
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
2654
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
9699
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9562
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
10309
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
10289
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
10068
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6840
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
5625
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4274
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2968
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.