php-general Digest 22 Feb 2005 10:12:08 -0000 Issue 3300

Topics (messages 209152 through 209163):

Re: Can't load extension (was Re: PHP to C interface?)
        209152 by: Richard Lynch
        209157 by: N Deepak

Re: php request entity body help
        209153 by: Richard Lynch

Re: Is there a way I can read full path names of files on the server and enter 
it into the database ?
        209154 by: Richard Lynch

Re: php temporary files
        209155 by: Marek Kilimajer

Re: The length of midi
        209156 by: Eli

Re: Unable to load extension (was Re: PHP to C interface?)
        209158 by: N Deepak

Sessions and cookies
        209159 by: Jacques
        209160 by: Brett Patterson

Re: Relative URLs
        209161 by: Justin French

Webmail and mime
        209162 by: Emil
        209163 by: Christophe Chisogne

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:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---



N Deepak wrote:
> On Fri, Feb 18, 2005 at 09:20:02AM -0800, Richard Lynch wrote:
>> N Deepak wrote:
>> >   Is there a way to invoke C functions in a library (.so) from PHP?
>> >   Like Xs in Perl?
>>
>> 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 :-)
>>
> I downloaded php-4.3.10 and tried to create a simple extension.  I
> followed instructions exactly as ext_skel told.  I modified config.m4
> only in the PHP_ARG_ENABLE() lines.  I ran buildconf, configure
> --with-foo, make and then ./sapi/cli/php -f ext/foo/foo.php.

What happened to "make install" ???

You have to "make install" your new .so file to get copied over into your
PHP extensions directory, which from the messages seems to be
/usr/local/lib/php/extensions/no-debug-non-zts-20020429/ on your system...

I'm betting you have an 'ext/foo.so' file, but it's not installed yet.

>
> To get this error:
>
> [EMAIL PROTECTED] php-4.3.10]$ ./sapi/cli/php -f ext/foo/nscli.php
>
> Warning: dl(): Unable to load dynamic library
> '/usr/local/lib/php/extensions/no-debug-non-zts-20020429/foo.so' -
> /usr/local/lib/php/extensions/no-debug-non-zts-20020429/foo.so: cannot
> open shared object file: No such file or directory in
> /home/deep/php-4.3.10/ext/foo/nscli.php on line 3
> Functions available in the test extension:<br>
>
> Warning: Invalid argument supplied for foreach() in
> /home/deep/php-4.3.10/ext/foo/nscli.php on line 8
> <br>
> Module foo is not compiled into PHP
> [EMAIL PROTECTED] php-4.3.10]$
>
> Could someone please help me?

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

--- End Message ---
--- Begin Message ---
On Mon, Feb 21, 2005 at 02:08:28PM -0800, Richard Lynch wrote:
> 
> > I downloaded php-4.3.10 and tried to create a simple extension.  I
> > followed instructions exactly as ext_skel told.  I modified config.m4
> > only in the PHP_ARG_ENABLE() lines.  I ran buildconf, configure
> > --with-foo, make and then ./sapi/cli/php -f ext/foo/foo.php.
> 
> What happened to "make install" ???
> 
> You have to "make install" your new .so file to get copied over into your
> PHP extensions directory, which from the messages seems to be
> /usr/local/lib/php/extensions/no-debug-non-zts-20020429/ on your system...
> 
> I'm betting you have an 'ext/foo.so' file, but it's not installed yet.
> 
No, there's none!

[EMAIL PROTECTED] ext]$ pwd
/home/deep/php-4.3.10/ext
[EMAIL PROTECTED] ext]$ find . -name "*.so"
[EMAIL PROTECTED] ext]$

I gave this find after saying './buildconf --force', './configure
--with-nscli', 'make'.

(Which is what the ext_skel script asked me to do, after editing
config.m4)

Thanks for all the help, I think I'm still not done, however.

Regards,
Deepak

