php-general Digest 19 Feb 2005 07:17:58 -0000 Issue 3294

Topics (messages 209045 through 209060):

Re: PHP to C interface?
        209045 by: Richard Lynch

Re: My FIRST php atempt
        209046 by: Richard Lynch

Re: FATAL: emalloc()
        209047 by: Stephen Johnson

Excel Reader
        209048 by: Greg Donald

Re: mysql query
        209049 by: Richard Lynch

Re: MySQL and MySQLi compiling
        209050 by: Richard Lynch
        209057 by: Chris
        209059 by: Chris

Destroying the Session Object
        209051 by: Jacques
        209054 by: Matt M.

Re: Help with SQL statement
        209052 by: Bret Hughes

I got it working
        209053 by: David Freedman

Re: Crontab for Windows
        209055 by: Jason Barnett

Newbie question
        209056 by: Adams, Tom
        209058 by: Adrian

Re: XHTML 1.1  +  php sessions  =  :(
        209060 by: Your Name

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 ---
N Deepak wrote:
>   Is there a way to invoke C functions in a library (.so) from PHP?
>   Like Xs in Perl?

Yes.

EVERYTHING in PHP, except for the core syntax of if/else/while can be
loaded this way.

Many times, it's compiled in static, but you can make most of the modules
be shared.

By definition, then, all you have to do is learn how to write a PHP
extension, which Rasmus tells you how to do in a one-hour lecture at any
PHP/Linux/Apache/OpenSource conference you care to name :-)

But rather than spend hundreds to attend a conference, you can access his
talk on this topic at:

http://talks.php.net


-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
David Freedman wrote:
> I am trying my FIRST php file with an attempt to connect
> to my mySql server.
>
> <?php
> // Connecting, selecting database
> $link = mysql_connect('localhost', 'host', 'my_passqword')
>    or die('Could not connect: ' . mysql_error());

Does this print out anything?

Is it more than just 'Could not connect: '?

What does it say?

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
Sounds to me like you need to go out and hire a PHP programmer to go through
your code and get your site back up and running.

Then that same person can give someone in your organization some tutorials
on how to maintain your code so that this sort of thing does not continue to
happen. 

