php-general Digest 11 May 2008 18:54:07 -0000 Issue 5453

Topics (messages 274125 through 274154):

Re: Division [maybe a bug]
        274125 by: Chris W
        274152 by: jo opp

Re: PHP-MYSQL Error: Can't connect to MySQL socket. Can someone helpme out 
please?
        274126 by: Rahul
        274127 by: Nathan Nobbe
        274128 by: Rahul
        274129 by: Nathan Nobbe
        274131 by: Rahul
        274132 by: Nathan Nobbe
        274133 by: Rahul
        274134 by: Nathan Nobbe
        274136 by: Rahul
        274137 by: Nathan Nobbe
        274139 by: Rahul
        274140 by: Rahul
        274142 by: Nathan Nobbe
        274143 by: Rahul
        274145 by: Nathan Nobbe
        274150 by: Shawn McKenzie
        274151 by: Shawn McKenzie

Safe mode story
        274130 by: admin
        274153 by: Wolf

Can I make EasyPHP on Windows allow remote connections?
        274135 by: Rahul
        274138 by: Nathan Nobbe
        274141 by: Rahul
        274144 by: Nathan Nobbe
        274146 by: Rahul

Re: Month with leading zeros
        274147 by: Casey
        274148 by: Jim Lucas
        274149 by: Jim Lucas

Help with a foreach statement
        274154 by: Ron Piggott

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 ---
jo opp wrote:
Hello!

$var1= 2155243640%31104000;
$var2= 2147309244%31104000;

echo $var1 // Return -24651656
echo $var2 // Return 1133244

$var2 return the correct result, but $var1 is wrong (the correct
result is 9067640)

Probably because the maximum signed 32 bit integer value is
2,147,483,648

if you are dealing with numbers that large, consider using some arbitrary precision math functions that can work with as large of numbers as you need.


http://us3.php.net/manual/en/refs.mathcrypto.math.php



--
Chris W
KE5GIX

"Protect your digital freedom and privacy, eliminate DRM,
learn more at http://www.defectivebydesign.org/what_is_drm";

Ham Radio Repeater Database.
http://hrrdb.com

--- End Message ---
--- Begin Message ---
2008/5/11 Chris W <[EMAIL PROTECTED]>:
> jo opp wrote:
>
> > Hello!
> >
> > $var1= 2155243640%31104000;
> > $var2= 2147309244%31104000;
> >
> > echo $var1 // Return -24651656
> > echo $var2 // Return 1133244
> >
> > $var2 return the correct result, but $var1 is wrong (the correct
> > result is 9067640)
> >
>
>  Probably because the maximum signed 32 bit integer value is
>  2,147,483,648
>

OK, but with bigger numbers works fine again.
Right now I made a function to deal with this issue:

function remainder($dividend,$divisor){
        $remainder= $dividend-(floor($dividend/$divisor)*$divisor);
        return $remainder;
}

What do you think about it?

>  if you are dealing with numbers that large, consider using some arbitrary
> precision math functions that can work with as large of numbers as you need.
>
>
>  http://us3.php.net/manual/en/refs.mathcrypto.math.php
>
>
>
>  --
>  Chris W
>  KE5GIX
>
>  "Protect your digital freedom and privacy, eliminate DRM,
>  learn more at http://www.defectivebydesign.org/what_is_drm";
>
>  Ham Radio Repeater Database.
>  http://hrrdb.com
>

--- End Message ---
--- Begin Message --- By the way it installed MySQL 6 and PHP 5.0.4 and from the console this command does not work:

mysql -u root -p

but only this works:

mysql -h <hostname> -u root -p

I tried doing the same while connecting to the database via php but it does not work.

Rahul wrote:
I am using Fedora Core 4. As I was unable to use PHP or MySQL together, I uninstalled both of them and installed again using the following commands:

yum install mysql

And then

apt-get install php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc curl curl-devel perl-libwww-perl ImageMagick

And then started the mysql server.

I am able to connect to the server from the console my typing

mysql -h <hostname> -u root -p <mypass>

However, when I try to connect to mysql through PHP I get the following errors:

