Re: [PHP] Month with leading zeros
On 5/10/08, Ron Piggott <[EMAIL PROTECTED]> wrote: > I am wanting to change > > echo " > 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 > >$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 "\r\n"; > foreach ($months as $i => $month) > { > echo " > if ( $i == $current_month ) { echo " SELECTED";} > > echo">" . $month . "\r\n"; > } > ?> > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- -Casey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can I make EasyPHP on Windows allow remote connections?
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
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someonehelp me out please?
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
Re: [PHP] Can I make EasyPHP on Windows allow remote connections?
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
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someonehelp me out please?
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
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someonehelp me out please?
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
Re: [PHP] Can I make EasyPHP on Windows allow remote connections?
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
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someonehelp me out please?
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
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someonehelp me out please?
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
Re: [PHP] Can I make EasyPHP on Windows allow remote connections?
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
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someonehelp me out please?
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
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someonehelp me out please?
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
[PHP] Can I make EasyPHP on Windows allow remote connections?
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someonehelp me out please?
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
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someonehelp me out please?
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
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someonehelp me out please?
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
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someonehelp me out please?
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 -u root -p 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[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. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someone help me out please?
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])
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someone help me out please?
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 -u root -p 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someone help me out please?
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 -u root -p > > 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
[PHP] Re: PHP-MYSQL Error: Can't connect to MySQL socket. Can someone helpme out please?
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 -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 -u root -p 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? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Division [maybe a bug]
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP-MYSQL Error: Can't connect to MySQL socket. Can someone help me out please?
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 -u root -p 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? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Improving development process / help with developer setup
I suggest you if you are running live on linux, then developing on linux, could be the same dist or not.. but definitely don't mix OS, because the extensions could fail, etc. one big issue it's the case insensitive in windows. definitely some version control system such as SVN or GIT you can use Hudson for continuous integration and selenium for automatics QA test over browsers again, try to don't mix OS. saludos gabriel On Sat, May 10, 2008 at 1:44 PM, David Otton <[EMAIL PROTECTED]> wrote: > 2008/5/10 robert mena <[EMAIL PROTECTED]>: > >> I am looking for tips regarding improving the development process. I'll >> explain my current setup and please feel free to comment. >> >> My developers all use windows + eclipse PDT, the workspace is hosted (via >> samba) in a Linux server with Apache/PHP/MySQL. I am in the process of >> adopting Unit testing (PHPUnit2) and debug (Xdebug) so I have concerns about >> how to property use this. >> >> For example, in my current setup I'd have to enable SSH so they could run >> the tests from the command line in the development server, but I am not sure >> if I could remotely use Xdebug. > > Your description (specifically, Samba) suggests that you're not using > source control. If you want to go for TDD (I don't know that you do, > but IMO it's a good direction to move in) I would suggest a > three-server setup - dev, staging and live. > > The dev server(s) are where you work. One per developer. Once you're > happy with your code and your tests, you commit your changes to source > control. This is where it gets clever. You can use pre- and > post-commit hooks to run an automated build process that pushes the > changes to a staging server, automatically runs the unit tests, and > accepts/rejects the commits based on the test results. You can even > lint the code, and reject anything that isn't in the house style. > > With larger projects, where an entire publish-and-test on each commit > becomes impractical, you can just run the build process and unit tests > every n hours, and mail out the results. > > Publishing to the live server is simply a matter of running the build > scripts with a different destination. > > On top of all that, run an issue tracker. /Everything/ goes in the > issue tracker, bugs, features, whatever. When you make a commit, that > commit should be closing an issue in the issue tracker (via commit > hooks again). That way you can track each change that's been made back > to its reason. > > All of this is opinion, of course, there's no Right Way. Just take > what's useful to you. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Los sabios buscan la sabiduría; los necios creen haberla encontrado. Gabriel Sosa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: unsubscribe
bobcray wrote: unsubscribe Go to http://www.php.net/mailing-lists.php and do it yourself! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Division [maybe a bug]
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) ¿? Thanks for the help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Month with leading zeros
> for ($i = 1; $i >= 12; $i++) I'm an idiot. for ($i = 1; $i <= 12; $i++) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Month with leading zeros
2008/5/10 Ron Piggott <[EMAIL PROTECTED]>: > I am wanting to change > > echo " > 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 > > $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 "\r\n"; > > foreach (range(1, 12) as $month) > { > echo " > if ( $month == $current_month ) { echo " SELECTED";} > > echo">" . $months[$month] . "\r\n"; > } > ?> > Try this (from memory, untested). for ($i = 1; $i >= 12; $i++) { $month = date( 'm', strtotime( "1970-$i-01" )); echo "$month"; } Or this: printf( "%02d", 5 ); However, please consider replacing numeric identifiers for months with textual ones ('M' rather than 'm'). [01] [Apr] [2008] doesn't cause the confusion that [01] [04] [2008] does. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Month with leading zeros
I am wanting to change echo " '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 "\r\n"; foreach (range(1, 12) as $month) { echo "" . $months[$month] . "\r\n"; } ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Improving development process / help with developer setup
2008/5/10 robert mena <[EMAIL PROTECTED]>: > I am looking for tips regarding improving the development process. I'll > explain my current setup and please feel free to comment. > > My developers all use windows + eclipse PDT, the workspace is hosted (via > samba) in a Linux server with Apache/PHP/MySQL. I am in the process of > adopting Unit testing (PHPUnit2) and debug (Xdebug) so I have concerns about > how to property use this. > > For example, in my current setup I'd have to enable SSH so they could run > the tests from the command line in the development server, but I am not sure > if I could remotely use Xdebug. Your description (specifically, Samba) suggests that you're not using source control. If you want to go for TDD (I don't know that you do, but IMO it's a good direction to move in) I would suggest a three-server setup - dev, staging and live. The dev server(s) are where you work. One per developer. Once you're happy with your code and your tests, you commit your changes to source control. This is where it gets clever. You can use pre- and post-commit hooks to run an automated build process that pushes the changes to a staging server, automatically runs the unit tests, and accepts/rejects the commits based on the test results. You can even lint the code, and reject anything that isn't in the house style. With larger projects, where an entire publish-and-test on each commit becomes impractical, you can just run the build process and unit tests every n hours, and mail out the results. Publishing to the live server is simply a matter of running the build scripts with a different destination. On top of all that, run an issue tracker. /Everything/ goes in the issue tracker, bugs, features, whatever. When you make a commit, that commit should be closing an issue in the issue tracker (via commit hooks again). That way you can track each change that's been made back to its reason. All of this is opinion, of course, there's no Right Way. Just take what's useful to you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Improving development process / help with developer setup
Hi, I am looking for tips regarding improving the development process. I'll explain my current setup and please feel free to comment. My developers all use windows + eclipse PDT, the workspace is hosted (via samba) in a Linux server with Apache/PHP/MySQL. I am in the process of adopting Unit testing (PHPUnit2) and debug (Xdebug) so I have concerns about how to property use this. For example, in my current setup I'd have to enable SSH so they could run the tests from the command line in the development server, but I am not sure if I could remotely use Xdebug. Thanks.
[PHP] A Little Something.
Hi gang: This is what I did this morning: http://webbytedd.com/bb/tribute/ It speaks for itself. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php