[BlueOnyx:10382] Re: open_basedir restriction in effect.

Chuck Tetlow chuck at tetlow.net
Sat Apr 28 00:15:20 -05 2012


Oh!  I think I see what you're trying to do.  You want to run a PHP script from the command-line. 

But I don't think you can do that.  You must have a "interpreter" to run a script in a particular language, and I believe that in PHP - the interpreter is built into Apache.  Without that interpreter (as from the command-line) - it won't run.  I don't think you can simply call a PHP script from the command-line and get it to run.  Can any of you experts out there expand on this further?  Can you call a PHP script from the command-line?

Dick, you may have to consider rewriting that script in something else like Perl to get it to run.  Or you might try a off-hand trick, like calling that PHP script from the command-line using a command-line browser like Lynx. 

Give that a try - see if you can get Lynx to run that PHP script, so you can keep it in PHP.  If that works from the CL, put Lynx into the cron job calling that PHP script.  And you might even pipe the Lynx output to a text file with the date, to have a record of running that PHP script each day.

Good luck.

Chuck

---------- Original Message -----------
From: "DD" <bqlist at distortal.com> 
To: "'BlueOnyx General Mailing List'" <blueonyx at mail.blueonyx.it> 
Sent: Fri, 27 Apr 2012 23:08:00 +0100 
Subject: [BlueOnyx:10378] Re: open_basedir restriction in effect.

> Hi all. My apologies for bugging you on a weekend :( 
> 
> I still seem to be getting no further. To recap: 
> 
>     I want to run a PHP script via crontab. The entry in /etc/crontab 
> is: 
>     12,42  * * * * root php /home/.sites/70/site4/update_products.php 
> 
> update_products.php contains: 
> 
>     $fn="/home/.sites/70/site4/product_list.csv"; 
>     if(file_exists($fn)) { ... } 
> 
> The file is uploaded via FTP from an AS400 somewhere. If found, it should be 
> parsed, then deleted. 
> 
> Whenever I try to run this through the shell, with "php 
> /home/.site/70/site7/update_products.php" I get an error: 
> 
>     PHP Warning:  file_exists(): open_basedir restriction in effect. 
>     File(/home/.sites/70/site4/product_list.csv) is not within the 
>     allowed path(s): (/tmp/:/var/lib/php/session/:/usr/sausalito/ 
>     configs/php/) in /home/.sites/70/site4/update_products.php 
>     on line 10 
> 
> I am logged in as admin and use su to become root.  I get this error even if 
> I copy the file to /web/. However I *can* run the file by browsing to 
> http://<domain>/update_products.php 
> 
> All files and the /site4/ folder are owned by a username of the site. The 
> only thing out of the ordinary is that the host name is 'upload', not www. 
> 
> This is on 5108R, fresh install, no other packages added. It also used to 
> work on the server that was reimaged recently, a 2009 install that was 
> otherwise up to date. 
> 
> Any ideas? 
> 
> Dick 
> 
> -----Original Message----- 
> From: blueonyx-bounces at mail.blueonyx.it 
> [mailto:blueonyx-bounces at mail.blueonyx.it] On Behalf Of Michael Stauber 
> Sent: 27 April 2012 19:16 
> To: BlueOnyx General Mailing List 
> Subject: [BlueOnyx:10372] Re: open_basedir restriction in effect. 
> 
> Hi DD, 
> 
> > It looks like /tmp/:/var/lib/php/session/:/usr/sausalito/configs/php/ is 
> > being appended to the lists of approved paths no matter what. 
> 
> Yes, that is correct. Because the above are "must have" items. They (and the 
> 
> path to the Vsite in question) will always be filled in automatically. 
> 
> To that add a ':/'. That's a semicolon and a slash. That will add '/' to 
> your 
> path as well and grants access to anything everywhere. PROVIDED that the 
> file 
> that the script wants to access is in a readable directory and that the 
> script 
> has sufficient permissions to access said file. So please also check the 
> ownership and permissions of your product_list.csv and the directory that it 
> 
> resides in. 
> 
> -- 
> With best regards 
> 
> Michael Stauber 
> _______________________________________________ 
> Blueonyx mailing list 
> Blueonyx at mail.blueonyx.it 
> http://mail.blueonyx.it/mailman/listinfo/blueonyx 
> 
> _______________________________________________ 
> Blueonyx mailing list 
> Blueonyx at mail.blueonyx.it 
> http://mail.blueonyx.it/mailman/listinfo/blueonyx 
------- End of Original Message -------
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.blueonyx.it/pipermail/blueonyx/attachments/20120428/ba2ea827/attachment.html>


More information about the Blueonyx mailing list