php-general Digest 1 Apr 2010 15:00:23 -0000 Issue 6670

Topics (messages 303714 through 303725):

Re: Still searching for a bugtracking system
        303714 by: Jan G.B.

image upload keeps file name ?
        303715 by: Matthew Croud
        303716 by: Ashley Sheridan
        303717 by: Midhun Girish

How to know which PHP is used by Apache
        303718 by: Devendra Jadhav
        303719 by: Ashley Sheridan
        303720 by: Devendra Jadhav
        303721 by: Richard
        303722 by: Nilesh Govindarajan
        303723 by: Teus Benschop
        303724 by: Devendra Jadhav
        303725 by: Devendra Jadhav

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
2010/3/30 Andre Polykanine <an...@oire.org>:
> Hello Jan,
>
> And what do you use then?)
>

Sadly, I'm bound to use what I dislike. Mantis. ;)
It's not my decision and in our business model there's no major
benefit in switching the software, at this point.
I can live with it.

Regards

> --
> With best regards from Ukraine,
> Andre
> Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
> jabber.org
> Yahoo! messenger: andre.polykanine; ICQ: 191749952
> Twitter: m_elensule
>
> ----- Original message -----
> From: Jan G.B. <ro0ot.w...@googlemail.com>
> To: Alex Major <p...@allydm.co.uk>
> Date: Tuesday, March 30, 2010, 6:04:20 PM
> Subject: [PHP] Still searching for a bugtracking system
>
> 2010/3/30 Alex Major <p...@allydm.co.uk>
>>
>> Surely if it's not suitable for your situation, it's not the best? :)
>>
>> Mantis is what I'd recommend and believe has already been recommend to you.
>> Runs using PHP and MySQL, it's flexible for public or private projects,
>> multiple projects etc.
>>
>> I do agree with you that Bugzilla seems heavy, I know it has its supporters
>> but I've always found it to be overkill for the projects I've worked on.
>>
>> Alex.
>>
>> -----Original Message-----
>> From: Andre Polykanine [mailto:an...@oire.org]
>> Sent: 30 March 2010 14:14
>> To: php-gene...@lists.php.net
>> Subject: [PHP] Still searching for a bugtracking system
>>
>> Hello everyone,
>> The best of all suggested bugtrackers is JotBug, on my opinion. But it
>> works only with SQLite databases, and I have no access to such one
>> (only MySql).
>> Any solutions?
>> P.S. I'd use Trac, but since I have no own server yet, we have no
>> access to Python, either... Only Php, MySql, Perl.
>> I have looked at Bugzilla... seems to heavy for our service).
>>
>> -
>
> Well. I'm not a fan of mantis. Mantis has some annoying bugs and the
> codebase seems weird.
> It basically works, but that is all about it.
>
>
> I quote http://sqlite.org/about.html :
>
>> SQLite is a software library that implements 
>>a self-contained,serverless, zero-configuration, transactional SQL database 
>>engine.
> ...
>> Unlike most other SQL databases, SQLite does not have a separate server 
>> process. SQLite reads and writes directly to ordinary disk files. A complete 
>> SQL database with multiple tables, indices, triggers, and views, is 
>> contained in a single disk file.
>
> So you don't need "access" to such a database.
>
>
> Regards
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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

Can someone confirm for me that the code below will move an uploaded file and give it the same name as the original image file name ?


$file_dir = "/home/uploads";
foreach($_FILES as $file_name => $file_array) {
        echo "path: ".$file_array["tmp_name"]."<br/>\n";
        echo "name: ".$file_array["name"]."<br/>\n";
        echo "type: ".$file_array["type"]."<br/>\n";
        echo "size: ".$file_array["size"]."<br/>\n";
        
        $UploadName[$num] = $file_array["name"];
    $num++;

        if (is_uploaded_file($file_array["tmp_name"])) {
move_uploaded_file($file_array["tmp_name"], "$file_dir/". $file_array["name"]) or die ("Couldn't copy");
                echo "file was moved!<br/>";
        }
}



