php-windows Digest 29 Apr 2004 17:04:01 -0000 Issue 2231
Topics (messages 23583 through 23600):
Re: Run batch files using php
23583 by: Jason Barnett
23596 by: Harpreet K. Singh
SSL, how?
23584 by: Tobias Talltorp
23585 by: speedfreak.chello.be
How do you get the image function to work?
23586 by: Daniel Anderson
23587 by: Jason Barnett
Internal Server Error
23588 by: Raheel Hussain
23590 by: Jason Barnett
23598 by: Stuart
23599 by: Raheel Hussain
Re: COM on remote machine + MapPoint COM question?
23589 by: Gryffyn, Trevor
Re: Order By........
23591 by: Gryffyn, Trevor
Unsubscribe me
23592 by: Gregg Mercede
Re: Need help using "php.exe"
23593 by: Gryffyn, Trevor
23595 by: Svensson, B.A.T. (HKG)
Re: The COM problem when converting from ASP to PHP
23594 by: Gryffyn, Trevor
Possibilities of removal of annoying spam bounce in the php-list
23597 by: Svensson, B.A.T. (HKG)
Running PHP as another user
23600 by: Jason Barnett
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]
----------------------------------------------------------------------
--- Begin Message ---
Harpreet wrote:
I wrote a batch file using php . Can I run this batch file using php with
the system or some other command.
Please help
Sure, you can call php from the command line and pass arguments to it
(like the name of a php script to run). Or did you mean run a batch
file from inside a php script? To do that, you need to use exec()
http://www.php.net/function.exec
--- End Message ---
--- Begin Message ---
I run the batch file double clicking on it and it copies the files from one
server to the other.
I run the copy command in dos prompt it runs perfect
I try running the same copy command or running the same batch file using
exec in my php page and i get access is denied.
What do i need to do to copy from one server to another. I have the drives
mapped on my machine
please help. I am stuck on it for 3 days now.
Thanks
----- Original Message -----
From: "Jason Barnett" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 29, 2004 12:24 AM
Subject: [PHP-WIN] Re: Run batch files using php
> Harpreet wrote:
> > I wrote a batch file using php . Can I run this batch file using php
with
> > the system or some other command.
> >
> > Please help
>
> Sure, you can call php from the command line and pass arguments to it
> (like the name of a php script to run). Or did you mean run a batch
> file from inside a php script? To do that, you need to use exec()
>
> http://www.php.net/function.exec
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Hi
I want to use fsockopen() with SSL, but I get this error message.
Warning: fsockopen(): no SSL support in this build in D:\Program
Files\Apache Group\Apache2\htdocs\ssltest.php on line 287
How do I enable ssl-support for php?
I uncommented the line in for the php_openssl.dll extension in php.ini and
copied libeay32.dll to my C:\WINNT\SYSTEM32 folder.
(Manual)
http://se.php.net/manual/en/ref.openssl.php
My setup:
win 2000
apache 2
php 4.3.4
Any thoughts?
// Tobias
--- End Message ---
--- Begin Message ---
Tobias Talltorp wrote on 29/04/04 12:30 >
Hi
I want to use fsockopen() with SSL, but I get this error message.
Warning: fsockopen(): no SSL support in this build in D:\Program
Files\Apache Group\Apache2\htdocs\ssltest.php on line 287
How do I enable ssl-support for php?
I uncommented the line in for the php_openssl.dll extension in php.ini and
copied libeay32.dll to my C:\WINNT\SYSTEM32 folder.
(Manual)
http://se.php.net/manual/en/ref.openssl.php
My setup:
win 2000
apache 2
php 4.3.4
Any thoughts?
// Tobias
Hi Tobias,
To get the https wrapper working with php 4.3.4, you need to replace
your php4ts.dll with the one provided at the link below:
http://ftp.proventum.net/pub/php/win32/misc/openssl/
This is instead of using the php_openssl.dll, so be sure to comment this
extension in your php.ini. There's an example in the php manual:
http://se.php.net/manual/en/function.fsockopen.php
(look at the user contributed notes from 10-Aug-2003 08:56)
HTH,
speedfreak
--- End Message ---
--- Begin Message ---
Hi,
can anyone tell me how I can get the Image Create function for PHP to work properly?
I have viewed the English manual at www.php.net and the comments posted don't really
help to get this thing working, the GD Image Library says it is not for PHP.
Can anyone help?
Anything will be greatly appreciated,
thanks,
Dan
--- End Message ---
--- Begin Message ---
Daniel Anderson wrote:
Hi,
can anyone tell me how I can get the Image Create function for PHP to work properly?
I have viewed the English manual at www.php.net and the comments posted don't really
help to get this thing working, the GD Image Library says it is not for PHP.
Can anyone help?
Anything will be greatly appreciated,
thanks,
Dan
Do you have the extension php_gd2.dll enabled?
--- End Message ---
--- Begin Message ---
I m trying to configure the php 4.3.6 on windows 2K
I did every step witten in the installation instructions but
when i go to run the test.php page
with < ? phpinfo(); ?> witten in it then it was first giving an error of
"the specified procedure cannot be found"
then i tried reconfiguring it and now its giving error for
HTTP 500 - internal server error
can somebody guide where i m making mistakes
or wht things to keep in mind while mannually configuring this.
regards
---------------------------------
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
--- End Message ---
--- Begin Message ---
Raheel Hussain wrote:
I m trying to configure the php 4.3.6 on windows 2K
I did every step witten in the installation instructions but
when i go to run the test.php page
with < ? phpinfo(); ?> witten in it then it was first giving an error of
You should try to use php tags for php code:
<?php phpinfo(); ?>
"the specified procedure cannot be found"
then i tried reconfiguring it and now its giving error for
HTTP 500 - internal server error
Yeah, this happens when you start changing the configuration. Do you
know what you did before you started get the 500 message? My GUESS is
that you probably changed some of your server (Apache?) configuration.
can somebody guide where i m making mistakes
or wht things to keep in mind while mannually configuring this.
regards
---------------------------------
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
--- End Message ---
--- Begin Message ---
Raheel Hussain wrote:
HTTP 500 - internal server error
can somebody guide where i m making mistakes
or wht things to keep in mind while mannually configuring this.
I'm going to assume you're using Internet Explorer in its default
configuration. Try turning "Show friendly HTTP error messages" in the
Advanced tab of your Internet Options in the Tools menu. Then refresh
the page - it *may* give you a more specific error message.
--
Stuart
--- End Message ---
--- Begin Message ---
fortunately i got the solution to it
but i was a little surprised with it.
actually as i had installed php previously and as i remember in the
IISAdmin you add the application mapping (.php , or .phtml)
with the path of executable of ("c:\php\php4ts.dll")
and i did the same and when i read the step for installation i saw the same
but on the php.net website in the online documentation i found out that
you need to give following path
"c:\php\sapi\php4isapi.dll"
and additionaly i didn't add any ISAPI filter in my IIS and its running properly.
this is infact good that it decreased the number of steps of php mannual config.
cheers
Stuart <[EMAIL PROTECTED]> wrote:Raheel Hussain wrote:
> HTTP 500 - internal server error
>
> can somebody guide where i m making mistakes
> or wht things to keep in mind while mannually configuring this.
I'm going to assume you're using Internet Explorer in its default
configuration. Try turning "Show friendly HTTP error messages" in the
Advanced tab of your Internet Options in the Tools menu. Then refresh
the page - it *may* give you a more specific error message.
--
Stuart
---------------------------------
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
--- End Message ---
--- Begin Message ---
I'm playing around with COM right now doing things with PHP and
MapPoint. I got the feeling that COM was something that had to work on
the local machine because you needed the COM information in your
registry to tell the computer what application to run. That is, PHP
says "Open COM connection to MapPoint", the user's computer looks at the
listing of COM apps and when it finds MapPoint it knows what EXE to run.
Unlike DDE where you need the application running and listening for DDE
input.
After doing a little research, I think I figured out that what you want
is DCOM if you want to do a COM call to a remote PC. I don't have time
to do the full research on what it takes to set up a DCOM server, but it
sounds like it's possible to do what you're talking about.
Couple of things I noticed:
1. Check out the "COM support functions for Windows" at:
http://www.php.net/manual/en/ref.com.php
It says that the default PHP.INI setting is com.allow_dcom = FALSE
(looking at PHP.INI I see that it's commented out on mine)
2. When instantiating a new COM object, you CAN give it a server name to
connect to (for DCOM):
string COM::COM ( string module_name [, string server_name [,
int codepage]])
http://www.php.net/manual/en/class.com.php
Hope this helps. If you have questions about working with the objects,
methods and properties, I might be able to help you out a little. I've
never really worked with objects and such before (being largely
self-taught programming-wise.. Never learned that fancy stuff in school.
Heh) and all the code samples I found were either VERY basic (PHP ->
COM) or only semi-helpful (Microsoft VBA code examples). But I think I
figured it all out now.
Now if someone could tell me why the "StartTime" property on a Direction
Object in MapPoint ALWAYS returns a "-1" instead of a time value, I'd
REALLY appreciate it. :) That's the only thing about MapPoint so far
that I havn't been able to figure out. I want to use it to show an
icon where a truck is en route between an origin and destination given
it's departure time and the current time of day.
Hope some of this helps, Marc! Good luck!
-TG
> -----Original Message-----
> From: M.Staiger [mailto:[EMAIL PROTECTED]
> Sent: Thursday, April 22, 2004 8:12 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] COM on remote machine
>
> Hello NG,
>
> Imagine that you have one machine running iis with php and
> want to call a
> COM-Server (e.g. Word) on a remote machine.Would this be
> possible? How would
> it look like, if this is the call for the local machine : $word = new
> COM("word.application");
>
> Thanks,
> Marc
--- End Message ---
--- Begin Message ---
If you want the last post first, you probably want to order your query
"descending", try this line:
$get_post = "select * from $table_name2 where cat_id = '$_POST[cat_id]'
ORDER BY posted DESC";
-TG
> -----Original Message-----
> From: Will [mailto:[EMAIL PROTECTED]
> Sent: Monday, April 26, 2004 9:17 PM
> To: PHP-Windows
> Subject: [PHP-WIN] Order By........
>
>
> Hello All,
> I have a question regarding the order by:
>
> Here is my code:
> $get_post = "select * from $table_name2 where cat_id =
> '$_POST[cat_id]' ORDER BY posted";
>
> It is not taking the last post and putting it first. I
> think there is something else I have to put there but
> I cannot figure it out. Can someone help.
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Win a $20,000 Career Makeover at Yahoo! HotJobs
> http://hotjobs.sweepstakes.yahoo.com/careermakeover
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
http://hotjobs.sweepstakes.yahoo.com/careermakeover
--- End Message ---
--- Begin Message ---
http://www.php.net/manual/en/features.commandline.php
Check out this page about using PHP via command line. You pass
variables in via the $argv variable. Here's a snippet:
--------
Like every shell application, the PHP binary accepts a number of
arguments but your PHP script can also receive arguments. The number of
arguments which can be passed to your script is not limited by PHP (the
shell has a certain size limit in the number of characters which can be
passed; usually you won't hit this limit). The arguments passed to your
script are available in the global array $argv. The zero index always
contains the script name (which is - in case the PHP code is coming from
either standard input or from the command line switch -r). The second
registered global variable is $argc which contains the number of
elements in the $argv array (not the number of arguments passed to the
script).
As long as the arguments you want to pass to your script do not start
with the - character, there's nothing special to watch out for. Passing
an argument to your script which starts with a - will cause trouble
because PHP itself thinks it has to handle it. To prevent this, use the
argument list separator --. After this separator has been parsed by PHP,
every argument following it is passed untouched to your script.
--------
Good luck!
-TG
> -----Original Message-----
> From: Eugen [mailto:[EMAIL PROTECTED]
> Sent: Sunday, April 11, 2004 10:35 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] Need help using "php.exe"
>
>
> Hi all,
>
>
> When you parse a file using the command "php.exe -f c:\myfile.php >
> c:\myfile.htm" , what command is required to set a variable. Example:
> In IE addressbar, when i type(doesn't matter what server i use) :
> http://localhost/myfile.php?thevariable=anyvariable, the
> "myfile.php" file
> is now parsed with indicated variable.
> But if i launch "php.exe -f c:\myfile.php?thevariable=anyvariable >
> c:\myfile.htm" , the output file (c:\myfile.htm) contains one line:
> No input file specified.
>
> How can i make it work, without using a webserver ?
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
> Like every shell application, the PHP binary accepts a number of
> arguments but your PHP script can also receive arguments. The number of
> arguments which can be passed to your script is not limited by PHP (the
> shell has a certain size limit in the number of characters which can be
> passed; usually you won't hit this limit). The arguments passed to your
This limitation is probably related to the stack size. If one has an
extreme memory need for passing command line args, then one might
consider to change the stack size for the command shell it self.
--- End Message ---
--- Begin Message ---
Yeah, this is some of the fun of dealing with COM and PHP. Microsoft
puts all kinds of little shortcuts into their system that are difficult
to access via PHP. I'm sure there's a smarter programmer out there than
I am who knows how to make this work properly, but here's my 2 cents:
1. When you call some methods to a COM object, they may only return a
SUCCESS or FAIL type message, not an actual value. That's the case in
this instance. It's almost like you're passing a reference to the
variables in ASP, not the value of the variable. You might try doing
something like $com->GenerateSigningKeys(&$privkey,&$pubkey); or
something.. I don't know, I don't have a lot of practice with passing
references, I usually do something and keep playing with it until it
works. But adding the &'s might do something.
2. When you call a method, the parameters that you call it with (in this
case, $privkey and $pubkey) are NOT changed by the method of the COM
object. If you did $methodresults =
$com->GenerateSigningKeys($privkey,$pubkey); you'd at least get a
failure code if it failed to generate the keys.
Read through the data model for this COM object at:
http://msdn.microsoft.com/library/en-us/wmrm/htm/keysgeneratesigningkeys
.asp
I'm kind of at a loss here but thought I'd at least give you this much,
maybe it'll help.
-TG
> -----Original Message-----
> From: Steven Kidd [mailto:[EMAIL PROTECTED]
> Sent: Friday, April 23, 2004 9:16 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] The COM problem when converting from ASP to PHP
>
> Hi,
>
> <<I think it's more suitable for the php-windows list so I post here
> again,sorry. -- stev>>
>
> When I converting lines of ASP code:
>
> <%
> dim keysobjs
> dim privkey
> dim pubkey
> dim seed
> Set keysobj= CreateObject("wmrmobjs.WMRMKeys")
> keysobj.GenerateSigningKeys privkey, pubkey
> seed = keysobj.GenerateSeed()
> Response.Write privkey
> Response.Write "<br>"
> Response.Write pubkey
> Response.Write "<br>"
> Response.Write seed
> %>
>
> To the PHP one:
>
> <?
> $com = new COM("wmrmobjs.WMRMKeys");
> $com->GenerateSigningKeys($privkey,$pubkey);
> $seed = $com->GenerateSeed();
>
> echo "Private key=".$privkey;
> echo "<br>";
> echo "Public key=".$pubkey;
> echo "<br>";
> echo "Seed=".$seed;
> ?>
>
> In the ASP code everything works pretty well,
> In the PHP code, although I can obtain the value of $seed,
> the $privkey and $pubkey are null,
> kindly check the code for me, thx...
--- End Message ---
--- Begin Message ---
Is there any kind of moderator or list administrator for the php list
that has the ability to remove this annoying spam subscriber that
bounces these "Amazon.com Jobs Application Auto-Reply" every time one
post to the php-win list?
It's starts to get annoying to see this type of mail pop up in the
mailbox week after week as soon one make a posting in the list.
--- End Message ---
--- Begin Message ---
It seems that several people have run into a problem where PHP did not
have permission to access certain folders / files in Windows. I have
two solutions that I have tried on WinXP, if others could verify if this
works on other Windows platforms this would be helpful.
Solution #1:
Use the function CACLS to grant PHP's user access to the file / folder
and then return permissions to normal when finished. To do this
manually use
1. Start -> Run -> cmd
2. "CACLS somefile.ext /E /G youruser:F "
3. "c:\php5\php.exe -f yourphpfile.php"
3. "CACLS somefile.ext /E /D youruser"
Since this is a shell command, I thought we could also do this from a
php script. Unfortunately, I couldn't get it to work? Here's what I
tried for those that want to give it a shot:
function switchUserExec($absfile, $user = null, $permission = 'F', $php
= 'C:/php5/php.exe') {
$absfile = escapeshellarg($absfile);
$user = escapeshellarg($user);
$permission = escapeshellarg($permission);
$php_cli = escapeshellarg($php_cli);
$com = getenv('ComSpec').' /C ';
exec("$com CACLS $absfile /E /G $user:$permission");
exec("$com $php -f $absfile", $result);
exec("$com CACLS $absfile /E /D $user");
return $result;
}
Solution #2 (suphp.bat):
@ECHO OFF
REM This is an example batch file for Windows systems running php.
REM It should enable you to run PHP from the command line as any user
REM you specify. The main reason I made this was to temporarily give
PHP PHP permission to access files of a specific user. Change these
REM lines to match the user and path info for your system
SET "PHP=C:\php5\php-win.exe"
SET "USER=someuser"
SET "PHP_FILE=C:\path\to\somescript.php"
REM You *can* add the switch /savecred to save the password
REM and avoid retyping each time, not sure how secure this is?
RUNAS /user:%USER% "%PHP% -f %PHP_FILE%"
@ECHO ON
--- End Message ---