You are here:  » Can not run import.php

Support Forum



Can not run import.php

Submitted by anhmocboc on Mon, 2007-08-27 09:24 in

Hi,
I tried to run import.php using Putty. It did not do anything. I got this:

> php import.php
X-powered-by: PHP 4.4.7
Content-type: text/html

I have no problem import using Admin page. I have Managed Server with 1and1.

Thank you

Submitted by support on Mon, 2007-08-27 18:51

Hi,

When you run import.php, you need to tell it what to import, either a feed filename, or @ALL or @MODIFIED. For example:

>php import.php @ALL

Cheers,
David.

Submitted by anhmocboc on Mon, 2007-08-27 21:28

Hi David,

I tried
> php import.php @ALL
and
> php import.php myfilename.txt

It still displayed

X-powered-by: PHP 4.4.7
Content-type: text/html

Thank you

Submitted by support on Mon, 2007-08-27 21:33

Hello,

It looks like PHP might not be configured correctly to run from the command line.

Can you create a test script, with the following code:

test.php

<?php
  
print "Testing...";
?>

Then, run this in the same way as import.php, e.g.

>php test.php

And check that it displays "Testing...".

Cheers,
David.

Submitted by anhmocboc on Mon, 2007-08-27 21:50

Hi,
I loaded and run test.php, it still display

>php test.php
X-Powered-by: PHP/4.4.7
Content-type: text/html

I got Managed Server from 1and1 one week ago. I don't know what they set up and configured on the server.

Thank you

Submitted by support on Mon, 2007-08-27 22:00

Hi,

This is strange, as it should execute the file by default. What happens if you use the actual switch -f, for example:

>php -f test.php

Cheers,
David.

Submitted by anhmocboc on Mon, 2007-08-27 22:20

Hi,
It works when I run

>php -f test.php
Testing...

Submitted by support on Mon, 2007-08-27 22:43

Hi,

That means that for some reason PHP is not configured to execute the filename by default, you need to specify "-f". Therefore, try:

>php -f import.php @ALL

or

>php -f import.php filename.txt

...and it should work.

Cheers,
David.

Submitted by anhmocboc on Mon, 2007-08-27 23:14

Hi David,

It works perfectly.

Thank you very much

Submitted by AD_Mega on Sun, 2007-09-23 05:39

I'm switching to a new host and I can't run import from the command line. I tried what you mentioned above but it still didn't work.

Submitted by support on Sun, 2007-09-23 07:30

Hi,

Incase you hadn't come across it, check out the following thread with recommendations and discussion about hosts and requirements...

http://www.pricetapestry.com/node/173

Cheers,
David.

Submitted by AD_Mega on Sun, 2007-09-23 07:38

I have vps hosting with westhost now. I'm setting up my website making sure everything work. When I run php import.php @ALL it doesn't do anything. I don't get an error. I look to see if the feeds are imported and they haven't. My last host I would see the feeds importing on the screen.

Submitted by support on Sun, 2007-09-23 07:42

When you run the command, is there absolutely no output at all? Does it just return to the command line?

Can you try a test script, that just prints something out, for example:

test.php:

<?php
  
print "PHP from the command line is working.";
?>

And then try running it in the same way:

php test.php

If that doesn't do anything either, then for some reason PHP is not configured correctly to work from the command line. If you have a VPS account then you should have complete control over the configuration so there shouln't be any policy restrictions preventing you from running scripts in this way...

Cheers,
David.

Submitted by AD_Mega on Sun, 2007-09-23 07:51

This is what I get when I run test.php

[megashoppingonline][/]$ /var/www/html/test.php
/var/www/html/test.php: line 1: ?php: No such file or directory
/var/www/html/test.php: line 2: print: command not found
/var/www/html/test.php: line 3: syntax error near unexpected token `newline'
/var/www/html/test.php: line 3: `?> '
[megashoppingonline][/]$

Submitted by support on Sun, 2007-09-23 07:56

Hi,

You need to run it using the PHP command, just like import.php above, and ideally whenever running PHP scripts like this having changed directory (cd) to the directory of the script, for example:

[megashoppingonline][/]$cd /var/www/html/test.php
[megashoppingonline][/]$php test.php

Cheers,
David.

Submitted by AD_Mega on Sun, 2007-09-23 08:00

Ok I get Could not open input file: test.php

Submitted by support on Sun, 2007-09-23 08:04

Can you copy your command line and the output like you posted earlier...

Thanks,
David.

Submitted by AD_Mega on Sun, 2007-09-23 08:10

[megashoppingonline][~]$ cd / html
[megashoppingonline][/]$ php test.php
Could not open input file: test.php
[megashoppingonline][/]$

Submitted by support on Sun, 2007-09-23 08:20

Hi,

The commands you are using to change directory don't look correct - try it exactly like this:

[megashoppingonline][/]$cd /var/www/html/
[megashoppingonline][/]$php test.php

cd / html, which you are currently using will just change directory to / (which you can see in the current path which is displayed in the square brackets)...

Cheers,
David.

Submitted by AD_Mega on Sun, 2007-09-23 08:26

Ok this is what i get:
[megashoppingonline][~]$ cd /var/www/html/
[megashoppingonline][/var/www/html]$ php test.php
Failed loading /usr/local/Zend/lib/ZendExtensionManager.so: /usr/local/Zend/lib /ZendExtensionManager.so: cannot open shared object file: No such file or direct ory

Submitted by AD_Mega on Sun, 2007-09-23 08:29

Ok I got import.php to work. I have to cd cd /var/www/html/scripts I just cand cd to that directory.

Submitted by support on Sun, 2007-09-23 08:30

Hi,

This implies that PHP is not configured correctly to run from the command line; or indicates that the installation of PHP when the server was setup (or the VPS configuration) is wrong. I'll have a search on the error message for you and see if anything obvious comes up (although the error message is reasonably self-explanitory), but in the mean time it will be worth copying the same output you posted above to your host's technical support desk as they should be able to see what is wrong from the error and correct the PHP installation...

Cheers,
David.

Submitted by support on Sun, 2007-09-23 08:31

Hi again,

That's good - not sure why test.php creating the zend message, but if import.php is working you should be OK...

Cheers,
David.