PHP Warning: mysql_query(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /export/home/rahul/may/sample.php on line 5 PHP Warning: mysql_query(): A link to the server could not be established in /export/home/rahul/may/sample.php on line 5 Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

Can someone please help me out?

--- End Message ---
--- Begin Message ---
On Sun, May 11, 2008 at 12:30 AM, Rahul <[EMAIL PROTECTED]> wrote:

> I am using Fedora Core 4. As I was unable to use PHP or MySQL together, I
> uninstalled both of them and installed again using the following commands:
>
> yum install mysql
>
> And then
>
> apt-get install php php-devel php-gd php-imap php-ldap php-mysql php-odbc
> php-pear php-xml php-xmlrpc curl curl-devel perl-libwww-perl ImageMagick
>
> And then started the mysql server.
>
> I am able to connect to the server from the console my typing
>
> mysql -h <hostname> -u root -p <mypass>
>
> However, when I try to connect to mysql through PHP I get the following
> errors:
>
> PHP Warning:  mysql_query(): Can't connect to local MySQL server through
> socket '/var/lib/mysql/mysql.sock' (2) in /export/home/rahul/may/sample.php
> on line 5
> PHP Warning:  mysql_query(): A link to the server could not be established
> in /export/home/rahul/may/sample.php on line 5
> Can't connect to local MySQL server through socket
> '/var/lib/mysql/mysql.sock' (2)
>
> Can someone please help me out?


what is the hostname you are typing at the command line and what is the one
you are using when trying to connect from php?  when using mysql, you will
have to have a separate entry for localhost connections.

-nathan

--- End Message ---
--- Begin Message ---
Thanks a lot for your reply.

I have tried using

$host = "localhost";
$db = "dbname";
$table_main = "tablename";
$dbusername = "root";
$dbpass = "passhere";

mysql_connect($host, $dbusername, $dbpass) or die(mysql_error());

and

$host = "mycomputer.webaddress.com";
$db = "dbname";
$table_main = "tablename";
$dbusername = "root";
$dbpass = "passhere";

mysql_connect($host, $dbusername, $dbpass) or die(mysql_error());

And this mycomputer.webaddress.com works when I use with mysql like this:

mysql -h mycomputer.webaddress.com -u root -p

Thank You

Nathan Nobbe wrote:
On Sun, May 11, 2008 at 12:30 AM, Rahul <[EMAIL PROTECTED]> wrote:

I am using Fedora Core 4. As I was unable to use PHP or MySQL together, I
uninstalled both of them and installed again using the following commands:

yum install mysql

And then

apt-get install php php-devel php-gd php-imap php-ldap php-mysql php-odbc
php-pear php-xml php-xmlrpc curl curl-devel perl-libwww-perl ImageMagick

And then started the mysql server.

I am able to connect to the server from the console my typing

mysql -h <hostname> -u root -p <mypass>

However, when I try to connect to mysql through PHP I get the following
errors:

PHP Warning:  mysql_query(): Can't connect to local MySQL server through
socket '/var/lib/mysql/mysql.sock' (2) in /export/home/rahul/may/sample.php
on line 5
PHP Warning:  mysql_query(): A link to the server could not be established
in /export/home/rahul/may/sample.php on line 5
Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock' (2)

Can someone please help me out?


what is the hostname you are typing at the command line and what is the one
you are using when trying to connect from php?  when using mysql, you will
have to have a separate entry for localhost connections.

-nathan


--- End Message ---
--- Begin Message ---
On Sun, May 11, 2008 at 12:42 AM, Rahul <[EMAIL PROTECTED]> wrote:

> Thanks a lot for your reply.
>
> I have tried using
>
> $host = "localhost";
> $db = "dbname";
> $table_main = "tablename";
> $dbusername = "root";
> $dbpass = "passhere";
>
> mysql_connect($host, $dbusername, $dbpass) or die(mysql_error());
>
> and
>
> $host = "mycomputer.webaddress.com";
> $db = "dbname";
> $table_main = "tablename";
> $dbusername = "root";
> $dbpass = "passhere";
>
> mysql_connect($host, $dbusername, $dbpass) or die(mysql_error());
>
> And this mycomputer.webaddress.com works when I use with mysql like this:
>
> mysql -h mycomputer.webaddress.com -u root -p


so, from above (previous post), it looks like the errors youve shown are
actually coming from mysql_query().  what is the result of this (using
credentials from this post and [mycomputer.webaddress.com])

<?php
if(!mysql_connect($host, $dusername, $dbpass)) {
  die(mysql_error());
} else {
  die('successful connection established');
}

-nathan

--- End Message ---
--- Begin Message ---
I have recorded both the errors by changing the variable:

$host = "mycomputer.webaddress.com"

PHP Warning: mysql_connect(): Lost connection to MySQL server during query in /export/home/rpo219/may/conf_global.php on line 18
Lost connection to MySQL server during query

$host = "localhost"

PHP Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111) in /export/home/rpo219/may/conf_global.php on line 18 Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'

I found something weird for the first time:

I tried looking at the mysql6 data directory and it says the following:

total 28
drwxr-xr-x   3 nfsnobody nfsnobody 4096 May 10 23:57 .
drwxrwxrwx  21 root      root      4096 May  7 14:35 ..
-rw-rw---- 1 nfsnobody nfsnobody 1009 May 10 23:57 mycomputer.webaddress.com.err
drwxr-xr-x   2 nfsnobody nfsnobody 4096 Jan 24 20:07 mysql

And when I try to change the ownership of the directory to mysql by

