php-windows Digest 21 Apr 2001 14:25:42 -0000 Issue 556

Topics (messages 6941 through 6946):

PHP4, WinNT, exec() (NOTHING HAPPENS!...please help!!)
        6941 by: Dave Faulkner

Re: include
        6942 by: Chris Adams

PHP 4 Session
        6943 by: Arthur Melkonyan
        6944 by: Flint Doungchak
        6945 by: Arthur Melkonyan

about mySql support in PHP4
        6946 by: RJ

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------


Hello all.

Im quite new to php and have a problem i hope you can help me with. Below i
have a copy of my code which i use for users to upload aviation photos to my
server.
First it uploads the photo and then copies it to a directory on my server.
Then it adds all the relevant data into the mysql database.

<?

include "header.inc";
$img_location = "aviation/uploads/$image_name";
if ($image_name != "") {

// exec("$CJPEG $image_name | $PNMSCALE -width 128 | $CJPEG -outfile >
$thimagefile");
// exec("$DJPEG $imagename > t.pnm");
// exec("$PNMSCALE -width 128 t.pnm > t2.pnm");
// exec("$CJPEG -outfile t3.jpg t2.pnm");
// exec("I:\Perl\bin\cjpeg.exe -quality 30 -progressive $image_name");
// exec("c:/autobatchit!/autobatchit.exe");
// exec("jpegtools/cjpeg.exe");
exec("convert.exe -geometry 600 $img_location $img_location");
copy("$image", "../aviation/uploads/$image_name") or die ("Couldn't copy the
file.");



} else {

die("You forgot to add a filename. Please click the back button and try
again.");

}



$db = mysql_connect("$user", "$password") or die("Can't connect to
server.");
mysql_select_db("database", $db) or die("Can't select database.");



$insert_data = "INSERT INTO table (image_name, image, name, email, country,
airfield, rego, remarks, airline, date, month, year, allfields) VALUES
('$image_name', $URL, $image_name', '$name', '$email', '$country',
'$airfield', '$rego', '$remarks', '$airline', '$date', '$month', '$year',
'$name')";
$update_rego = "update images set allfields = concat(allfields, ' $rego')";
$update_email = "update images set allfields = concat(allfields, '
$email')";
$update_country = "update images set allfields = concat(allfields, '
$country')";
$update_remarks = "update images set allfields = concat(allfields, '
$remarks')";
$update_image_name = "update images set allfields = concat(allfields, '
$image_name')";
$update_airline = "update images set allfields = concat(allfields, '
$airline')";
$update_date = "update images set allfields = concat(allfields, ' $date')";
$update_month = "update images set allfields = concat(allfields, '
$month')";
$update_year = "update images set allfields = concat(allfields, ' $year')";

mysql_query($insert_data) or die("Couldn't insert data.");
mysql_query($update_rego) or die("Couldnt Update Rego.");
mysql_query($update_email) or die("Couldnt Update Email.");
mysql_query($update_country) or die("Couldnt Update Country.");
mysql_query($update_remarks) or die("Couldnt Update Remarks.");
mysql_query($update_image_name) or die("Couldnt Update Image.");
mysql_query($update_airline) or die("Couldnt Update Airline.");
mysql_query($update_date) or die("Couldnt Update Date.");
mysql_query($update_month) or die("Couldnt Update Month.");
mysql_query($update_year) or die("Couldnt Update Year.");

exec("echo File has been uploaded! Filename is $URL $img_location.
Uploader's name is $name . Email Address is $email. Airline is $airline.
Country is $country. Date taken is $date of $month, $year. Registration is
$rego. Remark is $remarks. | blat - -s \"$image_name uploaded --\" -f
$from_email -t $to_email");


?>

All of it works wonderfully (according to a novice) except the image
maipulation stuff. What i want to do it have the image resized to 600 pixels
(maintaining ratio) and add just a touch of compression to bring te file
size down a little.

as you can see i have put the line:
exec("convert.exe -geometry 600 $img_location $img_location"); Im using
imagemagick at this point to try and get the desired outcome.
in before it copies the file to the directory. However this results in
absolutely nothing being executed. The rest of the script still works fine,
but none of the "convert" stuff looks like it ever registers. If i look at
the task manager on NT, nothing comes up to do with 'convert'.

I know convert is in the path, because if i go to the NT machine and just
type convert at the command prompt, it works fine.

Can anyone tell me what i am doing wrong here.?....i have tried a lot of
different things as you can see and nothing seems to work.

My configuration is: WindowsNT4 sp6, iis4, php4.

Thanks in advance guys and i hope i have posted this to the right group.

Regards

Dave






On 20 Apr 2001 14:04:00 -0700, Olivier Botineau <[EMAIL PROTECTED]> wrote:
>Good evening all,
>do you know if its possible to give an absolute path instead of a relative path for 
>include:
>include( '../../menu.php' );           is OK
>incude( '/inculde/menu.php' );         is Not OK


That's the correct syntax for an absolute path but it's relative to the webroot
- you'll need to add in the full path - e.g. "/www/site/include/menu.php" or
"C:/IIS/site/include/menu.php".

I generally prefer to set include_path for each virtual host so I can place
included files outside of the webroot and not have to worry about paths.




Any one knows how to make session run properly on windows9x/NT

These are the error I get when I run session:
Warning: open(/tmp\sess_31206e8763f2d300416fd476be5f591e, O_RDWR)
failed: m (2) in Unknown on line 0

Warning: Failed to write session data (files). Please verify that the
current setting of session.save_path is correct (/tmp) in Unknown on
line 0

Thanks,
-art





Hey Arthur,

Make sure that in your php.ini file that the save path is defined to
someplace that exists and PHP has permissions to write to. I suspect that
the c:/temp folder that is the default for php.ini file doesn't exist. You
likely have a folder such as c:\temp. You can try that or any other folder
that you wish.

Good luck.

-Flint

-----Original Message-----
From: Arthur Melkonyan [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 20, 2001 10:13 PM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] PHP 4 Session


Any one knows how to make session run properly on windows9x/NT

These are the error I get when I run session:
Warning: open(/tmp\sess_31206e8763f2d300416fd476be5f591e, O_RDWR)
failed: m (2) in Unknown on line 0

Warning: Failed to write session data (files). Please verify that the
current setting of session.save_path is correct (/tmp) in Unknown on
line 0

Thanks,
-art





Thank for help

Flint Doungchak wrote:

> Hey Arthur,
>
> Make sure that in your php.ini file that the save path is defined to
> someplace that exists and PHP has permissions to write to. I suspect that
> the c:/temp folder that is the default for php.ini file doesn't exist. You
> likely have a folder such as c:\temp. You can try that or any other folder
> that you wish.
>
> Good luck.
>
> -Flint
>
> -----Original Message-----
> From: Arthur Melkonyan [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 20, 2001 10:13 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] PHP 4 Session
>
> Any one knows how to make session run properly on windows9x/NT
>
> These are the error I get when I run session:
> Warning: open(/tmp\sess_31206e8763f2d300416fd476be5f591e, O_RDWR)
> failed: m (2) in Unknown on line 0
>
> Warning: Failed to write session data (files). Please verify that the
> current setting of session.save_path is correct (/tmp) in Unknown on
> line 0
>
> Thanks,
> -art
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]





Hi,
I got PHP4 working finally, and downloaded mySQL 3.23:36 for windows. The
installation worked fine. The book on php I have (from WROX) is actually
for php3 and does not mention details related to windows. So, Do I have
to do anything to integrate mySQL with PHP4? PHP document says that mySQL
support is built in!

Regards
RJ



Reply via email to