![]() |
PHP script does not work properly
Using Ubuntu 10.04.4 LTS. We run a php script that pulls info using XML from another server. We are not very familiar with XML. For example when we run:
php5 xmlrequest.php We are supposed to get data from the other server and we see the output right on the terminal. We column names without the data. I have run: sudo dpkg-reconfigure php5 And it worked. Not sure why. For the past week we have been trying the same solution, but it does not work anymore. We migrated from a shared server running CentOS to a VPS running Ubuntu. This is when issues started. Any suggestions? Help is very appreciated. Let me know if i am missing information. Thanks. |
Have you checked to amke sure all your paths are correct? Not only to the data on the other server but to php etc?
|
i'm going to do that in a moment and will paste the output here.
|
Nyteowl, i did:
>whereis php5 php5: /usr/bin/php5 /etc/php5 /usr/lib/php5 /usr/lib64/php5 /usr/include/php5 /usr/share/php5 /usr/share/man/man1/php5.1.gz also: >whereis php php: /usr/bin/php /usr/share/php /usr/share/man/man1/php.1.gz i'm confused to which version i should have. or are these the same? i tried running the php script using: /usr/bin/php5 xmlrequest.php NO luck. php5 -v PHP 5.4.4-1~lucid+1 (cli) (built: Jun 17 2012 12:46:02) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies with XCache v2.0.0, Copyright (c) 2005-2012, by mOo any suggestions? thanks. |
Quote:
|
There are NO error messages.
I believe I found the issue, will post the result in a moment. Thanks for helping! |
In this new Ubuntu server I get the output:
Quote:
|
The first part is the output of a print_r statement in php. That might be debugging info that the programmer has put in.
The second part is HTML code and makes me think that you're supposed to access the page using a web browser. Your output seems to be incomplete; any chance that you can redirect the output to a file and post it here (either as attachment or between [code] and [/code] (instead of between [quote] and [/quote]). You might have missed error messages that scrolled over the screen. From the fact that you get output I conclude that php is working and that this is not a php issue directly; maybe compatibility between different versions of php. Without knowing what your xmlrequest.php is exactly doing, it's difficult to say what is going on. I guess it's time to call the programmer(s) in who wrote the application. Or start posting the code of xmlrequest.php here before anything meaningful can be said. |
Yes, I forgot to post the code. I will post it shortly. Thanks again Wim Sturdenboom!
|
1 Attachment(s)
Here is the code. I have remove credentials for security reason. Thanks for your help!
|
OK, that code probably a little over my head.
I indicated earlier that your text dump was not complete. I like to see what echo $res; displays on your screen and I expect echo "<br>total ".$products->length; to tell you that the total is zero. |
1 Attachment(s)
Thanks!
Attached is the text dump of the complete output. I appreciate your help. |
Trying to help is a pleasure. Unfortunately I can't really help further because I don't know anything about curl.
I suspect the problem to be in the curl part (curl_init() up to curl_close()) because $res seems to be empty. Why this happens, I don't know. Connectivity is the prime suspect for me, but I might be totally wrong. Can you access the url using a web browser, can you ping the server? |
1. Yes, I can access the URL using the web browser
2. Yes, I can ping the server. Thanks for helping! |
Unfortunately I can't help further. Hope somebody else can.
|
| All times are GMT -5. The time now is 05:40 PM. |