<?php
/*

Stephen Johnson c|eh
The Lone Coder

http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?>

> From: "Matt M." <[EMAIL PROTECTED]>
> Reply-To: "Matt M." <[EMAIL PROTECTED]>
> Date: Fri, 18 Feb 2005 11:18:23 -0600
> To: "George A. Balanos" <[EMAIL PROTECTED]>, PHP general
> <[email protected]>
> Subject: Re: [PHP] FATAL: emalloc()
> 
> On Fri, 18 Feb 2005 12:10:32 -0500 (GMT-05:00), George A. Balanos
> <[EMAIL PROTECTED]> wrote:
>> Thank you Matt, I found that also but to be honest the person who built this
>> server recently passed away.  He was our php specialist and to be honest I
>> have no clue on how to activate this change.  I have someone that knows Linux
>> but after that we have no idea how to go about this change, can you point me
>> in the right direction where I can learn to do this change or if you know a
>> good write up on how to execute this?
> 
> 
> 
> reply to the whole list.  You get more answers that way
> usually you would execute it something like this
> odbc_exec ( $db, 'set textsize 9999;');
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
Anyone know of any PHP based Excel Reader code that handles the
proprietary Microsoft 'hyperlink' field?

I found and tried two options already but neither handle the 'hyperlink' field:

http://www.zakkis.ca/products/index.php?s=1&p=32

http://sourceforge.net/projects/phpexcelreader/


TIA

-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

--- End Message ---
--- Begin Message ---
Sebastian wrote:
> Hello,
> im working on an article system and looking to avoid running three
> queries.
> example, i have this query:
>
> SELECT id,title FROM articles WHERE id=$_GET[id]
>
> now say $_GET[id] = 5
>
> I would like to get the previous id 4 and the next id 6 (if there is one)
> so i can do something like:

You really shouldn't rely on an auto_increment 'id' field for your
prev/next article linking...  Particularly as you might need to delete
articles some day.

Better to have an explicit "rank" you can set so you can organize your
articles in the order you like.

Or to have a "whatdate" time-stamp to organize them by the date they were
published.

Or... anything EXCEPT relying on consequtive auto_increment 'id's

> << Previous Article [Title]
> Next Article [Ttitle] >>
>
> i would assume this is impossible without running mulitple queries? just
> thought i'd ask in case i am wrong. i am using mysql 4x

I would just go ahead and run the 3 queries.

If you have designed your database properly, they will not be that much
more expensive than your single query, because it's a very simple query
and you only run the 3 queries once on a page.

Benchmark it and see -- You're probably worrying about micro-seconds when
you shouldn't.

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
Chris wrote:
> Hi, I've been trying to get these 2 compiled together for a while, and
> have had no luck.
>
> WHere my problem lies, I think, is that I'm not sure what directory
> should be specified on the --with-mysql part

Here's the deal:

"configure" needs to find *BOTH* 'mysql.h' files and
'mysql.so'/'mysql.lib' files *UNDER* the directory you feed it.

Figure out where your mysql.h files are.
Figure out where your mysql.lib/mysql.so files are.

Whatever directory structure they have in common, that's what you want.

In your case, since you were trying to use '/usr/include/mysql' I'm
betting that your mysql.lib and mysql.so are in '/usr/lib/mysql'

Which means that the only part in common those two directories have is
'/usr' and *THAT* is what you should use.

Again -- 'configure' has to start at the directory you feed it, and it has
to walk down the sub-directories, and it has to find both the 'mysql.h'
files and the 'mysql.lib/mysql.so' files.

Hope that helps.

PS This is true of all the extensions, and other configure scripts in
general.

PPS After you do a "make install" do an "ldconfig" if you are on a system
that uses "ldconfig" -- "man ldconfig" will tell you more, including show
you a 'verbose' option so you can confirm your software really really got
installed.

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
Chris wrote:


./configure --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr --with-mysql-include-dir=/usr/include/mysql --with-mysql-lib-dir=/usr/lib/mysql --with-mysqli=/usr/bin/mysql_config

it might work. I've managed to stave of the need for the mysql extension for a week or two, but I have a good feeling about that one, and am hopeful it will work. I'll probably end up trying that one this weekend.

It didn't work. :(
--- End Message ---
--- Begin Message ---
Richard Lynch wrote:

Here's the deal:

"configure" needs to find *BOTH* 'mysql.h' files and
'mysql.so'/'mysql.lib' files *UNDER* the directory you feed it.

Figure out where your mysql.h files are.
Figure out where your mysql.lib/mysql.so files are.
.



Thanks for the response, in fact I can't find any mysql.lib files, and the only mysql.so I found is under perl directory.

I had tried /usr as the argument to --with-mysql , but it made no obvious change.

I'm including  some file paths that seem like the could be important below.

Thanks,
Chris

[The only mysql.so that locate could find]
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/auto/DBD/mysql/mysql.so

[EMAIL PROTECTED] php]# rpm -q --filesbypkg MySQL-devel
MySQL-devel /usr/bin/comp_err
MySQL-devel /usr/bin/mysql_config
MySQL-devel /usr/include/mysql
MySQL-devel /usr/include/mysql/chardefs.h
MySQL-devel /usr/include/mysql/errmsg.h
MySQL-devel /usr/include/mysql/history.h
MySQL-devel /usr/include/mysql/keycache.h
MySQL-devel /usr/include/mysql/keymaps.h
MySQL-devel /usr/include/mysql/m_ctype.h
MySQL-devel /usr/include/mysql/m_string.h
MySQL-devel /usr/include/mysql/my_alloc.h
MySQL-devel /usr/include/mysql/my_config.h
MySQL-devel /usr/include/mysql/my_dbug.h
MySQL-devel /usr/include/mysql/my_dir.h
MySQL-devel /usr/include/mysql/my_getopt.h
MySQL-devel /usr/include/mysql/my_global.h
MySQL-devel /usr/include/mysql/my_list.h
MySQL-devel /usr/include/mysql/my_net.h
MySQL-devel /usr/include/mysql/my_no_pthread.h
MySQL-devel /usr/include/mysql/my_pthread.h
MySQL-devel /usr/include/mysql/my_semaphore.h
MySQL-devel /usr/include/mysql/my_sys.h
MySQL-devel /usr/include/mysql/my_xml.h
MySQL-devel /usr/include/mysql/mysql.h
MySQL-devel /usr/include/mysql/mysql_com.h
MySQL-devel /usr/include/mysql/mysql_embed.h
MySQL-devel /usr/include/mysql/mysql_time.h
MySQL-devel /usr/include/mysql/mysql_version.h
MySQL-devel /usr/include/mysql/mysqld_error.h
MySQL-devel /usr/include/mysql/raid.h
MySQL-devel /usr/include/mysql/readline.h
MySQL-devel /usr/include/mysql/rlmbutil.h
MySQL-devel /usr/include/mysql/rlprivate.h
MySQL-devel /usr/include/mysql/rlshell.h
MySQL-devel /usr/include/mysql/rltypedefs.h
MySQL-devel /usr/include/mysql/sql_common.h
MySQL-devel /usr/include/mysql/sql_state.h
MySQL-devel /usr/include/mysql/sslopt-case.h
MySQL-devel /usr/include/mysql/sslopt-longopts.h
MySQL-devel /usr/include/mysql/sslopt-vars.h
MySQL-devel /usr/include/mysql/tilde.h
MySQL-devel /usr/include/mysql/typelib.h
MySQL-devel /usr/include/mysql/xmalloc.h
MySQL-devel /usr/lib/mysql
MySQL-devel /usr/lib/mysql/libdbug.a
MySQL-devel /usr/lib/mysql/libheap.a
MySQL-devel /usr/lib/mysql/libmerge.a
MySQL-devel /usr/lib/mysql/libmygcc.a
MySQL-devel /usr/lib/mysql/libmyisam.a
MySQL-devel /usr/lib/mysql/libmyisammrg.a
MySQL-devel /usr/lib/mysql/libmysqlclient.a
MySQL-devel /usr/lib/mysql/libmysqlclient.la
MySQL-devel /usr/lib/mysql/libmysqlclient_r.a
MySQL-devel /usr/lib/mysql/libmysqlclient_r.la
MySQL-devel /usr/lib/mysql/libmystrings.a
MySQL-devel /usr/lib/mysql/libmysys.a
MySQL-devel /usr/lib/mysql/libnisam.a
MySQL-devel /usr/lib/mysql/libvio.a
MySQL-devel /usr/share/doc/packages/MySQL-devel
MySQL-devel /usr/share/doc/packages/MySQL-devel/EXCEPTIONS-CLIENT
--- End Message ---
--- Begin Message ---
I am developing an application. When the user signs in a Session ID is 
created (for argument sake: 123). I have a sign out page that has the script 
session_destroy() on it. This page directs me to the sign in page. When I 
sign the same or any other user in again I get the same session id (123).

However, when I close the browser window and sign in again as any member, 
the session id changes.

How does this work and how can I ensure that a unique session id is 
allocated to every new user that signs in?

Jacques 

--- End Message ---
--- Begin Message ---
> I am developing an application. When the user signs in a Session ID is
> created (for argument sake: 123). I have a sign out page that has the script
> session_destroy() on it. This page directs me to the sign in page. When I
> sign the same or any other user in again I get the same session id (123).
> 
> However, when I close the browser window and sign in again as any member,
> the session id changes.
> 
> How does this work and how can I ensure that a unique session id is
> allocated to every new user that signs in?


some good reading
http://us2.php.net/session

you could use http://us2.php.net/session_regenerate_id to create new ids

--- End Message ---
--- Begin Message ---
On Thu, 2005-02-17 at 23:21, Jacques wrote:
> How can I determine which users have signed in and are still on-line during 
> the first minute after they have signed in? My sql statement currently 
> reads:
> 
> SELECT * FROM tblusers WHERE usignedin = "yes" AND utimesignedin = (time() - 
> 60)
> 
> Hoe does one indicate seconds in a SQL statement? Can I use the time() 
> function or should I use the now() function rather?
> 
> Thanks
> Jacques 

I almost do not know where to begin.

What database are you using?  The functions you need to be looking at
are going to be executed by the dbms not php.  Look in the dbms docs for
the time functions available.  Are you really interested in users who
logged in exactly 60 seconds ago ( you are using = afterall )?

if course this also depends on what type of data is stored in
utimesignedin if it is a timestamp with the resolution in seconds then
you should be good to go with the
whatever_database_function_returns_the_current_timestamp() - 60 deal.

Bret

--- End Message ---
--- Begin Message ---
I created a new user, and assigned privileges. Then tried to connect to the
server
and was denied access, because of a conflict between the mysql CLIENT
version
and the mysql server code due to the password encryption scheme installed in
version
4.1 of mysql. Running the following line fixed the problem

SET PASSWORD FOR 'my_username'@'my_host' = OLD_PASSWORD(\my_pass');

Thanks

--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
> On W3K you could use this as the run line in
> Scheduled Tasks and probably the same in XP
> although I have not tested this. The same
> components exist in the W2K version although
> may be in different locations/names.
> 
> Run: cmd /c "c:\php\php.exe -q c:\path\to\php\file.php"

This is *very* close to what I use with Windows XP (actually I use this
for file types so that I can right click and run a PHP file on the
command line).

cmd /K "C:\php\php.exe -f %1"

The %1 is a variable that gets replaced.  If you set this up for the
file type then the %1 is the name of the file.

So to apply this knowledge to scheduled tasks, you can do:
cmd /K "C:\php\php.exe -f C:\path\to\your\file.php"

> 
> Start in: C:\path\to\php\file\
> 
> Run as: username/pass with security acess to
> both php.exe and the file.php

Agreed... it is much easier to manage it this way although it is
*possible* to use the command "runas" to execute PHP as a different user.

For help on these commands, just use:
cmd /?
runas /?

> 
> YMMV
> 
> pjn
> 


-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins

Attachment: signature.asc
Description: OpenPGP digital signature


--- End Message ---
--- Begin Message ---
Does anyone know how to force PHP to require all local variables to be declared 
prior to use or if this is even possible?

--- End Message ---
--- Begin Message ---
error_reporting(E_ALL);
Then you will get a notice when you try to read a variable which
doesn't exist.

--- End Message ---
--- Begin Message ---
Thank you very much for that solution however I need something slitely 
different.  This is a CMS for distribution... not everybody that's 
going to use it can go in and edit the config files.  I've heard of a 
command called ini_set(); which temporarily changes it just for the 
script.  Would you mind letting me know how to use ini_set(); with the 
use only sessions command?  Thank-you very very much!


> On Wed, 2005-02-16 at 19:07, b1nary Developement Team wrote:
> > Hi there guys... First time caller here ;).
> > 
> > I'm currently developing a content management system.  One of it's 
> > features is that it's going to be completely standards compliant 
(XHTML 
> > 1.1).
> > 
> > I'm having some troubles however, and they come in the form of 
> > sessions.  When I use session_start(), it throws the PHPSESSID 
into the 
> > URL of all of my links and form actions and what not.  This is a 
problem 
> > because in my forms it throws in a hidden input, which doesn't 
validate 
> > right, plus they don't use &amp; insteand of just &.  Is there any 
way 
> > to stop a session from being passed through the URL?
> > 
> 
> Sure enable session.use_only_cookies in php.cfg and cookies will be
> used. nothing in the page sent to the browser at all as far as I 
know.
> 
> http://us4.php.net/session
> 
> Bret
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 

-- 

--- End Message ---

Reply via email to