> > To get this error:
> >
> > [EMAIL PROTECTED] php-4.3.10]$ ./sapi/cli/php -f ext/foo/nscli.php
> >
> > Warning: dl(): Unable to load dynamic library
> > '/usr/local/lib/php/extensions/no-debug-non-zts-20020429/foo.so' -
> > /usr/local/lib/php/extensions/no-debug-non-zts-20020429/foo.so: cannot
> > open shared object file: No such file or directory in
> > /home/deep/php-4.3.10/ext/foo/nscli.php on line 3
> > Functions available in the test extension:<br>
> >
> > Warning: Invalid argument supplied for foreach() in
> > /home/deep/php-4.3.10/ext/foo/nscli.php on line 8
> > <br>
> > Module foo is not compiled into PHP
> > [EMAIL PROTECTED] php-4.3.10]$
> >

-- 
N Deepak || http://www.ndeepak.info/

--- End Message ---
--- Begin Message ---
Å£À¤ wrote:
> I'm trying to get the entity body part from an http request. Is there an
> API which can do the job?
> We use post to communicate. But I don't the name of post.

Search the http://php.net/ site for "HTTP_RAW_POST_DATA"

I think that will have what you want.

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

--- End Message ---
--- Begin Message ---
Vaibhav Sibal wrote:
> I wanted to ask whether there is a way whereby a script can read
> filenames from a particular directory on the server and enter those
> filenames with the complete path into the MySQL database? I am trying
> to do this, because I am developing an application where a supervisor
> will be distributing files to different users, and those users are to
> work on the files allocated to them by the supervisor. There is a big
> pool of files containing around 10k-15k files and the supervisor will
> be instructed to allocate around 200 files to a user each day, and the
> user should be able to open that file and work on it. I am using a
> Linux Fedora core 2 server running Apache 2.0.53 and PHP 5.0.3 and
> MySQL, and my clients are Windows clients. So I wanted to ask all of
> you people what would be a better approach to do this, the following
> are the 2 options :

I hope the work load for a single file is rather low -- 200 files to edit
seems like an awful lot...

> (1)As soon as the supervisor selects say around 200 files for a user
> called robert, 200 files from the file pool automatically get copied
> to the home directory of robert. While they are copied to the home
> directory of Robert, the name of each file with their complete path
> name gets logged onto the database. Now I am doing since because I
> need to know where each file went and what user is working on what
> file.  Now since robert is working on a client running on windows, we
> can map a drive of windows onto the home directory of robert. In this
> scenario can we instruct PHP to open files from a local directory
> (i.e. the mapped directory of windows)? Because I need to, somehow,
> log when a user opened the file and when he closed it.

I would avoid this route -- Mainly because to give PHP permission to copy
files onto Robert's computer will open up some pretty major security holes
in every single desktop machine.

> (2) The second scenario is that, I just enter the name of the files
> allocated to a user alongwith the complete pathnames to a database and
> I have another column this time where I store the user's name. Now
> whenever the user logs into our system using his username and
> password, and checks to see his work, he sees a list of files on the
> browser itself, but now we will have to convert this list of files
> into links so that the user can click on the links and directly open
> the file in the required software from the server itself. The issue,
> again, in this kind of design is that how do i open the file in the
> required software and even if i do it then how do i record when the
> user opened the file and when he finished working on it.

This seems perfectly reasonable approach.

Once you have assigned a file to 'robert' in the database, then you can
let 'robert' download the file -- or even a zip file with all 200 files in
it.

The downloaded file will have the correct Windows extension -- or they
will after 'robert' unzips them, and Windows will open the right software,
if 'robert' has it installed and the machine is configured correctly.

If it's not installed or the machine isn't configured correctly, there is
nothing you can do about it from PHP.

Then 'robert' can work on them, and, when they are finished, they can
upload the edited files.

You can track when 'robert' downloaded the files, and when 'robert'
uploaded the files.

If you want to do it one file at a time you could track each and every
download/upload -- but it would be very painful for 'robert' to download
every single file and upload every single file.

Most likely, just knowing that 'robert' downloaded 200 files, took 43
minutes to work on them, and uploaded them again, is plenty of info to
track productivity.

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

--- End Message ---
--- Begin Message --- Péntek Imre wrote:
Hi,

