-   Linux - Server (
-   -   PHP script does not work properly (

cucolin@ 07-30-2012 02:13 PM

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.

NyteOwl 07-30-2012 02:37 PM

Have you checked to amke sure all your paths are correct? Not only to the data on the other server but to php etc?

cucolin@ 07-30-2012 02:42 PM

i'm going to do that in a moment and will paste the output here.

cucolin@ 07-30-2012 04:34 PM

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

>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.

Wim Sturkenboom 07-31-2012 08:03 AM


NO luck.
If you post error messages, someone might be able to help ;)

cucolin@ 07-31-2012 12:28 PM

There are NO error messages.
I believe I found the issue, will post the result in a moment.

Thanks for helping!

cucolin@ 08-01-2012 03:59 PM

In this new Ubuntu server I get the output:

[885631273562] => Array
[sku] => CE538A#BGJ
[qty] => 0
[upstatus] => 0

[884962455142] => Array
[sku] => CE841A#BGJ
[qty] => 0
[upstatus] => 0

[885631717066] => Array
[sku] => XN374A8#ABA
[qty] => 0
[upstatus] => 0

<table border=1><tr><td>Sl.No</td><td>SKU</td><td>UPC#</td><td>Current Stock Status</td><td>Magento Stock</td><td>TechDat
a Stock</td><td>Cost</td><td>Magento Price</td><td>TechData Price</td></tr>
And nothing is updated. On the older(CentOS) server it works. How can I compare server configurations? Any ideas? Thanks again!

Wim Sturkenboom 08-02-2012 12:32 AM

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.

cucolin@ 08-02-2012 07:34 AM

Yes, I forgot to post the code. I will post it shortly. Thanks again Wim Sturdenboom!

cucolin@ 08-02-2012 11:12 AM

1 Attachment(s)
Here is the code. I have remove credentials for security reason. Thanks for your help!

Wim Sturkenboom 08-02-2012 02:02 PM

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.

cucolin@ 08-02-2012 02:07 PM

1 Attachment(s)
Attached is the text dump of the complete output.
I appreciate your help.

Wim Sturkenboom 08-03-2012 12:58 AM

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?

cucolin@ 08-03-2012 09:24 AM

1. Yes, I can access the URL using the web browser
2. Yes, I can ping the server.
Thanks for helping!

Wim Sturkenboom 08-03-2012 01:40 PM

Unfortunately I can't help further. Hope somebody else can.

All times are GMT -5. The time now is 11:16 PM.