php-general Digest 10 May 2008 13:36:13 -0000 Issue 5451
php-general Digest 10 May 2008 13:36:13 - Issue 5451 Topics (messages 274110 through 274115): Re: unsubscribe 274110 by: Nathan Nobbe 274111 by: tedd 274112 by: Nathan Nobbe Re: xml processing cdata 274113 by: Brady Mitchell Re: [PHP-DB] Re: [PHP] Best practices for using MySQL index 274114 by: Gergely Hodicska A Little Something. 274115 by: tedd 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] -- ---BeginMessage--- On Fri, May 9, 2008 at 2:57 PM, tedd [EMAIL PROTECTED] wrote: At 2:39 PM -0400 5/9/08, Wolf wrote: bobcray [EMAIL PROTECTED] wrote: unsubscribe http://www.php.net and unsubscribe yourself. Yeah, I got that sent to me as well. It's interesting when people are smart enough to subscribe, but dummy-up when exiting. Do you think this list saps intelligence? im getting dumber by the day :O -nathan ---End Message--- ---BeginMessage--- At 3:45 PM -0600 5/9/08, Nathan Nobbe wrote: On Fri, May 9, 2008 at 2:57 PM, tedd mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: It's interesting when people are smart enough to subscribe, but dummy-up when exiting. Do you think this list saps intelligence? im getting dumber by the day :O -nathan Yeah, we've noticed. You've even had to resort to using classes and other strange stuff to program. Clearly signs of mental fatigue. :-) Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com---End Message--- ---BeginMessage--- On Fri, May 9, 2008 at 8:25 PM, tedd [EMAIL PROTECTED] wrote: At 3:45 PM -0600 5/9/08, Nathan Nobbe wrote: On Fri, May 9, 2008 at 2:57 PM, tedd mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: It's interesting when people are smart enough to subscribe, but dummy-up when exiting. Do you think this list saps intelligence? im getting dumber by the day :O -nathan Yeah, we've noticed. You've even had to resort to using classes and other strange stuff to program. Clearly signs of mental fatigue. :-) and i thought oop was all about advances in technology; must be these deadlines wearing on me...:D -nathan ---End Message--- ---BeginMessage--- The last comment on http://php.net/manual/en/function.simplexml-load-string.php is what you need: simplexml_load_string($xmlstring, 'SimpleXMLElement', LIBXML_NOCDATA); Brady On May 9, 2008, at 1250PM, Chris W wrote: I have an xml file with a cdata element like the one below. How would I use the php xml functions to extract that cdata and save it as a pdf file? attach id=2 display-name=207069.pdf file-name=207069.pdf obj- type=1 system=0 ![CDATA[eJysumVQW1/0NtoWK95CcXe3EFxK8QDBCQ5 .. ]] /attach The code I have is this... $in = fopen(test.xml, 'r'); $XMLStr = ''; while (!feof($in)) { $LineNumber++; $XMLStr .= fgets($in); } $XML = simplexml_load_string($XMLStr); foreach($XML-props-attachments-attach as $Attachment){ print_r($Attachment); } The output looks like this... SimpleXMLElement Object ( [EMAIL PROTECTED] = Array ( [id] = 2 [display-name] = 207069.pdf [file-name] = 207069.pdf [obj-type] = 1 [system] = 0 ) ) -- 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 ---End Message--- ---BeginMessage--- Hi! While this is not a MySQL mailing list, I try to give you some hints and keep it short. There is maybe one important thing which should considered: clustered index. If use InnoDB you can think about to not using a surrogate key but a natural one which best support the query which you will use in most cases. An InnoDB table's primary key is a clustered index and querying against it is very fast. Best Regards, Felhő ---End Message--- ---BeginMessage--- 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 ---End Message---
php-general Digest 11 May 2008 04:32:34 -0000 Issue 5452
php-general Digest 11 May 2008 04:32:34 - Issue 5452 Topics (messages 274116 through 274124): Improving development process / help with developer setup 274116 by: robert mena 274117 by: David Otton 274123 by: Gabriel Sosa Month with leading zeros 274118 by: Ron Piggott 274119 by: David Otton 274120 by: David Otton Division [maybe a bug] 274121 by: jo opp Re: unsubscribe 274122 by: Jim Lucas PHP-MYSQL Error: Can't connect to MySQL socket. Can someone help me out please? 274124 by: Rahul 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] -- ---BeginMessage--- 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. ---End Message--- ---BeginMessage--- 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. ---End Message--- ---BeginMessage--- 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
[PHP] Re: [PHP-DB] Re: [PHP] Best practices for using MySQL index
Hi! While this is not a MySQL mailing list, I try to give you some hints and keep it short. There is maybe one important thing which should considered: clustered index. If use InnoDB you can think about to not using a surrogate key but a natural one which best support the query which you will use in most cases. An InnoDB table's primary key is a clustered index and querying against it is very fast. Best Regards, Felhő -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[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
[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.
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] Month with leading zeros
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 -- 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 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 Try this (from memory, untested). for ($i = 1; $i = 12; $i++) { $month = date( 'm', strtotime( 1970-$i-01 )); echo option value=\$i\$month/option; } 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
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
[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
[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
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] 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 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? -- 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] 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 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? -- 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 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
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 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 -- 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]) ?php if(!mysql_connect($host, $dusername, $dbpass)) { die(mysql_error()); } else { die('successful connection established'); } -nathan
[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 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 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 -- 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: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?
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: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
[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?
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
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] 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 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] 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] 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?
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