[EMAIL PROTECTED] chown mysql ./mysql6
chown: changing ownership of `./mysql6': Operation not permitted

Just thought it might be related to the problem

Thanks,
Rahul
Rahul wrote:
Thanks a lot for your reply.

I have tried using

$host = "localhost";
$db = "dbname";
$table_main = "tablename";
$dbusername = "root";
$dbpass = "passhere";

mysql_connect($host, $dbusername, $dbpass) or die(mysql_error());

and

$host = "mycomputer.webaddress.com";
$db = "dbname";
$table_main = "tablename";
$dbusername = "root";
$dbpass = "passhere";

mysql_connect($host, $dbusername, $dbpass) or die(mysql_error());

And this mycomputer.webaddress.com works when I use with mysql like this:

mysql -h mycomputer.webaddress.com -u root -p

Thank You

Nathan Nobbe wrote:
On Sun, May 11, 2008 at 12:30 AM, Rahul <[EMAIL PROTECTED]> wrote:

I am using Fedora Core 4. As I was unable to use PHP or MySQL together, I uninstalled both of them and installed again using the following commands:

yum install mysql

And then

apt-get install php php-devel php-gd php-imap php-ldap php-mysql php-odbc
php-pear php-xml php-xmlrpc curl curl-devel perl-libwww-perl ImageMagick

And then started the mysql server.

I am able to connect to the server from the console my typing

mysql -h <hostname> -u root -p <mypass>

However, when I try to connect to mysql through PHP I get the following
errors:

PHP Warning:  mysql_query(): Can't connect to local MySQL server through
socket '/var/lib/mysql/mysql.sock' (2) in /export/home/rahul/may/sample.php
on line 5
PHP Warning: mysql_query(): A link to the server could not be established
in /export/home/rahul/may/sample.php on line 5
Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock' (2)

Can someone please help me out?


what is the hostname you are typing at the command line and what is the one you are using when trying to connect from php? when using mysql, you will
have to have a separate entry for localhost connections.

-nathan


--- End Message ---
--- Begin Message ---
On Sun, May 11, 2008 at 1:05 AM, Rahul <[EMAIL PROTECTED]> wrote:

> I have recorded both the errors by changing the variable:
>
> $host = "mycomputer.webaddress.com"
>
> PHP Warning:  mysql_connect(): Lost connection to MySQL server during query
> in /export/home/rpo219/may/conf_global.php on line 18
> Lost connection to MySQL server during query


i have seen this before, but i cant recall, specifically what the problem
could be.  i recommend google ;)


> $host = "localhost"
>
> PHP Warning:  mysql_connect(): Can't connect to local MySQL server through
> socket '/var/lib/mysql/mysql.sock' (111) in
> /export/home/rpo219/may/conf_global.php on line 18
> Can't connect to local MySQL server through socket
> '/var/lib/mysql/mysql.sock'
>

i believe this is because the user root, does not have permission to connect
to the datbase from host 'localhost', especially since you said this didnt
work from the command line either.  you will have to add a grant clause to
allow the root user to connect from the localhost.

I found something weird for the first time:
>
> I tried looking at the mysql6 data directory and it says the following:
>
> total 28
> drwxr-xr-x   3 nfsnobody nfsnobody 4096 May 10 23:57 .
> drwxrwxrwx  21 root      root      4096 May  7 14:35 ..
> -rw-rw----   1 nfsnobody nfsnobody 1009 May 10 23:57
> mycomputer.webaddress.com.err
> drwxr-xr-x   2 nfsnobody nfsnobody 4096 Jan 24 20:07 mysql
>

that is likely the way your distribution has designed the permission scheme
for the mysql server.

And when I try to change the ownership of the directory to mysql by
>
> [EMAIL PROTECTED] chown mysql ./mysql6
> chown: changing ownership of `./mysql6': Operation not permitted
>

this is probly because you dont have permission to make the change...  you
could do it via sudo, but i wouldnt recommend it.  your distro has set it up
this way on purpose.


> Just thought it might be related to the problem


have you created any databases after installing mysql?  you should create at
least one, like test db or something, and its good practice to create a
specific user to access the database through as well.  instead of having php
connect as root.  thats like a hackers dream right there.

-nathan

--- End Message ---
--- Begin Message ---
Thanks. I just stopped mysql and when I try to start it again it throws
another set of errors:

chown: changing ownership of `/home-public/mysql6': Operation not permitted

So I guess something is messed up completely. I wish I installed it better.
Now the installing is messed up I guess with all sorts of bad files. I will
try Google now...

Thanks for the help... :)

On Sun, May 11, 2008 at 12:17 AM, Nathan Nobbe <[EMAIL PROTECTED]>
wrote:

> On Sun, May 11, 2008 at 1:05 AM, Rahul <[EMAIL PROTECTED]> wrote:
>
>> I have recorded both the errors by changing the variable:
>>
>> $host = "mycomputer.webaddress.com"
>>
>> PHP Warning:  mysql_connect(): Lost connection to MySQL server during
>> query in /export/home/rpo219/may/conf_global.php on line 18
>> Lost connection to MySQL server during query
>
>
> i have seen this before, but i cant recall, specifically what the problem
> could be.  i recommend google ;)
>
>
>> $host = "localhost"
>>
>> PHP Warning:  mysql_connect(): Can't connect to local MySQL server through
>> socket '/var/lib/mysql/mysql.sock' (111) in
>> /export/home/rpo219/may/conf_global.php on line 18
>> Can't connect to local MySQL server through socket
>> '/var/lib/mysql/mysql.sock'
>>
>
> i believe this is because the user root, does not have permission to
> connect to the datbase from host 'localhost', especially since you said this
> didnt work from the command line either.  you will have to add a grant
> clause to allow the root user to connect from the localhost.
>
> I found something weird for the first time:
>>
>> I tried looking at the mysql6 data directory and it says the following:
>>
>> total 28
>> drwxr-xr-x   3 nfsnobody nfsnobody 4096 May 10 23:57 .
>> drwxrwxrwx  21 root      root      4096 May  7 14:35 ..
>> -rw-rw----   1 nfsnobody nfsnobody 1009 May 10 23:57
>> mycomputer.webaddress.com.err
>> drwxr-xr-x   2 nfsnobody nfsnobody 4096 Jan 24 20:07 mysql
>>
>
> that is likely the way your distribution has designed the permission scheme
> for the mysql server.
>
> And when I try to change the ownership of the directory to mysql by
>>
>> [EMAIL PROTECTED] chown mysql ./mysql6
>> chown: changing ownership of `./mysql6': Operation not permitted
>>
>
> this is probly because you dont have permission to make the change...  you
> could do it via sudo, but i wouldnt recommend it.  your distro has set it up
> this way on purpose.
>
>
>> Just thought it might be related to the problem
>
>
> have you created any databases after installing mysql?  you should create
> at least one, like test db or something, and its good practice to create a
> specific user to access the database through as well.  instead of having php
> connect as root.  thats like a hackers dream right there.
>
> -nathan
>
>


