LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-30-2012, 02:13 PM   #1
cucolin@
Member
 
Registered: Nov 2003
Location: USA
Distribution: Ubuntu, CentOS, RedHat
Posts: 416

Rep: Reputation: 31
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.
 
Old 07-30-2012, 02:37 PM   #2
NyteOwl
Member
 
Registered: Aug 2008
Location: Nova Scotia, Canada
Distribution: Slackware, OpenBSD, others periodically
Posts: 512

Rep: Reputation: 139Reputation: 139
Have you checked to amke sure all your paths are correct? Not only to the data on the other server but to php etc?
 
Old 07-30-2012, 02:42 PM   #3
cucolin@
Member
 
Registered: Nov 2003
Location: USA
Distribution: Ubuntu, CentOS, RedHat
Posts: 416

Original Poster
Rep: Reputation: 31
i'm going to do that in a moment and will paste the output here.
 
Old 07-30-2012, 04:34 PM   #4
cucolin@
Member
 
Registered: Nov 2003
Location: USA
Distribution: Ubuntu, CentOS, RedHat
Posts: 416

Original Poster
Rep: Reputation: 31
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.

Last edited by cucolin@; 07-30-2012 at 04:55 PM. Reason: php version
 
Old 07-31-2012, 08:03 AM   #5
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
Quote:
NO luck.
If you post error messages, someone might be able to help
 
Old 07-31-2012, 12:28 PM   #6
cucolin@
Member
 
Registered: Nov 2003
Location: USA
Distribution: Ubuntu, CentOS, RedHat
Posts: 416

Original Poster
Rep: Reputation: 31
There are NO error messages.
I believe I found the issue, will post the result in a moment.

Thanks for helping!
 
Old 08-01-2012, 03:59 PM   #7
cucolin@
Member
 
Registered: Nov 2003
Location: USA
Distribution: Ubuntu, CentOS, RedHat
Posts: 416

Original Poster
Rep: Reputation: 31
In this new Ubuntu server I get the output:
Quote:
[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!
 
Old 08-02-2012, 12:32 AM   #8
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
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.

Last edited by Wim Sturkenboom; 08-02-2012 at 12:33 AM.
 
Old 08-02-2012, 07:34 AM   #9
cucolin@
Member
 
Registered: Nov 2003
Location: USA
Distribution: Ubuntu, CentOS, RedHat
Posts: 416

Original Poster
Rep: Reputation: 31
Yes, I forgot to post the code. I will post it shortly. Thanks again Wim Sturdenboom!
 
Old 08-02-2012, 11:12 AM   #10
cucolin@
Member
 
Registered: Nov 2003
Location: USA
Distribution: Ubuntu, CentOS, RedHat
Posts: 416

Original Poster
Rep: Reputation: 31
Here is the code. I have remove credentials for security reason. Thanks for your help!
Attached Files
File Type: txt xmlrequest.php.txt (5.3 KB, 17 views)
 
Old 08-02-2012, 02:02 PM   #11
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
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.
 
Old 08-02-2012, 02:07 PM   #12
cucolin@
Member
 
Registered: Nov 2003
Location: USA
Distribution: Ubuntu, CentOS, RedHat
Posts: 416

Original Poster
Rep: Reputation: 31
Thanks!
Attached is the text dump of the complete output.
I appreciate your help.
Attached Files
File Type: txt xmloutput.txt (35.1 KB, 19 views)
 
Old 08-03-2012, 12:58 AM   #13
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
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?
 
Old 08-03-2012, 09:24 AM   #14
cucolin@
Member
 
Registered: Nov 2003
Location: USA
Distribution: Ubuntu, CentOS, RedHat
Posts: 416

Original Poster
Rep: Reputation: 31
1. Yes, I can access the URL using the web browser
2. Yes, I can ping the server.
Thanks for helping!
 
Old 08-03-2012, 01:40 PM   #15
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
Unfortunately I can't help further. Hope somebody else can.
 
  


Reply

Tags
apache2, php, xmlhttprequest



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP script not being interpreted properly ShaqDiesel Programming 5 08-09-2011 06:48 PM
[SOLVED] PHP Does not work properly in fedora 14 tab4trouble Linux - Software 3 12-22-2010 05:19 AM
Why my PHP script can't work naihe2010 Programming 11 11-30-2006 11:19 AM
A Perl script doesn't properly work Hirszu Programming 4 11-29-2005 01:02 AM
apache or php doesn't work properly on RH8.0 abd_bela Linux - Networking 6 03-18-2003 05:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration