[PHP] file_exists fun

2011-12-02 Thread Dee Ayy
The following code:

$new_file = 
ADS_DIR_INTERNAL.'/'.$ad_info['id'].'_'.$ad_info['filename'];
echo "NEW_FILE:[".$new_file."]\n";
echo "file_exists Using 
VAR:[".file_exists($new_file)."]\n";
echo "file_exists Using Hard
Coded:[".file_exists('/home/fx/pads/ads_dir/1_rubik1920x1080lu0.jpg')."]\n";

Gives this output:
NEW_FILE:[/home/fx/pads/ads_dir/1_rubik1920x1080lu0.jpg]
file_exists Using VAR:[]
file_exists Using Hard Coded:[1]

Why does it not work when using the variable in file_exists?

I thought I may need some safe_mode magic, safe_mode_include_dir, or
disable_functions, but I don't see any restrictions AND why does it
work when it is hard coded?
Warning
This function returns FALSE for files inaccessible due to safe mode
restrictions. However these files still can be included if they are
located in safe_mode_include_dir.

Current logic needs the following functions:
file_exists
md5_file
move_uploaded_file

Thanks.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: file_exists fun

2011-12-02 Thread Dee Ayy
On Fri, Dec 2, 2011 at 1:30 PM, Dee Ayy  wrote:
> The following code:
>
>                        $new_file = 
> ADS_DIR_INTERNAL.'/'.$ad_info['id'].'_'.$ad_info['filename'];
>                        echo "NEW_FILE:[".$new_file."]\n";
>                        echo "file_exists Using 
> VAR:[".file_exists($new_file)."]\n";
>                        echo "file_exists Using Hard
> Coded:[".file_exists('/home/fx/pads/ads_dir/1_rubik1920x1080lu0.jpg')."]\n";
>
> Gives this output:
> NEW_FILE:[/home/fx/pads/ads_dir/1_rubik1920x1080lu0.jpg]
> file_exists Using VAR:[]
> file_exists Using Hard Coded:[1]
>
> Why does it not work when using the variable in file_exists?
>
> I thought I may need some safe_mode magic, safe_mode_include_dir, or
> disable_functions, but I don't see any restrictions AND why does it
> work when it is hard coded?
> Warning
> This function returns FALSE for files inaccessible due to safe mode
> restrictions. However these files still can be included if they are
> located in safe_mode_include_dir.
>
> Current logic needs the following functions:
> file_exists
> md5_file
> move_uploaded_file
>
> Thanks.

>From PHP, exec('whoami') says "www-data", so I created /home/www-data
and chown to www-data.
file_exists with a variable still fails.
Initial and future testing of !file_exists(ADS_DIR_INTERNAL) works to
create the directory only once as intended, however ONLY initial
creation of the file inside the directory works with
move_uploaded_file.
Attempting to overwrite an existing file with move_uploaded_file fails.
I then tried exec('mv '.$_FILES['my_file']['tmp_name'].' '.$new_file)
as well as mv -f
which DOES COPY the filename of tmp_name to the correct directory
ADS_DIR_INTERNAL, but keeps the tmp_name filename!  It is not renamed
as a true linux "mv".
I assume it is some protection due to being an uploaded file.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] DOS CLI?

2011-12-02 Thread Matt Neimeyer
Is there (or is there a way to compile) a DOS CLI version of a fairly
recent version of PHP? I have not been able to find one using the
powers of Google.

Not a Windows Command Prompt CLI but an actual CLI version of PHP that
can be made to run in a real DOS environment?

I'm sure I could find another scripting language for DOS but to
prototype this project I'd like to not have to learn a new language as
well. :)

Thanks in advance for ANY suggestions.

Matt

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: DOS CLI?

2011-12-02 Thread Shawn McKenzie
On 12/02/2011 03:00 PM, Matt Neimeyer wrote:
> Is there (or is there a way to compile) a DOS CLI version of a fairly
> recent version of PHP? I have not been able to find one using the
> powers of Google.
> 
> Not a Windows Command Prompt CLI but an actual CLI version of PHP that
> can be made to run in a real DOS environment?
> 
> I'm sure I could find another scripting language for DOS but to
> prototype this project I'd like to not have to learn a new language as
> well. :)
> 
> Thanks in advance for ANY suggestions.
> 
> Matt

Uh No.  There's not one for the original Berkeley or AT&T UNIX,
VMS, CPM, Commodore 64, Mac OS 9 or Amiga either as far as I know.  The
DOS that ran on TRS80, concurrent DOS and Zenith DOS are right as well.

I'm sure that if you submit a feature request they would be all over it.

-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php