-- 
Rahul
Computer Engineering and Systems Division.
Department of Electrical Engineering and Computer Science
Robert R. McCormick School of Engineering
Northwestern University
2145 Sheridan Road, Evanston,IL60208.

Administrator: The En?gma Project
Website: http://www.enigmaportal.com

--- End Message ---
--- Begin Message ---
On Sun, May 11, 2008 at 1:22 AM, Rahul P <[EMAIL PROTECTED]> wrote:

> Thanks. I just stopped mysql and when I try to start it again it throws
> another set of errors:
>
> chown: changing ownership of `/home-public/mysql6': Operation not permitted
>
> So I guess something is messed up completely. I wish I installed it better.
> Now the installing is messed up I guess with all sorts of bad files. I will
> try Google now...
>
> Thanks for the help... :)
>

one benefit of package managers is that they let you uninstall and reinstall
easily.  are you using yum or apt-get ?  in your first post you included
both the commands..  anyway, id just uninstall and reinstall it; should take
10 minutes or so.

-nathan

--- End Message ---
--- Begin Message ---
Oh... This is the fourth time I'm doing that except that this time yum
installed mysql6 instead of older versions... I don't see any way out other
than reinstalling the OS itself... There are so many dependency failures....
I'm spending more time troubleshooting than actually coding something :)

On Sun, May 11, 2008 at 12:27 AM, Nathan Nobbe <[EMAIL PROTECTED]>
wrote:

> On Sun, May 11, 2008 at 1:22 AM, Rahul P <[EMAIL PROTECTED]> wrote:
>
>> Thanks. I just stopped mysql and when I try to start it again it throws
>> another set of errors:
>>
>> chown: changing ownership of `/home-public/mysql6': Operation not
>> permitted
>>
>> So I guess something is messed up completely. I wish I installed it
>> better. Now the installing is messed up I guess with all sorts of bad files.
>> I will try Google now...
>>
>> Thanks for the help... :)
>>
>
> one benefit of package managers is that they let you uninstall and
> reinstall easily.  are you using yum or apt-get ?  in your first post you
> included both the commands..  anyway, id just uninstall and reinstall it;
> should take 10 minutes or so.
>
> -nathan
>
>


-- 
Rahul
Computer Engineering and Systems Division.
Department of Electrical Engineering and Computer Science
Robert R. McCormick School of Engineering
Northwestern University
2145 Sheridan Road, Evanston,IL60208.

Administrator: The En?gma Project
Website: http://www.enigmaportal.com

--- End Message ---
--- Begin Message ---
On Sun, May 11, 2008 at 1:29 AM, Rahul P <[EMAIL PROTECTED]> wrote:

> Oh... This is the fourth time I'm doing that except that this time yum
> installed mysql6 instead of older versions... I don't see any way out other
> than reinstalling the OS itself... There are so many dependency failures....
> I'm spending more time troubleshooting than actually coding something :)


i dont even think mysql6 is any where near ready for real usage (tho could
be wrong).  can you see if you could put 5 or 5.1 on there instead?  os
reinstall sounds painful =/

-nathan

--- End Message ---
--- Begin Message ---
On Sun, May 11, 2008 at 12:42 AM, Nathan Nobbe <[EMAIL PROTECTED]>
wrote:

> On Sun, May 11, 2008 at 1:29 AM, Rahul P <[EMAIL PROTECTED]> wrote:
>
>> Oh... This is the fourth time I'm doing that except that this time yum
>> installed mysql6 instead of older versions... I don't see any way out other
>> than reinstalling the OS itself... There are so many dependency failures....
>> I'm spending more time troubleshooting than actually coding something :)
>
>
> i dont even think mysql6 is any where near ready for real usage (tho could
> be wrong).  can you see if you could put 5 or 5.1 on there instead?  os
> reinstall sounds painful =/
>
> -nathan
>
>


-- 
Rahul
Computer Engineering and Systems Division.
Department of Electrical Engineering and Computer Science
Robert R. McCormick School of Engineering
Northwestern University
2145 Sheridan Road, Evanston,IL60208.