Many thanks,





--- End Message ---
--- Begin Message ---
On Thu, 2010-04-01 at 10:51 +0100, Matthew Croud wrote:

> Hi Guys,
> 
> Can someone confirm for me that the code below will move an uploaded  
> file and give it the same name as the original image file name ?
> 
> 
> $file_dir = "/home/uploads";
> foreach($_FILES as $file_name => $file_array) {
>       echo "path: ".$file_array["tmp_name"]."<br/>\n";
>       echo "name: ".$file_array["name"]."<br/>\n";
>       echo "type: ".$file_array["type"]."<br/>\n";
>       echo "size: ".$file_array["size"]."<br/>\n";
>       
>       $UploadName[$num] = $file_array["name"];
>      $num++;
> 
>       if (is_uploaded_file($file_array["tmp_name"])) {
>               move_uploaded_file($file_array["tmp_name"], "$file_dir/". 
> $file_array["name"]) or die ("Couldn't copy");
>               echo "file was moved!<br/>";
>       }
> }
> 
> 
> 
> Many thanks,
> 
> 
> 
> 
> 


Yes, the original filename comes from the ["name"] array element.
However, if someone is uploading a filename with the same name as one
that already exists, you will be overwriting it.

For peace of mind, I've always found it best to save the file using the
tmp_name given to it by PHP, and store this against the original
filename in a database. You can then use PHP to deliver the file back to
the user when it's needed as either a download or something displayed in
the browser. This works nicely with storing files outside of the web
root, which will prevent people from maliciously uploading files to
attempt to break your server and/or app.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
  I use the follwing function for moving files:


public function moveFile($file,$targetdir="../uploads/images/")
  {
        $fileName = $file['name'];
        $ext = substr($fileName, strrpos($fileName, '.') + 1);
        do
        {

$targetfilename=md5(date("m.d.y.h.i.s").basename($fileName)).'.'.$ext;
          $fullname=$targetdir.$targetfilename;
        }while(file_exists($fullname));
        move_uploaded_file($file["tmp_name"],$fullname);
        return $fullname;
  }


Call the fn as :

foreach($_FILES as $file_name => $filearray)
{
if( $filearray['error']=='')
{
   $filenametobestored=moveFile($filearray);
   /*Enter name into db here*/
}
}


this will make sure you never over write anyfiles..


Midhun Girish

On Thu, Apr 1, 2010 at 3:25 PM, Ashley Sheridan 
<a...@ashleysheridan.co.uk>wrote:

> of the web
> root, which will prevent people from maliciously uploadi
>

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

In the situation if there are two PHP's installed on the Linux box.
How to know which PHP is used by Apache?

Another question is do Apache need PHP's binary to execute PHP Scripts? If
yes what is the role of libphp5.so in Apache?

Note: PHP is configured as module under Apache.

Appreciate your thoughts.

-- 
Devendra Jadhav
देवेंद्र जाधव

--- End Message ---
--- Begin Message ---
On Thu, 2010-04-01 at 19:00 +0530, Devendra Jadhav wrote:

> Hi All,
> 
> In the situation if there are two PHP's installed on the Linux box.
> How to know which PHP is used by Apache?
> 
> Another question is do Apache need PHP's binary to execute PHP Scripts? If
> yes what is the role of libphp5.so in Apache?
> 
> Note: PHP is configured as module under Apache.
> 
> Appreciate your thoughts.
> 


The libphp5.so is the Apache module that links PHP into Apache. You need
this and PHP installed if you want to use PHP in Apache.

The module itself indicates what version of PHP Apache will be using.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
On Thu, Apr 1, 2010 at 6:59 PM, Ashley Sheridan 
<a...@ashleysheridan.co.uk>wrote:

>  On Thu, 2010-04-01 at 19:00 +0530, Devendra Jadhav wrote:
>
> Hi All,
>
> In the situation if there are two PHP's installed on the Linux box.
> How to know which PHP is used by Apache?
>
> Another question is do Apache need PHP's binary to execute PHP Scripts? If
> yes what is the role of libphp5.so in Apache?
>
> Note: PHP is configured as module under Apache.
>
> Appreciate your thoughts.
>
>
>
> The libphp5.so is the Apache module that links PHP into Apache. You need
> this and PHP installed if you want to use PHP in Apache.
>
> The module itself indicates what version of PHP Apache will be using.
>
>   Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
With my case both installation of PHP has version 5.x, so how to know which
PHP is being used?

-- 
Devendra Jadhav
देवेंद्र जाधव

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

> In the situation if there are two PHP's installed on the Linux box.
> How to know which PHP is used by Apache?
>
> Another question is do Apache need PHP's binary to execute PHP Scripts? If
> yes what is the role of libphp5.so in Apache?
>
> Note: PHP is configured as module under Apache.

This may help:

<?php
    phpinfo();
?>

-- 
Richard Heyes
HTML5 canvas graphing: RGraph - http://www.rgraph.net (updated 20th March)
Lots of PHP and Javascript code - http://www.phpguru.org

--- End Message ---
--- Begin Message ---
On 04/01/10 19:00, Devendra Jadhav wrote:
Hi All,

In the situation if there are two PHP's installed on the Linux box.
How to know which PHP is used by Apache?

Another question is do Apache need PHP's binary to execute PHP Scripts? If
yes what is the role of libphp5.so in Apache?

Note: PHP is configured as module under Apache.

Appreciate your thoughts.


First of all, libphp5.so is created during the php compilation process. So it will use version of php with which it was compiled.

Also, I don't think php's binary is needed for execution of php scripts is needed.

--
Nilesh Govindarajan
Site & Server Administrator
www.itech7.com
मेरा भारत महान !
मम भारत: महत्तम भवतु !

--- End Message ---
--- Begin Message ---
On Thu, 2010-04-01 at 19:07 +0530, Devendra Jadhav wrote:
> With my case both installation of PHP has version 5.x, so how to know which
> PHP is being used?
> 
Running this page through Apache could do it:

<?php
phpinfo ();
?>

Teus.


--- End Message ---
--- Begin Message ---
On Thu, Apr 1, 2010 at 7:13 PM, Teus Benschop <teusjanne...@gmail.com>wrote:

> On Thu, 2010-04-01 at 19:07 +0530, Devendra Jadhav wrote:
> > With my case both installation of PHP has version 5.x, so how to know
> which
> > PHP is being used?
> >
> Running this page through Apache could do it:
>
> <?php
> phpinfo ();
> ?>
>
> Teus.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
I am still confused. As per Nilesh php's binary is not required and as per
Ashley it is required.
Which one is correct?
And I am not able to find which php's binary is used by using phpinfo().



-- 
Devendra Jadhav
देवेंद्र जाधव

--- End Message ---
--- Begin Message ---
On Thu, Apr 1, 2010 at 7:22 PM, Devendra Jadhav <devendra...@gmail.com>wrote:

> On Thu, Apr 1, 2010 at 7:13 PM, Teus Benschop <teusjanne...@gmail.com>wrote:
>
>> On Thu, 2010-04-01 at 19:07 +0530, Devendra Jadhav wrote:
>> > With my case both installation of PHP has version 5.x, so how to know
>> which
>> > PHP is being used?
>> >
>> Running this page through Apache could do it:
>>
>> <?php
>> phpinfo ();
>> ?>
>>
>> Teus.
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> I am still confused. As per Nilesh php's binary is not required and as per
> Ashley it is required.
> Which one is correct?
> And I am not able to find which php's binary is used by using phpinfo().
>
>
>
>
> --
> Devendra Jadhav
> देवेंद्र जाधव
>

Anyone confident about either of the two answers?


-- 
Devendra Jadhav
देवेंद्र जाधव

--- End Message ---

Reply via email to