Now I want to see all my temporary php files in /tmp/php.
I made these settings:
[EMAIL PROTECTED]:~# cat /etc/php.ini |grep /tmp/php
upload_tmp_dir =/tmp/php
session.save_path = "/tmp/php"
soap.wsdl_cache_dir="/tmp/php"
[EMAIL PROTECTED]:~# But when I use gzopen() or gzfile() the temporary files are still stored in /tmp/
What other settings should I make?

You need to set enviroment variables $TMPDIR and $TMP. I'm not sure which one of these are used by those functions, but you can safely change both.

--- End Message ---
--- Begin Message ---
Hi,

Bauglir wrote:
Does anybody know how to determine the length (in seconds) of midi melody?

There's a free library I use to fetch useful data on files such office files, audio, video, image, etc.
Look at:
http://www.getid3.org


Hope that helps...
--- End Message ---
--- Begin Message ---
Jason Barnett wrote:
> >
> > Now when I say
> > ../sapi/cli/php -f ext/foo/foo.php
> >
> > I get this error:
> >
> > Warning: dl(): Unable to load dynamic library
>
> Were you actually trying to dl() the library in your PHP code?  If you
> compiled the extension into PHP this shouldn't be necessary.  In fact,
> unless you build an extension to be a DSO you shouldn't be able to use
> dl() with that extension anyways!
>
This is actually my first venture to PHP extensions.  I am trying to
write a simple C function, which prints 'hello world', as a PHP
extension.

I defined a helloworld.proto as:
int helloworld() prints hello, world

executed ext_skel, and followed the remaining steps that it showed
on-screen, including editing config.m4.

> > '/usr/local/lib/php/extensions/no-debug-non-zts-20020429/foo.so' -
> > /usr/local/lib/php/extensions/no-debug-non-zts-20020429/foo.so: cannot
> > open shared object file: No such file or directory in
> > /home/deep/php-4.3.10/ext/foo/foo.php on line 3
> > Functions available in the test extension:<br>
> >
> > Warning: Invalid argument supplied for foreach() in
> > /home/deep/php-4.3.10/ext/foo/foo.php on line 8
> > <br>
> > Module foo is not compiled into PHP
> > [EMAIL PROTECTED] php-4.3.10]$
> >

I'm sorry my previous mail appeared twice - I was confused by a
majordomo reply saying 'Commands not understood'.

Thanks,
Deepak

--
N Deepak || http://www.ndeepak.info/

--- End Message ---
--- Begin Message ---
When a session object is created - where is it store? (Perhaps on the 
application server - IIS or Appatche?) Or on a cookking on a user's 
computer?

To destroy the session object (widht all session vairables inside the 
particluar session object) can I use session_destroy();

What is also the default life span of a session object? and can this 
bechanged?

Reagrds

Jacques 

--- End Message ---
--- Begin Message ---
Well, if you look in your phpinfo() file, you will see a SESSION_TIMEOUT or
SESSION_LENGTH value that is something like 180000... different for each
server.

If you hold all your session values in the array, then you can use
session_destory(); as long as session_start() is previous to that.

I am under the impressions that both Sessions and Cookies are stored on the
user end, but I may be wrong.

~Brett