Administrator: The En?gma Project
Website: http://www.enigmaportal.com

--- End Message ---
--- Begin Message ---
Ok I removed mysql using yum remove mysql. But is there a special way to
tell yum to install that version of mysql?

On Sun, May 11, 2008 at 12:44 AM, Rahul P <[EMAIL PROTECTED]> wrote:

>
>
> On Sun, May 11, 2008 at 12:42 AM, Nathan Nobbe <[EMAIL PROTECTED]>
> wrote:
>
>> On Sun, May 11, 2008 at 1:29 AM, Rahul P <[EMAIL PROTECTED]> wrote:
>>
>>> Oh... This is the fourth time I'm doing that except that this time yum
>>> installed mysql6 instead of older versions... I don't see any way out other
>>> than reinstalling the OS itself... There are so many dependency failures....
>>> I'm spending more time troubleshooting than actually coding something :)
>>
>>
>> i dont even think mysql6 is any where near ready for real usage (tho could
>> be wrong).  can you see if you could put 5 or 5.1 on there instead?  os
>> reinstall sounds painful =/
>>
>> -nathan
>>
>>
>
>
>  --
> Rahul
> Computer Engineering and Systems Division.
> Department of Electrical Engineering and Computer Science
> Robert R. McCormick School of Engineering
> Northwestern University
> 2145 Sheridan Road, Evanston,IL60208.
>
> Administrator: The En?gma Project
> Website: http://www.enigmaportal.com
>



-- 
Rahul
Computer Engineering and Systems Division.
Department of Electrical Engineering and Computer Science
Robert R. McCormick School of Engineering
Northwestern University
2145 Sheridan Road, Evanston,IL60208.

Administrator: The En?gma Project
Website: http://www.enigmaportal.com

--- End Message ---
--- Begin Message ---
On Sun, May 11, 2008 at 1:46 AM, Rahul P <[EMAIL PROTECTED]> wrote:

> Ok I removed mysql using yum remove mysql. But is there a special way to
> tell yum to install that version of mysql?


ahh, this is where google comes in for sure.  it looks like you could
download an older rpm, like from mysql and use 'yum localinstall' or there
is a way to search for older versions that are still in the yum repos.
heres a quick link i found

http://www.fedoraforum.org/forum/showthread.php?t=96684

-nathan

--- End Message ---
--- Begin Message ---
Ok. I apologize for the mix. When I'm mailing someone, I simply don't get
Google into mind. :)

Thanks,
Rahul

On Sun, May 11, 2008 at 12:53 AM, Nathan Nobbe <[EMAIL PROTECTED]>
wrote:

> On Sun, May 11, 2008 at 1:46 AM, Rahul P <[EMAIL PROTECTED]> wrote:
>
>> Ok I removed mysql using yum remove mysql. But is there a special way to
>> tell yum to install that version of mysql?
>
>
> ahh, this is where google comes in for sure.  it looks like you could
> download an older rpm, like from mysql and use 'yum localinstall' or there
> is a way to search for older versions that are still in the yum repos.
> heres a quick link i found
>
> http://www.fedoraforum.org/forum/showthread.php?t=96684
>
> -nathan
>
>


-- 
Rahul
Computer Engineering and Systems Division.
Department of Electrical Engineering and Computer Science
Robert R. McCormick School of Engineering
Northwestern University
2145 Sheridan Road, Evanston,IL60208.

Administrator: The En?gma Project
Website: http://www.enigmaportal.com

--- End Message ---
--- Begin Message ---
On Sun, May 11, 2008 at 1:59 AM, Rahul P <[EMAIL PROTECTED]> wrote:

> Ok. I apologize for the mix. When I'm mailing someone, I simply don't get
> Google into mind. :)
>

no problem, if it were emerge id be much more capable of helping ;)

-nathan

--- End Message ---
--- Begin Message ---
Rahul P wrote:
Ok I removed mysql using yum remove mysql. But is there a special way to
tell yum to install that version of mysql?

On Sun, May 11, 2008 at 12:44 AM, Rahul P <[EMAIL PROTECTED]> wrote:


On Sun, May 11, 2008 at 12:42 AM, Nathan Nobbe <[EMAIL PROTECTED]>
wrote:

On Sun, May 11, 2008 at 1:29 AM, Rahul P <[EMAIL PROTECTED]> wrote:

Oh... This is the fourth time I'm doing that except that this time yum
installed mysql6 instead of older versions... I don't see any way out other
than reinstalling the OS itself... There are so many dependency failures....
I'm spending more time troubleshooting than actually coding something :)

i dont even think mysql6 is any where near ready for real usage (tho could
be wrong).  can you see if you could put 5 or 5.1 on there instead?  os
reinstall sounds painful =/

-nathan



 --
Rahul
Computer Engineering and Systems Division.
Department of Electrical Engineering and Computer Science
Robert R. McCormick School of Engineering
Northwestern University
2145 Sheridan Road, Evanston,IL60208.

Administrator: The En?gma Project
Website: http://www.enigmaportal.com





yum search mysql

Find the one that looks like mysql5 or similar and use that.

-Shawn

