Jump to content

[SOLVED] Running php from command line issues


dfound

Recommended Posts

Hey,

I'm trying to run a php script from the command line, but I'm having some difficulties.

If I browse to my page in IE, my script executes properly, but if I run it from the command line, I receive this error:

Warning:  fopen() URL file-access is disabled in the server configuration in /www/public_html/update.php on line 21

Warning:  fopen(): failed to open stream: no suitable wrapper could be found in /www/public_html/update.php on line 21

 

I'm not sure why I receive errors when trying to run on the command line and not when accessing the page through a browser... My question is, can I open the page from a command line like a browser would??? I would like to make it a cron job, and currently I try "php update.php", but that receives the error... Is there a "http update.php" or a "get update.php" that would potentially do the same thing as a browser???

 

Thanks

Dave

Link to comment
Share on other sites

The issue your having seems like it may be related to where exactly you call the script from. Are you in the same directory as the script when you call it? Does the script try to open or include any files? We might need to see some code.

 

One thing you could use to make it run exactly the same as in a browser would be to call your script via wget. eg;

 

wget http://yourdmain.com/script.php

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.