-----Original Message-----
From: Jacques [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 22, 2005 1:20 AM
To: php-general@lists.php.net
Subject: [PHP] Sessions and cookies

When a session object is created - where is it store? (Perhaps on the 
application server - IIS or Appatche?) Or on a cookking on a user's 
computer?

To destroy the session object (widht all session vairables inside the 
particluar session object) can I use session_destroy();

What is also the default life span of a session object? and can this 
bechanged?

Reagrds

Jacques 

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

--- End Message ---
--- Begin Message ---
Pedro,

Something has got to give somewhere. You can't have all those requirements without some sort of trade off -- especially if you're dealing with some sort of CMS or with content entered by some non-technical writers. The common solution is to use PHP to write the links for you in some way, using a globally available constant or variable that holds a path prefix, and specifying all paths as absolute URLs relative to that path.

<?php
$prefix = '/foo';
echo "<a href='{$prefix}/to/somewhere.html'>link</a>"
?>
The above example outputs <a href='/foo/to/somewhere.html'>link</a>

<?php
$prefix = '';
echo "<a href='{$prefix}/to/somewhere.html'>link</a>"
?>
But this just outputs <a href='/to/somewhere.html'>link</a>

In the context of HTML the link might look like this:
<a href="<?=$prefix?>/to/somewhere.html">link</a>


And if all that seems too awkward, you could write a helper function which writes the links for you, eg:


<?
function link($text,$uri) {
  global $prefix;
  return "<a href='{$prefix}/{$uri}'>{$text}</a>";
  }
$prefix = "/path";
?>
and then do this:
<?= link("click here","/to/something.html") ?>

Obviously the function could be extended to check for #fragments, but without a doubt, the only safe way to write good URLs is to specify a full path for everything except #fragments. Then if you need the ability to move the site into directory, then specify a path prefix which gets used when needed.

Passing the entire HTMl page through a URL parser/modifier would be another option, but I'd be staying well clear of that.

I could go on for hours and provide plenty of reasons, and better examples, but you need to do some of it yourself :) And if your answer is "I only want to use plain HTML for the links, but still want to be able to move my site into directories", then I'm afraid no one can really help you, sorry.


Justin



On 22/02/2005, at 2:18 AM, Pedro Fayolle wrote:

Hi,

I wanted to gather opinions on what method is best for dealing with
relative URLs (i.e. in HTML links) on complex, multi-level directory
structures.

Here's what I have so far...

Goals:

1. Simpliest possible management of relative URLs.
2. Be able to move the entire site from one directory to another
without breaking links.
3. Be friendly with clean URL methods, such as using special query
strings like "server.com/index.php/products/item/10".

Methods:

Using static absolute URLs ("/absolute/path/") should of course be
considered obsolete as it doesn't comply with goal #2.

One possible method I tend to use is to transform all relative paths
into absolute with PHP before sending the document. This is a very
efficient but rather annoying method to work with, as most URLs need
to be pre-processed.

Another, generally cleaner method is to use the HTML base tag, which
allows one to define a base path for every relative URL found in the
document. This is however a nuisance whenever you need to link back to
the current document, such as with a regular relative query string
("?search=XX") or with a fragment link ("#section"), as the browser
would make them relative to the base path, forcing one to use the long
absolute URL each time.

Please tell me which you generally think is better and why, and if you
know any other method I could've missed.

Thanks,

Pedro Fayolle

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


---
Justin French, Indent.com.au
[EMAIL PROTECTED]
Web Application Development & Graphic Design

--- End Message ---
--- Begin Message ---
Hi

I'm creating a webmail interface for a pop3-server (I know weird to do webmail with pop3, but it's for a running server which I can't control. So pop3 it is and caching the mails in a mysql database). I've implemented the pop3-support myself since the one in www.php.net/imap lacks a lot of basic pop3 features like uidl support.

Anyway I've hit a wall trying to add support for receiving attachments. I'm not sure how to handle it. The imap_fetchstructure call doesn't seem to be useful for me, since I can't send it text but only an imapstream. I tried the pear projects mimeDecode class and it worked fine. But the only thing it returns was the structure (like it will return an array with info like one mime part plain text, one part image, etc.) and not the content. I don't get the actual text and the actual image.

Any ideas of how I can get the content split up in neat pieces? I've probably just missed something obvious in www.php.net/imap or the pear mail classes. Because I guess there are a function that does this.

I need this running noooow. So I'm sort of desperate. If you have any ideas at all please please speak.

Thanks.

Regards Emil
--- End Message ---
--- Begin Message --- Emil a écrit :
I'm creating a webmail interface for a pop3-server

Why not use one of the many webmail apps?

Ex written in PHP/Perl, with no particular order:

Neomail
http://neocodesolutions.com/software/neomail/

Openwebmail
http://openwebmail.org/

IMP (horde)
http://horde.org/imp/

IlohaMail
http://ilohamail.org/

SquirrelMail
http://www.squirrelmail.org/

Ch.
--- End Message ---

Reply via email to