--- End Message ---
--- Begin Message ---
Rahul P wrote:
Ok I removed mysql using yum remove mysql. But is there a special way to
tell yum to install that version of mysql?

On Sun, May 11, 2008 at 12:44 AM, Rahul P <[EMAIL PROTECTED]> wrote:


On Sun, May 11, 2008 at 12:42 AM, Nathan Nobbe <[EMAIL PROTECTED]>
wrote:

On Sun, May 11, 2008 at 1:29 AM, Rahul P <[EMAIL PROTECTED]> wrote:

Oh... This is the fourth time I'm doing that except that this time yum
installed mysql6 instead of older versions... I don't see any way out other
than reinstalling the OS itself... There are so many dependency failures....
I'm spending more time troubleshooting than actually coding something :)

i dont even think mysql6 is any where near ready for real usage (tho could
be wrong).  can you see if you could put 5 or 5.1 on there instead?  os
reinstall sounds painful =/

-nathan



 --
Rahul
Computer Engineering and Systems Division.
Department of Electrical Engineering and Computer Science
Robert R. McCormick School of Engineering
Northwestern University
2145 Sheridan Road, Evanston,IL60208.

Administrator: The En?gma Project
Website: http://www.enigmaportal.com





yum search mysql

Find the one that looks like mysql5 or similar and use that.

-Shawn

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

I'm running a Plesk 8.3 mass hosting server equipped with PHP 5.1.6 on CentOS 5, and I'm facing the problem of PHP "Safe mode" barfing at the UID mismatch of PHP scripts uploaded by user's FTP UID, and later executed by Apache UID, where user's PHP scripts thusly uploaded attempt to write any files while doing their job.

Is there an educated solution? What if I relax safe mode checks to gid (safe_mode_gid=On), and given that GID is psacln for every Plesk-hosted customer, with only UIDs being different, is there any risk that folks operating on their own chmod 660 files will be able to overwrite other people's chmod 660 files? Or will open_basedir be enough to prevent unwanted PHP level file access while relaxing safe mode uid check at the same time? (by default, it is properly set by Plesk in %mysite%/conf/httpd.include) ?

BTW, safe_mode_exec_dir is empty by default, does it mean if I do set safe_mode_gid then users will be able to exec other Plesk users' cgi-bin scripts etc. because of GIDs being equal??

Safe mode has _got_ to be there for some good reason.

Thanks in advance for any tips.

--- End Message ---
--- Begin Message ---
You could try having apache run as the UID of the user.  With a few 
modifications to apache site config and you should be golden!

HTH,
Wolf

-----Original Message-----
From: admin <[EMAIL PROTECTED]>
Sent: Sunday, May 11, 2008 1:06 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Safe mode story

Hi all,

I'm running a Plesk 8.3 mass hosting server equipped with PHP 5.1.6 on 
CentOS 5, and I'm facing the problem of PHP "Safe mode" barfing at the 
UID mismatch of PHP scripts uploaded by user's FTP UID, and later 
executed by Apache UID, where user's PHP scripts thusly uploaded attempt 
to write any files while doing their job.

Is there an educated solution? What if I relax safe mode checks to gid 
(safe_mode_gid=On), and given that GID is psacln for every Plesk-hosted 
customer, with only UIDs being different, is there any risk that folks 
operating on their own chmod 660 files will be able to overwrite other 
people's chmod 660 files? Or will open_basedir be enough to prevent 
unwanted PHP level file access while relaxing safe mode uid check at the 
same time? (by default, it is properly set by Plesk in 
%mysite%/conf/httpd.include) ?

BTW, safe_mode_exec_dir is empty by default, does it mean if I do set 
safe_mode_gid then users will be able to exec other Plesk users' cgi-bin 
scripts etc. because of GIDs being equal??

Safe mode has _got_ to be there for some good reason.

Thanks in advance for any tips.

-- 


[The entire original message is not included]


--- End Message ---
--- Begin Message --- I have EasyPHP installed on my Windows system and can connect to the php+mysql using localhost in the browser but I was wondering if I can connect to this computer (which is at my office) from my home. I have a web address alloted to my computer at office.

Thanks,
Rahul

--- End Message ---
--- Begin Message ---
On Sun, May 11, 2008 at 1:25 AM, Rahul <[EMAIL PROTECTED]> wrote:

> I have EasyPHP installed on my Windows system and can connect to the
> php+mysql using localhost in the browser but I was wondering if I can
> connect to this computer (which is at my office) from my home. I have a web
> address alloted to my computer at office.


this is primarily dependent upon firewall restrictions and subnet
configurations at your office.  most places ive worked at have their
internal networks pretty well isolated from the internet, and for good
reason.  probly this question is better for the LAN admin at ur office ;)

-nathan

--- End Message ---
--- Begin Message ---
Well I thought it has something to do with EasyPHP because I'm able to use
Remote Desktop Connection of Windows. Actually I've been using EasyPHP
through RDC but I thought I could use it directly...

On Sun, May 11, 2008 at 12:44 AM, Nathan Nobbe <[EMAIL PROTECTED]>
wrote:

> On Sun, May 11, 2008 at 1:25 AM, Rahul <[EMAIL PROTECTED]> wrote:
>
>> I have EasyPHP installed on my Windows system and can connect to the
>> php+mysql using localhost in the browser but I was wondering if I can
>> connect to this computer (which is at my office) from my home. I have a web
>> address alloted to my computer at office.
>
>
> this is primarily dependent upon firewall restrictions and subnet
> configurations at your office.  most places ive worked at have their
> internal networks pretty well isolated from the internet, and for good
> reason.  probly this question is better for the LAN admin at ur office ;)
>
> -nathan
>



-- 
Rahul
Computer Engineering and Systems Division.
Department of Electrical Engineering and Computer Science
Robert R. McCormick School of Engineering
Northwestern University
2145 Sheridan Road, Evanston,IL60208.

Administrator: The En?gma Project
Website: http://www.enigmaportal.com

--- End Message ---
--- Begin Message ---
On Sun, May 11, 2008 at 1:48 AM, Rahul P <[EMAIL PROTECTED]> wrote:

> Well I thought it has something to do with EasyPHP because I'm able to use
> Remote Desktop Connection of Windows. Actually I've been using EasyPHP
> through RDC but I thought I could use it directly...


rdp has a special port that it runs over.  mysql runs over 3306.  just
because they have the rdp port open doesnt mean they have the mysql one
open.  but again, good question for the lan admin.  i doubt it has anything
to do w/ easyPHP.  when you say you have a 'web address' for your computer
at work, does that mean you can connect to websites hosted on your computer
from the internet (like from home for example [not using rdp])?  if thats
the case then your company also has port 80 open to your system as well,
which still doesnt mean that 3306 is open.  if you want, you can find out
real quick yourself, by using nmap.  just use the hostname for your box at
work and nmap it.  say for example your box has the name mybox.myoffice.com,
then you do

nmap mybox.myoffice.com

if you dont see port 3306 in the list, likely you wont have direct access.
but if you do have access over port 80 (web) you can install mysqlAdmin and
get to it that way.

-nathan

--- End Message ---
--- Begin Message ---
Looks like it is closed... Thanks. I will pay a visit to the Root... You've
been of great help...

Thanks
Rahul

On Sun, May 11, 2008 at 1:00 AM, Nathan Nobbe <[EMAIL PROTECTED]>
wrote:

> On Sun, May 11, 2008 at 1:48 AM, Rahul P <[EMAIL PROTECTED]> wrote:
>
>> Well I thought it has something to do with EasyPHP because I'm able to use
>> Remote Desktop Connection of Windows. Actually I've been using EasyPHP
>> through RDC but I thought I could use it directly...
>
>
> rdp has a special port that it runs over.  mysql runs over 3306.  just
> because they have the rdp port open doesnt mean they have the mysql one
> open.  but again, good question for the lan admin.  i doubt it has anything
> to do w/ easyPHP.  when you say you have a 'web address' for your computer
> at work, does that mean you can connect to websites hosted on your computer
> from the internet (like from home for example [not using rdp])?  if thats
> the case then your company also has port 80 open to your system as well,
> which still doesnt mean that 3306 is open.  if you want, you can find out
> real quick yourself, by using nmap.  just use the hostname for your box at
> work and nmap it.  say for example your box has the name
> mybox.myoffice.com, then you do
>
> nmap mybox.myoffice.com
>
> if you dont see port 3306 in the list, likely you wont have direct access.
> but if you do have access over port 80 (web) you can install mysqlAdmin and
> get to it that way.
>
> -nathan
>



-- 
Rahul
Computer Engineering and Systems Division.
Department of Electrical Engineering and Computer Science
Robert R. McCormick School of Engineering
Northwestern University
2145 Sheridan Road, Evanston,IL60208.

Administrator: The En?gma Project
Website: http://www.enigmaportal.com

--- End Message ---
--- Begin Message ---
On 5/10/08, Ron Piggott <[EMAIL PROTECTED]> wrote:
> I am wanting to change
>
>          echo "<option value=\"" . $months[$month] . "\"";
>
>  to output the month number, between 01 and 12 --- DATE value m, the
>  month with leading 0's.  How do I do this?  $months is an array, as I
>  have shown below.  Ron
>
>  <?php
>  $months = array('1' => 'January', '2' => 'February', '3' => 'March', '4'
>  => 'April', '5' => 'May', '6' => 'June', '7' => 'July', '8' => 'August',
>  '9' => 'September', '10' => 'October', '11' => 'November', '12' =>
>  'December');
>
>  $current_month = DATE("n");
>
>  echo "<SELECT NAME=\"order_received_month\">\r\n";
>
foreach ($months as $i => $month)
>      {
>          echo "<option value=\"" . $month . "\"";
>
>  if ( $i == $current_month ) { echo " SELECTED";}
>
>  echo">" . $month . "</option>\r\n";
>      }
>  ?>
>  </select>
>
>
>
>  --
>  PHP General Mailing List (http://www.php.net/)
>  To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
-Casey

--- End Message ---
--- Begin Message ---
Ron Piggott wrote:
I am wanting to change
         echo "<option value=\"" . $months[$month] . "\"";

to output the month number, between 01 and 12 --- DATE value m, the
month with leading 0's.  How do I do this?  $months is an array, as I
have shown below.  Ron

<?php
$months = array('1' => 'January', '2' => 'February', '3' => 'March', '4'
=> 'April', '5' => 'May', '6' => 'June', '7' => 'July', '8' => 'August',
'9' => 'September', '10' => 'October', '11' => 'November', '12' =>
'December');

$current_month = DATE("n");

echo "<SELECT NAME=\"order_received_month\">\r\n";

foreach (range(1, 12) as $month)
     {
         echo "<option value=\"" . $months[$month] . "\"";

if ( $month == $current_month ) { echo " SELECTED";}

echo">" . $months[$month] . "</option>\r\n";
     }
?>
</select>



Ok, I will show you two different ways to do this.

<?php

$months = array(
  '1' => 'January',
  '2' => 'February',
  '3' => 'March',
  '4' => 'April',
  '5' => 'May',
  '6' => 'June',
  '7' => 'July',
  '8' => 'August',
  '9' => 'September',
  '10' => 'October',
  '11' => 'November',
  '12' => 'December',
);

foreach ( $months AS $i => $month ) {
  $sel = ( $i == date('n') ? ' selected="selected"' : '');
  echo "<option value='{$month}' {$sel}>{$month}</option>\r\n";
}

?>

Personally, I would do something like this.

<?php

$options = array();

for ( $i=1; $i<13; $i++ ) {
  $month = date('F', mktime(0,0,0,$i,2,2000));
  $sel = ( $i == date('n') ? ' selected="selected"' : '');
  $options[] = "<option value='{$month}' {$sel}>{$month}</option>";
}

$options_list = join("\r\n", $options);

echo "<select>{$options_list}</select>";

?>

Now, if you are wanting to display the numerical month with leading zero's, then you would want to look at the 'm' option for date() or str_pad().


something like this might show you what you need.

<?php

# str_pad test
echo str_pad(3, 2, '0', STR_PAD_LEFT)

?>

Hope this helps understand a little more.

Jim

--- End Message ---
--- Begin Message ---
Jim Lucas wrote:
Ron Piggott wrote:
I am wanting to change
         echo "<option value=\"" . $months[$month] . "\"";

to output the month number, between 01 and 12 --- DATE value m, the
month with leading 0's.  How do I do this?  $months is an array, as I
have shown below.  Ron

<?php
$months = array('1' => 'January', '2' => 'February', '3' => 'March', '4'
=> 'April', '5' => 'May', '6' => 'June', '7' => 'July', '8' => 'August',
'9' => 'September', '10' => 'October', '11' => 'November', '12' =>
'December');

$current_month = DATE("n");

echo "<SELECT NAME=\"order_received_month\">\r\n";

foreach (range(1, 12) as $month)
     {
         echo "<option value=\"" . $months[$month] . "\"";

if ( $month == $current_month ) { echo " SELECTED";}

echo">" . $months[$month] . "</option>\r\n";
     }
?>
</select>



Ok, I will show you two different ways to do this.

<?php

$months = array(
  '1' => 'January',
  '2' => 'February',
  '3' => 'March',
  '4' => 'April',
  '5' => 'May',
  '6' => 'June',
  '7' => 'July',
  '8' => 'August',
  '9' => 'September',
  '10' => 'October',
  '11' => 'November',
  '12' => 'December',
);

foreach ( $months AS $i => $month ) {
  $sel = ( $i == date('n') ? ' selected="selected"' : '');
  echo "<option value='{$month}' {$sel}>{$month}</option>\r\n";
}

?>

Personally, I would do something like this.

<?php

$options = array();

for ( $i=1; $i<13; $i++ ) {
  $month = date('F', mktime(0,0,0,$i,2,2000));
  $sel = ( $i == date('n') ? ' selected="selected"' : '');
  $options[] = "<option value='{$month}' {$sel}>{$month}</option>";
}

$options_list = join("\r\n", $options);

echo "<select>{$options_list}</select>";

?>

Now, if you are wanting to display the numerical month with leading zero's, then you would want to look at the 'm' option for date() or str_pad().


something like this might show you what you need.

<?php

# str_pad test
echo str_pad(3, 2, '0', STR_PAD_LEFT)

?>

Hope this helps understand a little more.

Jim


sorry should have included this in the first one.

http://www.cmsws.com/examples/php/testscripts/[EMAIL PROTECTED]/0002.php

--- End Message ---
--- Begin Message ---
I am writing a shopping cart.

Products assigned in the following fashion:
$_SESSION['selection'][$product]=$quantity;

I am wanting to display the list of products in the shopping cart in a
list for the user to see as they continue shopping.

I put the SESSION variable into $cart

$cart = $_SESSION['selection'];

then I start the foreach and this is where I get messed up.  I am trying
to ECHO the following syntax to the screen with each selected product:

The part I need help with is to write the foreach loop to give me
$product (so I may query the database to find out the product name) and
the $quantity (so I may show the user what they are purchasing).  The
part that is messing me up is that this is an array.

My ECHO statement should look like this:

echo "<li><a href=\"" . $path_to_shopping_cart . "product/" .
$cart[$product_id] . "/\">" . $product_name . "</a> - " . $quantity .
"</li>\r\n"; 


--- End Message ---

Reply via email to