Re: [PHP] Classes and Functions
Robert Cummings wrote: On Thu, 2005-11-03 at 12:15, Jasper Bryant-Greene wrote: On Wed, 2005-11-02 at 19:05 -0500, Unknown Unknown wrote: Oh thanks again and what does RTFM mean? Read The [insert your favourite word beginning with F here] Manual. Fondu?? *licks lips* you missed an 'e' at the end, but given your great info yesterday regarding DOM and namespaces, I'll spare you a RTFD(ictionary) ;-) Cheers, Rob. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Issue with curl and ssl
Dan Rossi wrote: Hi there, I am trying to test out the new installed curl extension to connect to a site via ssl and auth basic. However everytime i try to connect with the browser , in ie it says cannot find server and in mac safari is says could not load any data etc. If i run the same script via php cli it works fine and is accepting the ssl certificate we setup on the IIs server we are connecting to. What could be cauasing this, there is no way to get php debug errors because it doesnt let the page load. Its around the curl_exec call. I also found that its causing an issue with apache in the logs * About to connect() to ourserver port 443 * Trying ip... * connected * Connected to ourserver (ip) port 443 * successfully set certificate verify locations: * CAfile: /usr/local/share/curl/curl-ca-bundle.crt CApath: none [Thu Nov 3 02:46:38 2005] [notice] child pid 49681 exit signal Segmentation fault (11) any ideas ? it helps when you tell us what versions of softwar eyou have. are you running apache2? is it running using a threaded worker module? is the curl extension thread safe? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Issue with curl and ssl
Just a standard php 4.3.11 and apache 1.3 ?? It works via php cli wierdly enough but not the apache module ? On 03/11/2005, at 7:17 PM, Jochem Maas wrote: Dan Rossi wrote: Hi there, I am trying to test out the new installed curl extension to connect to a site via ssl and auth basic. However everytime i try to connect with the browser , in ie it says cannot find server and in mac safari is says could not load any data etc. If i run the same script via php cli it works fine and is accepting the ssl certificate we setup on the IIs server we are connecting to. What could be cauasing this, there is no way to get php debug errors because it doesnt let the page load. Its around the curl_exec call. I also found that its causing an issue with apache in the logs * About to connect() to ourserver port 443 * Trying ip... * connected * Connected to ourserver (ip) port 443 * successfully set certificate verify locations: * CAfile: /usr/local/share/curl/curl-ca-bundle.crt CApath: none [Thu Nov 3 02:46:38 2005] [notice] child pid 49681 exit signal Segmentation fault (11) any ideas ? it helps when you tell us what versions of softwar eyou have. are you running apache2? is it running using a threaded worker module? is the curl extension thread safe? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Richard Lynch's Email Address ...
Curt Zirzow wrote: On Wed, 02 Nov 2005 21:19:24 +0100, Jochem Maas wrote: I totally agree with Richard. about the need for a php func for checking a correct email addr. given that php 'is all about the web', idealogically (still?) pragmatic and dynamically typed: is_email_addr() or is_email() There already is: http://php.net/imap_rfc822_parse_adrlist http://pecl.php.net/mailparse And http://pear.php.net/Mail which has an Mail_RFC822 class for email address validation. -- Richard Heyes http://www.phpguru.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] whitch class can I read EXCEL .xls file
Manish Marathe wrote: On 11/2/05, bala chandar [EMAIL PROTECTED] wrote: Hi, On 11/3/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Dear all: whitch class can I read EXCEL .xls file I want to read data from a excel's .xls file on Linux use php,please tell me way. There is a phpexcelreader project going on sf.net http://sf.net. check out there it works fine Or if you do not want it to be completely automatic, export the .xls file in .csv (comma separated values) and then do the usual file read, line by line. For each line you get use the explode() function with the delimiter you have set and then finally you will get an array of all values per line. Loop through this till the end of the file. There's fgetcsv() http://www.php.net/fgetcsv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Classes and Functions
STFW -Original Message- From: Unknown Unknown [mailto:[EMAIL PROTECTED] Sent: 03 November 2005 00:05 To: Jasper Bryant-Greene Cc: php-general@lists.php.net Subject: Re: [PHP] Classes and Functions Oh thanks again and what does RTFM mean? This message has been delivered to the Internet by the Revenue Internet e-mail service * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Fwd: [PHP] question regarding Reflection
Manish Marathe wrote: On 11/2/05, Jochem Maas [EMAIL PROTECTED] wrote: Manish Marathe wrote: Sorry for spamming but I didn't mean to reply you privately :( I did it myself by accident 2 minutes ago :-) no probs. Thanks I am sorry if I have hurted anyone's feelings here but by foolish simply au contraire. I don't think anyone was hurt. :) No, I was just emotionally black-mailing but in essence, I meant something which is not in best practices Is it possible to keep all the class files somewhere in the path where PHP can look for and I don't have to include in my script. php.ini setting include_path - its a simple concept, /^RT(?:F)?M$/. Well, I saw my php.ini earlier and I guess '.' the current directory is included in the path, so kept the file which had a class (Company) for which I wished to generate test cases in the same directory as my script ( TestGenerator.php) dir and then just tried to execute like: php TestGenerator.php Company And I didn't include Company.php in TestGenerator.php thinking that PHP will find that class since the file is in the path. how does php know you want to load a file/class? you still have to have a line which does something like: include_once {$argv[1]}.class.php; with regard to the rest of the ideas I proposed ... just take it one step at a time ... before you know it you'll have something alot more complex that you might ahve first imagined! and besides 'noob' might not be an appropriate title for someone messing around with code generation and reflection :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: question regarding Reflection
4 things you need to look into: 1. is_file() and is_readable() 2. $argv (contains what was passed along with the cmdline) 3. __autoload() 4. include_path (.ini setting) I trust that you capable of STFW and RTFM well enough to take those 4 and make a start at creating something that resembles 'class loading functionality'? Manish Marathe wrote: On 11/1/05, Curt Zirzow [EMAIL PROTECTED] wrote: On Tue, 01 Nov 2005 14:31:12 -0800, Manish Marathe wrote: ... My question is to use the Reflection API, I need to import the original class for which I am generating tests. For example to generate a tests for class Company which is in Company.php: include_once('company.php'); $c = new ReflectionClass('Company'); If I have to generate test for many classes at once, it would be foolish to have them included in my file on the runtime. Am I understanding it correctly ? Yes you are understanding correctly. You can avoid this issue by using the pcntl[1] tools available in php (assuming this is a *nix environment.) A simple usage would be something like: ?php $pid = pcntl_fork(); if ($pid == -1) { die('could not fork'); } else if ($pid) { // we are the parent pcntl_wait($status); //Protect against Zombie children echo 'Class is defined: '; var_dump(class_exists('foobar', false)); } else { // we are the child // create a class to see if the parent sees it class foobar { } // do your Unit testing.. } The parent process would just iterate through all the class files you need to include and fork a child. Then you can include the file in the child process run your unit test and then exit. I use this method for any sort of long lasting script that causes a lot of memory or resource usage. Wow, this certainly helps when we actually run the unit tests and I didn't think of this earlier so my next question has been already answered by you I guess if I understand you. My current problem is this: Below is some chunk of the scrip I am writing to generate test code. include_once Company.php; class TestGenerator { public function TestGenerator() { } public function catchReflection() { $classInfo = new ReflectionClass('Company'); // Below here I will be getting all the information about the class Company and then I will be generating a test class CompanyTest which resides in the file CompanyTest.php. } } So in this script of mine I have included the Company.php above because the statement $classInfo = new ReflectionClass('Company'); uses it. Now this is just an example I have taken to see how my generator works. The user would use the TestGenerator something like this: php TestGenerator.php myClass Now is there a way that in my script I can let PHP look for a file myClass.php or for that matter any php file that has myClass so that I don't have to include it, as it is totally upto the user which file its gonna pass to the TestGenerator.php script to generate the test code and I cannot statically include that in my file. I believe this time I have stated my problem clearer, earlier I did not, I apologize. Thank You Manish Marathe SpikeSource, Inc. http://developer.spikesource.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Richard Lynch's Email Address ...
On 3 Nov 2005, at 04:32, viraj wrote: does PHP really needs a function to validate an email address!! i doubt. because PHP is a language which provides number of string functions with regex capabilities to develop what ever pattern matching you want. Writing a regex for RFC2822 is not easy - the format is extremely flexible. Having said that, I've got on very well using these: http://www.hexillion.com/samples/#Regex Though it doesn't deal with that oddity that Richard mentioned. The PEAR rfc822 class is pretty good, but it should be noted it's designed for parsing entire to, cc, bcc fields which may contain multiple addresses, and it's not quite as simple as asking it 'is this address ok'. second point is, different organizations have different policies on validating email addresses, so again those developers have to mend their own mechanisms. so everybody will not benefit this effort. Well, unless you're counting really different addressing standards like X.500, everyone has to operate within RFC2822. You're quite free to put additional constraints on addresses, but should be within that spec, not in addition to it. If an address is not RFC2822 compliant, it's pretty unlikely to work, though I have occasionally seen things like non-ASCII chars and '_' get through. Marcus -- Marcus Bointon Synchromedia Limited: Putting you in the picture [EMAIL PROTECTED] | http://www.synchromedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Issue with curl and ssl
Here is my code i am using, ive tried and tried, im still getting a no data sent error in the browser. ? $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, https://mydomain/Default.asmx;); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_SSLCERT, '/path/to/certs/cert.pem'); curl_setopt($ch, CURLOPT_SSLCERTPASSWD, 'thepass'); curl_setopt($ch, CURLOPT_SSLKEYTYPE, 'PEM'); curl_setopt($ch, CURLOPT_SSLKEY, '/path/to/certs/key.pem'); curl_setopt($ch, CURLOPT_USERPWD, 'user:pass'); ob_start(); curl_exec($ch); ob_end_flush(); if(curl_error($ch)) { printf(error: [%s] %s, curl_errno($ch), curl_error($ch)); } curl_close($ch); ? On 03/11/2005, at 7:31 PM, Dan Rossi wrote: Just a standard php 4.3.11 and apache 1.3 ?? It works via php cli wierdly enough but not the apache module ? On 03/11/2005, at 7:17 PM, Jochem Maas wrote: Dan Rossi wrote: Hi there, I am trying to test out the new installed curl extension to connect to a site via ssl and auth basic. However everytime i try to connect with the browser , in ie it says cannot find server and in mac safari is says could not load any data etc. If i run the same script via php cli it works fine and is accepting the ssl certificate we setup on the IIs server we are connecting to. What could be cauasing this, there is no way to get php debug errors because it doesnt let the page load. Its around the curl_exec call. I also found that its causing an issue with apache in the logs * About to connect() to ourserver port 443 * Trying ip... * connected * Connected to ourserver (ip) port 443 * successfully set certificate verify locations: * CAfile: /usr/local/share/curl/curl-ca-bundle.crt CApath: none [Thu Nov 3 02:46:38 2005] [notice] child pid 49681 exit signal Segmentation fault (11) any ideas ? it helps when you tell us what versions of softwar eyou have. are you running apache2? is it running using a threaded worker module? is the curl extension thread safe? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Issue with curl and ssl
can you get it to work without SSL? Dan Rossi wrote: Here is my code i am using, ive tried and tried, im still getting a no data sent error in the browser. ? $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, https://mydomain/Default.asmx;); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_SSLCERT, '/path/to/certs/cert.pem'); curl_setopt($ch, CURLOPT_SSLCERTPASSWD, 'thepass'); curl_setopt($ch, CURLOPT_SSLKEYTYPE, 'PEM'); curl_setopt($ch, CURLOPT_SSLKEY, '/path/to/certs/key.pem'); curl_setopt($ch, CURLOPT_USERPWD, 'user:pass'); ob_start(); curl_exec($ch); ob_end_flush(); if(curl_error($ch)) { printf(error: [%s] %s, curl_errno($ch), curl_error($ch)); } curl_close($ch); ? On 03/11/2005, at 7:31 PM, Dan Rossi wrote: Just a standard php 4.3.11 and apache 1.3 ?? It works via php cli wierdly enough but not the apache module ? On 03/11/2005, at 7:17 PM, Jochem Maas wrote: Dan Rossi wrote: Hi there, I am trying to test out the new installed curl extension to connect to a site via ssl and auth basic. However everytime i try to connect with the browser , in ie it says cannot find server and in mac safari is says could not load any data etc. If i run the same script via php cli it works fine and is accepting the ssl certificate we setup on the IIs server we are connecting to. What could be cauasing this, there is no way to get php debug errors because it doesnt let the page load. Its around the curl_exec call. I also found that its causing an issue with apache in the logs * About to connect() to ourserver port 443 * Trying ip... * connected * Connected to ourserver (ip) port 443 * successfully set certificate verify locations: * CAfile: /usr/local/share/curl/curl-ca-bundle.crt CApath: none [Thu Nov 3 02:46:38 2005] [notice] child pid 49681 exit signal Segmentation fault (11) any ideas ? it helps when you tell us what versions of softwar eyou have. are you running apache2? is it running using a threaded worker module? is the curl extension thread safe? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Richard Lynch's Email Address ...
Marcus Bointon wrote: The PEAR rfc822 class is pretty good, but it should be noted it's designed for parsing entire to, cc, bcc fields which may contain multiple addresses, and it's not quite as simple as asking it 'is this address ok'. News to me... if (!PEAR::isError(Mail_RFC822::parseAddressList('[EMAIL PROTECTED]'))) { // Valid... } It even has a method specifically for normal email addresses of the form [EMAIL PROTECTED] if (Mail_RFC822::isValidInetAddress('[EMAIL PROTECTED]')) { // Valid... } -- Richard Heyes http://www.phpguru.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: ampersand in dom with utf-8
seems that `DomDocument-createTextNode()' accepts only utf-8 string, try encode the text before pass it to that function. in browser side, you can view document property, browser generally allow you to specify any encoding used to view a page, try get familar with you browser first. On 11/3/05, jonathan [EMAIL PROTECTED] wrote: so I decided it would be best just to convert back to the original format so for this string: $string=braised beef shortribs with sauteacute;ed greens, pearl onions and horseradish cream I do an html_entity_decode($string); but this still gives me an error when I add it via the DOM functions but render with the è in php. If I look at the xml in firefox on a mac, it looks like this: namebraised beef shortribs with saut?ed greens, pearl onions and horseradish cream/name I know that this is a basic question but how could I get this go through? Here is how I'm actually adding via the DOMDocument class: $name-appendChild($dom-createTextNode (html_entity_decode($item_row[slot]))); $item-appendChild($name); Is there any way I could on the client side query the xml string for the encoding to be sure that that in fact is utf-8? The first line of the generated xml is: ?xml version=1.0 encoding=utf-8? thanks for any help. -jonathan On Oct 16, 2005, at 1:36 AM, ac wrote: try this, if you need more entities to be included, just refer to `http://www.w3.org/2003/entities/iso8879/isolat1.ent' or find out its charcode by yourself. ?xml version=1.0? !DOCTYPE html [ !ENTITY egrave #x00e8; !ENTITY icirc #x00ee; ] item_namefarm lettuces with reed avocado, cregrave;me fraicirc;che, radish and cilantro/item_name On 10/13/05, jonathan [EMAIL PROTECTED] wrote: I'm now getting this error: XML Parsing Error: undefined entity with the following entity at the first ampersand: item_namefarm lettuces with reed avocado, cregrave;me fraicirc;che, radish and cilantro/item_name Why is an ampersand considered an undefined entity? The xml version is: ?xml version=1.0? Any thoughts please? -jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- all born, to be dying -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- all born, to be dying -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Richard Lynch's Email Address ...
On 3 Nov 2005, at 14:16, Richard Heyes wrote: It even has a method specifically for normal email addresses of the form [EMAIL PROTECTED] Ah, well, that's good news. It's been a while since I looked at it. Marcus -- Marcus Bointon Synchromedia Limited: Putting you in the picture [EMAIL PROTECTED] | http://www.synchromedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] performance suggestions
Dear group, can someone suggest the best way to do the following without writing some lengthy script that (possibly) could lead to performance issues, I have three DB fields in MySQL, each has a unique ID, I cannot think of any ways other than pulling each tables record then looping through to determine which one each belongs to which group then maybe placing into an array, the association between them all goes like this, URL:- url_id url_name section:- section_id url_id section_name page:- page_id section_id page_name What I need to do is construct a navigation bar with each url, section then pages for that section, is their any quick ways (perhaps with SQL) anyone knows of, A static array im currently using for this looks like:- $nav = array( 1 = array('title' = Homepage, 'url' = /main::default), 2 = array('title' = About, 'url' = /main::about, 'sub' = array( array('title' = Contact, 'url' = /main::about::contact), ) ), ); Hope that makes sense to someone. Thanks in advance for any suggestions/help James Apache: 1.3.33 PHP:4.4.1 MySQL: 4.1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Issue with curl and ssl
Yes there somehow seems to be an issue with ssl. Does the curl extension rely on any ssl module in apache to work ? On 04/11/2005, at 12:34 AM, Jochem Maas wrote: can you get it to work without SSL? Dan Rossi wrote: Here is my code i am using, ive tried and tried, im still getting a no data sent error in the browser. ? $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, https://mydomain/Default.asmx;); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_SSLCERT, '/path/to/certs/cert.pem'); curl_setopt($ch, CURLOPT_SSLCERTPASSWD, 'thepass'); curl_setopt($ch, CURLOPT_SSLKEYTYPE, 'PEM'); curl_setopt($ch, CURLOPT_SSLKEY, '/path/to/certs/key.pem'); curl_setopt($ch, CURLOPT_USERPWD, 'user:pass'); ob_start(); curl_exec($ch); ob_end_flush(); if(curl_error($ch)) { printf(error: [%s] %s, curl_errno($ch), curl_error($ch)); } curl_close($ch); ? On 03/11/2005, at 7:31 PM, Dan Rossi wrote: Just a standard php 4.3.11 and apache 1.3 ?? It works via php cli wierdly enough but not the apache module ? On 03/11/2005, at 7:17 PM, Jochem Maas wrote: Dan Rossi wrote: Hi there, I am trying to test out the new installed curl extension to connect to a site via ssl and auth basic. However everytime i try to connect with the browser , in ie it says cannot find server and in mac safari is says could not load any data etc. If i run the same script via php cli it works fine and is accepting the ssl certificate we setup on the IIs server we are connecting to. What could be cauasing this, there is no way to get php debug errors because it doesnt let the page load. Its around the curl_exec call. I also found that its causing an issue with apache in the logs * About to connect() to ourserver port 443 * Trying ip... * connected * Connected to ourserver (ip) port 443 * successfully set certificate verify locations: * CAfile: /usr/local/share/curl/curl-ca-bundle.crt CApath: none [Thu Nov 3 02:46:38 2005] [notice] child pid 49681 exit signal Segmentation fault (11) any ideas ? it helps when you tell us what versions of softwar eyou have. are you running apache2? is it running using a threaded worker module? is the curl extension thread safe? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP MYSQL Dynamic Select Boxes: Please Help
I have 2 tables: products table product_id (INT 11 AUTOINCRE PRI) product_name (VARCHAR 255) product_desc (VARCHAR 255) color table color_id (INT 11 AUTOINCRE PRI) color (VARCHAR 255) image (VARCHAR 255) product_id (INT 11) I would like to create the first select box (pulling the options from the products table). Then I would like the second select box to display the color option related to the product_id in the first select box, thus changing the options dynamically. I've tried the following and it doesn't seem to work. What am I doing wrong? Please help: ?php include_once(../../config.inc.php); $DB_NAME = $DB_NAME[0]; if($DB_NAME[0]) { global $DB_HOST, $DB_USER, $DB_PASS, $DB_NAME; mysql_connect($DB_HOST, $DB_USER, $DB_PASS); mysql_select_db($DB_NAME) OR die(MYSQL Error: error selecting DB); } // this works ? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; html xmlns=http://www.w3.org/1999/xhtml; lang=en xml:lang=en head titleCempave :: Quality cement products/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 link rel=stylesheet type=text/css href=?php print WEB_ROOT;?html/style.css script type=text/javascript src=unobtrusivedynamicselect_ex2to4.js/script script type=text/javascript window.onload = function() { dynamicSelect(pda-brand, pda-type); } /script /head body topmargin=0 bottommargin=0 leftmargin=0 rightmargin=0 form action=# select id=product_name name=product_name option value=select selectedSelect a product.../option ?php $sql1 = mysql_query(SELECT * FROM `products`); while ($row = @mysql_fetch_array($sql1)) { $product_id = $row['product_id']; $product_name = $row['product_name']; print option value='$product_name'$product_name/option; } ? /select !--table-- select id=color name=color option class=select value=select selectedSelect a color.../option ?php $sql1 = mysql_query(SELECT * FROM `products` LEFT JOIN `color` ON products.product_id = color.product_id WHERE color.product_id = '$product_id'); while ($row = @mysql_fetch_array($sql1)) { $product_id = $row['product_id']; $color_id = $row['color_id']; $color = $row['color']; //print trtd$product_id $color_id $color/td/tr; print option class='$product_id' value='$color'$color/option; } ? /select !--/table-- /form /body /html This is all the JavaScript code i used: function dynamicSelect(id1, id2) { // Feature test to see if there is enough W3C DOM support if (document.getElementById document.getElementsByTagName) { // Obtain references to both select boxes var sel1 = document.getElementById(id1); var sel2 = document.getElementById(id2); // Clone the dynamic select box var clone = sel2.cloneNode(true); // Obtain references to all cloned options var clonedOptions = clone.getElementsByTagName(option); // Onload init: call a generic function to display the related options in the dynamic select box refreshDynamicSelectOptions(sel1, sel2, clonedOptions); // Onchange of the main select box: call a generic function to display the related options in the dynamic select box sel1.onchange = function() { refreshDynamicSelectOptions(sel1, sel2, clonedOptions); }; } } function refreshDynamicSelectOptions(sel1, sel2, clonedOptions) { // Delete all options of the dynamic select box while (sel2.options.length) { sel2.remove(0); } // Create regular expression objects for select and the value of the selected option of the main select box as class names var pattern1 = /( |^)(select)( |$)/; var pattern2 = new RegExp(( |^)( + sel1.options[sel1.selectedIndex].value + )( |$)); // Iterate through all cloned options for (var i = 0; i clonedOptions.length; i++) { // If the classname of a cloned option either equals select or equals the value of the selected option of the main select box if (clonedOptions[i].className.match(pattern1) || clonedOptions[i].className.match(pattern2)) { // Clone the option from the hidden option pool and append it to the dynamic select box sel2.appendChild(clonedOptions[i].cloneNode(true)); } } } // Attach our behavior onload window.onload
[PHP] PHP from the command line
I run a linux webserver with Apache and PHP5. Does anyone out there know why a php script would work from the command line but fail when running it through a web browser? In particular, I'm trying to get a connection to an MSSQL server but PHP fails to connect when I run the script with a web browser. My regular scripts (i.e. ones without any mssql functions) work fine from the browser. When I run the script from the command line, the connection succeeds. Any idea if this is a PHP error or an apache error. If this is an apache error, does anyone know what I need to search for to find an answer? Thanks, Robbert van Andel
[PHP] SSL normal sessions stored differently?
Hello, I'm running php-4.3.2-19.ent under httpd-2.0.46-44.ent on Red Hat Enterprise Linux ES release 3 (Taroon Update 4). Here is my Session section of php.ini: -- [Session] session.save_handler = files session.use_cookies = 1 session.name = PHPSESSID session.auto_start = 1 session.cookie_lifetime = 0 session.cookie_path = / session.cookie_domain = session.serialize_handler = php session.gc_probability = 1 session.gc_divisor = 200 session.gc_maxlifetime = 36000 session.referer_check = session.entropy_length = 0 session.entropy_file = session.entropy_length = 16 session.entropy_file = /dev/urandom session.cache_limiter = nocache session.cache_expire = 0 session.use_trans_sid = 1 -- My problem is that normal session variables don't seem to be accessible from an instance of PHP servicing an SSL connection. For example, I can put this in test.php: session_id('bob'); session_start(); echo var_export($_SESSION,true); And get different results depending on whether I call: http://www.example.com/test.php Or: https://secure.example.com/test.php The session variables seem to be stored in different places, even though the save_path is identical. Does anyone know why this happens and/or how to work around it? Thanks! Jesse Guardiani [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] if statement help
I am trying to determine if it is worth my time to attempt a if statement similar to the following. I am asking because I have not found any references to something like this: if( ( !empty( $var1 ) ) || ( if( !empty( $var2 ) ) ( !empty( $var3 ) ) ) || ( $var1 == something ) ) { // do something fancy } -- Jason Gerfen My girlfriend threated to leave me if I went boarding... I will miss her. ~ DIATRIBE aka FBITKK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] if statement help
You only need one if. The parenthesis will evaluation order. if( ( !empty( $var1 ) || ( !empty( $var2 ) !empty( $var3 ) ) || $var1 == something ) On Nov 3, 2005, at 10:13 AM, Jason Gerfen wrote: I am trying to determine if it is worth my time to attempt a if statement similar to the following. I am asking because I have not found any references to something like this: if( ( !empty( $var1 ) ) || ( if( !empty( $var2 ) ) ( !empty ( $var3 ) ) ) || ( $var1 == something ) ) { // do something fancy } -- Jason Gerfen My girlfriend threated to leave me if I went boarding... I will miss her. ~ DIATRIBE aka FBITKK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brent Baisley Systems Architect Landover Associates, Inc. Search Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] PHP from the command line
Sorry, I failed to mention that I ran the command line script as the apache user. Robbert [EMAIL PROTECTED] wrote on 11/03/2005, 04:25:40 PM: the most obvious is db permissions -- but you should be able to get php to report a decent error so you know more precisely what the issue is. for the db permissions issue -- when you run the php script from the command line it's running as you, so the (default) connect to the db will come from . when the same script is run through the apache server the (default) connect will be from . if the apache user doesn't have access to the db (but you do) it will fail. Original Message Date: Thursday, November 03, 2005 06:59:30 AM -0800 From: Robbert van Andel To: php-general@lists.php.net Subject: [PHP] PHP from the command line I run a linux webserver with Apache and PHP5. Does anyone out there know why a php script would work from the command line but fail when running it through a web browser? In particular, I'm trying to get a connection to an MSSQL server but PHP fails to connect when I run the script with a web browser. My regular scripts (i.e. ones without any mssql functions) work fine from the browser. When I run the script from the command line, the connection succeeds. Any idea if this is a PHP error or an apache error. If this is an apache error, does anyone know what I need to search for to find an answer? Thanks, Robbert van Andel -- End Original Message -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and MSSQL on Linux
Quoting [EMAIL PROTECTED]: Thanks for your help. I'd love to hear if you have any success with the RPMs. Unfortunately (?) everything worked for me out-of-the-box. On a fresh FC4 box, I installed httpd and php, then downloaded and installed the freetds and php-mssql rpms. I copied an application that connects to MS SQL Server from another box, and it worked. I didn't have to edit any files (in fact, installing the php-mssql rpm even restarted apache for me). So I'm not sure what's going on with yours. Sorry, Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and MSSQL on Linux
Quoting [EMAIL PROTECTED]: An interesting development. I found some reference to running my PHP script from the command line to take Apache out of the picture. Lo and behold, the script worked. I was able to connect to the server. So the issue seems to be related with Apache. Any idea what I would need to do there to make the script work via the web? Did you run the script from the command line as the apache user? That would rule out any permissions issues. Just grasping at straws. Rick -- Rick Emery When once you have tasted flight, you will forever walk the Earth with your eyes turned skyward, for there you have been, and there you will always long to return -- Leonardo Da Vinci -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] PHP and MSSQL on Linux
Yes, it was as the apache user. Sorry I failed to mention that. Rick Emery [EMAIL PROTECTED] wrote on 11/03/2005, 04:43:03 PM: Quoting [EMAIL PROTECTED]: An interesting development. I found some reference to running my PHP script from the command line to take Apache out of the picture. Lo and behold, the script worked. I was able to connect to the server. So the issue seems to be related with Apache. Any idea what I would need to do there to make the script work via the web? Did you run the script from the command line as the apache user? That would rule out any permissions issues. Just grasping at straws. Rick -- Rick Emery When once you have tasted flight, you will forever walk the Earth with your eyes turned skyward, for there you have been, and there you will always long to return -- Leonardo Da Vinci -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP MYSQL Dynamic Select Boxes: Please Help
Try asking in a newsgroup or forum specific to javascript, that has nothing to do with PHP Adele Botes wrote: I have 2 tables: products table product_id (INT 11 AUTOINCRE PRI) product_name (VARCHAR 255) product_desc (VARCHAR 255) color table color_id (INT 11 AUTOINCRE PRI) color (VARCHAR 255) image (VARCHAR 255) product_id (INT 11) I would like to create the first select box (pulling the options from the products table). Then I would like the second select box to display the color option related to the product_id in the first select box, thus changing the options dynamically. I've tried the following and it doesn't seem to work. What am I doing wrong? Please help: ?php include_once(../../config.inc.php); $DB_NAME = $DB_NAME[0]; if($DB_NAME[0]){ global $DB_HOST, $DB_USER, $DB_PASS, $DB_NAME; mysql_connect($DB_HOST, $DB_USER, $DB_PASS); mysql_select_db($DB_NAME) OR die(MYSQL Error: error selecting DB); } // this works ? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; html xmlns=http://www.w3.org/1999/xhtml; lang=en xml:lang=en head titleCempave :: Quality cement products/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 link rel=stylesheet type=text/css href=?php print WEB_ROOT;?html/style.css script type=text/javascript src=unobtrusivedynamicselect_ex2to4.js/script script type=text/javascript window.onload = function() { dynamicSelect(pda-brand, pda-type); } /script /head body topmargin=0 bottommargin=0 leftmargin=0 rightmargin=0 form action=# select id=product_name name=product_name option value=select selectedSelect a product.../option ?php $sql1 = mysql_query(SELECT * FROM `products`); while ($row = @mysql_fetch_array($sql1)) { $product_id = $row['product_id']; $product_name = $row['product_name']; print option value='$product_name'$product_name/option; } ? /select !--table-- select id=color name=color option class=select value=select selectedSelect a color.../option ?php $sql1 = mysql_query(SELECT * FROM `products` LEFT JOIN `color` ON products.product_id = color.product_id WHERE color.product_id = '$product_id'); while ($row = @mysql_fetch_array($sql1)) { $product_id = $row['product_id']; $color_id = $row['color_id']; $color = $row['color']; //print trtd$product_id $color_id $color/td/tr; print option class='$product_id' value='$color'$color/option; } ? /select !--/table-- /form /body /html This is all the JavaScript code i used: function dynamicSelect(id1, id2) { // Feature test to see if there is enough W3C DOM support if (document.getElementById document.getElementsByTagName) { // Obtain references to both select boxes var sel1 = document.getElementById(id1); var sel2 = document.getElementById(id2); // Clone the dynamic select box var clone = sel2.cloneNode(true); // Obtain references to all cloned options var clonedOptions = clone.getElementsByTagName(option); // Onload init: call a generic function to display the related options in the dynamic select box refreshDynamicSelectOptions(sel1, sel2, clonedOptions); // Onchange of the main select box: call a generic function to display the related options in the dynamic select box sel1.onchange = function() { refreshDynamicSelectOptions(sel1, sel2, clonedOptions); }; } } function refreshDynamicSelectOptions(sel1, sel2, clonedOptions) { // Delete all options of the dynamic select box while (sel2.options.length) { sel2.remove(0); } // Create regular expression objects for select and the value of the selected option of the main select box as class names var pattern1 = /( |^)(select)( |$)/; var pattern2 = new RegExp(( |^)( + sel1.options[sel1.selectedIndex].value + )( |$)); // Iterate through all cloned options for (var i = 0; i clonedOptions.length; i++) { // If the classname of a cloned option either equals select or equals the value of the selected option of the main select box if (clonedOptions[i].className.match(pattern1) || clonedOptions[i].className.match(pattern2)) { // Clone the option from the hidden option pool and append it to the dynamic select box sel2.appendChild(clonedOptions[i].cloneNode(true)); } } } // Attach our behavior onload window.onload = function() { dynamicSelect(product_name, color); } Thx in adv Adele -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and MSSQL on Linux
Well, I don't know why it didn't work on my test server, but when I installed the RPMs on my live server (I know, not the smartest thing to do, but I was desperate), the connection worked like a charm. Thanks to everyone who gave me some of their time. Robbert [EMAIL PROTECTED] wrote on 11/03/2005, 04:50:01 PM: Yes, it was as the apache user. Sorry I failed to mention that. Rick Emery wrote on 11/03/2005, 04:43:03 PM: Quoting [EMAIL PROTECTED]: An interesting development. I found some reference to running my PHP script from the command line to take Apache out of the picture. Lo and behold, the script worked. I was able to connect to the server. So the issue seems to be related with Apache. Any idea what I would need to do there to make the script work via the web? Did you run the script from the command line as the apache user? That would rule out any permissions issues. Just grasping at straws. Rick -- Rick Emery When once you have tasted flight, you will forever walk the Earth with your eyes turned skyward, for there you have been, and there you will always long to return -- Leonardo Da Vinci -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: SSL normal sessions stored differently?
Could it be you have two differnt domain names, PHP could be using a different cookie/session for each one. Jesse Guardiani wrote: Hello, I'm running php-4.3.2-19.ent under httpd-2.0.46-44.ent on Red Hat Enterprise Linux ES release 3 (Taroon Update 4). Here is my Session section of php.ini: -- [Session] session.save_handler = files session.use_cookies = 1 session.name = PHPSESSID session.auto_start = 1 session.cookie_lifetime = 0 session.cookie_path = / session.cookie_domain = session.serialize_handler = php session.gc_probability = 1 session.gc_divisor = 200 session.gc_maxlifetime = 36000 session.referer_check = session.entropy_length = 0 session.entropy_file = session.entropy_length = 16 session.entropy_file = /dev/urandom session.cache_limiter = nocache session.cache_expire = 0 session.use_trans_sid = 1 -- My problem is that normal session variables don't seem to be accessible from an instance of PHP servicing an SSL connection. For example, I can put this in test.php: session_id('bob'); session_start(); echo var_export($_SESSION,true); And get different results depending on whether I call: http://www.example.com/test.php Or: https://secure.example.com/test.php The session variables seem to be stored in different places, even though the save_path is identical. Does anyone know why this happens and/or how to work around it? Thanks! Jesse Guardiani [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Pictureupload
I have made this script to upload pictures into a picturegallery on a website. The script works just as I expected, but with one huge flaw. It doesn't work from every users computer. I can upload pictures with no problem, but another user get's an errormessage. the other user emailed the picture to me and I could upload it with no errors. Here's the script. form name=guildimage_upload method=post action=?php $_SERVER['PHP_SELF'] ? enctype=multipart/form-data table class=normal border=0 align=center tr td height=200 align=center valign=bottom class=holyheader18Screenshot upload/td/tr tr td align=center colspan=2 table border=1 tr td Only pictures with the .jpg extension and size 300kb or less will be uploaded!br Imagenames should not contain quotes or any special signs!!br /td /tr /table /td /tr tr td File:nbsp;nbsp;nbsp;nbsp;nbsp; input type=hidden name=MAX_FILE_SIZE value=30 input type=file name=guildimage /td /tr tr td Comment: input name=guildimage_comment type=text size=40 maxlength=40 /td td input type=submit name=submit value=Summon /td /tr /tr tr td height=160 colspan=2 class=maintext valign=top ?php chmod(/guildimages/, 0777); ## ###Uploads the image and checks if the image exists already### ## if (isset($_POST['submit'])) //If you push the submit-button { $sysfolder=/guildimages/; $filename=.$_FILES['guildimage']['name'].; if (file_exists($sysfolder . $filename)) //If the filename exists. { echo Filename exists or no file selected. Please rename the file or select a file; } elseif ($_FILES['guildimage']['type'] == image/jpeg) //And if the image is .jpg less or equal 300kb... { copy ($_FILES['guildimage']['tmp_name'], /guildimages/.$_FILES['guildimage']['name']) //Copy the image to /guildimages or die(Could not copy file); //Or don't if it's wrong size or format $insertSQL = sprintf(INSERT INTO guildimages (guildimage_date, guildimage_name, guildimage_comment, posted_by) VALUES (NOW(), '%s', '%s', '%s'), ($_FILES['guildimage']['name']), ($_POST['guildimage_comment']), ($_SESSION['logname'])); $guildimage_upload = mysql_query($insertSQL) or die(mysql_error()); //insert all info to the DB echo Result:br\n; echo Filename: .$_FILES['guildimage']['name'].br\n; echo Filesize: .$_FILES['guildimage']['size']. bytebr\n; echo Filtype: .$_FILES['guildimage']['type'].br\n; echo Congrats! It worked!\n; } else { echo Result:br\n; echo Now that didn't seem to work... br\n Did you try a wrong format or size? br\n File that failed-- (.$_FILES['guildimage']['name'].)br; } } ? /td /tr /table /form Can anyone see what's wrong? Since it works from some computers and not from all?
RE: [PHP] Pictureupload
[snip] I have made this script to upload pictures into a picturegallery on a website. The script works just as I expected, but with one huge flaw. It doesn't work from every users computer. I can upload pictures with no problem, but another user get's an errormessage. the other user emailed the picture to me and I could upload it with no errors. [/snip] What error message do they get? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pictureupload
Hi twistednetadmin, Thursday, November 3, 2005, 4:50:33 PM, you wrote: I have made this script to upload pictures into a picturegallery on a website. The script works just as I expected, but with one huge flaw. It doesn't work from every users computer. I can upload pictures with no problem, but another user get's an errormessage. the other user emailed the picture to me and I could upload it with no errors. Here's the script. form name=guildimage_upload method=post action=?php $_SERVER['PHP_SELF'] ? enctype=multipart/form-data table class=normal border=0 align=center tr td height=200 align=center valign=bottom class=holyheader18Screenshot upload/td/tr tr td align=center colspan=2 table border=1 tr td Only pictures with the .jpg extension and size 300kb or less will be uploaded!br Imagenames should not contain quotes or any special signs!!br /td /tr /table /td /tr tr td File:nbsp;nbsp;nbsp;nbsp;nbsp; input type=hidden name=MAX_FILE_SIZE value=30 input type=file name=guildimage /td /tr tr td Comment: input name=guildimage_comment type=text size=40 maxlength=40 /td td input type=submit name=submit value=Summon /td /tr /tr tr td height=160 colspan=2 class=maintext valign=top ?php chmod(/guildimages/, 0777); ## ###Uploads the image and checks if the image exists already### ## if (isset($_POST['submit'])) //If you push the submit-button { $sysfolder=/guildimages/; $filename=.$_FILES['guildimage']['name'].; if (file_exists($sysfolder . $filename)) //If the filename exists. { echo Filename exists or no file selected. Please rename the file or select a file; } elseif ($_FILES['guildimage']['type'] == image/jpeg) //And if the image is .jpg less or equal 300kb... { copy ($_FILES['guildimage']['tmp_name'], /guildimages/.$_FILES['guildimage']['name']) //Copy the image to /guildimages or die(Could not copy file); //Or don't if it's wrong size or format $insertSQL = sprintf(INSERT INTO guildimages (guildimage_date, guildimage_name, guildimage_comment, posted_by) VALUES (NOW(), '%s', '%s', '%s'), ($_FILES['guildimage']['name']), ($_POST['guildimage_comment']), ($_SESSION['logname'])); $guildimage_upload = mysql_query($insertSQL) or die(mysql_error()); //insert all info to the DB echo Result:br\n; echo Filename: .$_FILES['guildimage']['name'].br\n; echo Filesize: .$_FILES['guildimage']['size']. bytebr\n; echo Filtype: .$_FILES['guildimage']['type'].br\n; echo Congrats! It worked!\n; } else { echo Result:br\n; echo Now that didn't seem to work... br\n Did you try a wrong format or size? br\n File that failed-- (.$_FILES['guildimage']['name'].)br; } } ? /td /tr /table /form Can anyone see what's wrong? Since it works from some computers and not from all? How large was the image? Could it be that the script is timing out during an upload? I recently had to change the max_input_time value on one site because the uploads were so large they kept timing the script out, yet some people (on really fast connections) could upload just fine. Cheers, Rich -- Zend Certified Engineer PHP Development Services http://www.corephp.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pictureupload
The errormessage is from this part of the script. echo Result:br\n; echo Now that didn't seem to work... br\n Did you try a wrong format or size? br\n File that failed-- (.$_FILES['guildimage']['name '].)br; So it seems that the file is wrong type or size, but as it works with the same picture from my own computer that is odd. The timeout part I have to check before I answer to, but I have 4mb connection and the last user it failed for has a 2mb connection. 300kb shouldn't make the script time out? Or could it? Where do I check the timeout settings btw? PHP.ini? Or can I run phpinfo() on it?
RE: [PHP] Pictureupload
[snip] The timeout part I have to check before I answer to, but I have 4mb connection and the last user it failed for has a 2mb connection. 300kb shouldn't make the script time out? Or could it? Where do I check the timeout settings btw? PHP.ini? Or can I run phpinfo() on it? [/snip] Check your php.ini as well as your httpd.conf (Apache) for timeout values. Remember to restart your web server after you have made and changed settings in either of these files. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: SSL normal sessions stored differently?
James Benson jb at jamesbenson.co.uk writes: Could it be you have two differnt domain names, PHP could be using a different cookie/session for each one. Yeah, but I'm setting the session_id manually. I've checked my session storage path and only one file is created with that session id. Wouldn't force feeding PHP the session id override any domain problems anyway? I think the problem is that I have session.auto_start turned on. I can't turn it off for fear of breaking a production site. Is there any way to feed PHP a session id with auto_start ON? -- Jesse Guardiani [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: SSL normal sessions stored differently?
Jesse Guardiani jesse at wingnet.net writes: James Benson jb at jamesbenson.co.uk writes: Could it be you have two differnt domain names, PHP could be using a different cookie/session for each one. Yeah, but I'm setting the session_id manually. I've checked my session storage path and only one file is created with that session id. Wouldn't force feeding PHP the session id override any domain problems anyway? I think the problem is that I have session.auto_start turned on. I can't turn it off for fear of breaking a production site. Is there any way to feed PHP a session id with auto_start ON? Here's a solution I found: I'm just passing the session_id via GET to the secure site, then doing this on the index page: session_write_close(); if (isset($_GET['PHPSESSID'])) { session_id($_GET['PHPSESSID']); } session_start(); I had tried that yesterday, but it didn't work. The trick in this case (since auto_start is ON) is to call 'session_write_close();' before setting the session_id. Nothing magic about it after all. :) Thanks for the help! -- Jesse Guardiani [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Pictureupload
twistednetadmin wrote: I have made this script to upload pictures into a picturegallery on a website. The script works just as I expected, but with one huge flaw. It doesn't work from every users computer. I can upload pictures with no problem, but another user get's an errormessage. Should we guess the error message or play hang man for it? Can I have a P please :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can figure out whats wrong
I have I strange problem /bug in my function and I hoping someone can tell me whats wrong. This function return the timestamp for midnight Monday on the given week number. Its working fine, but on week 44 and week 45 it misses with 3600 seconds (1 hour) I wounder if it's a bug in strtotime() or it something I'm doing, it only week 44 and 45. I hope someone can give me an answer on this problem. function week2Timestamp ($weekno) { $first_day_of_year = date('w', mktime(0,0,0,1,1, date('Y'))); if ($first_day_of_year == 0) { $first_day_of_year = 7; } $day = ($weekno -1) * 7 + 1 - $first_day_of_year; $timestamp = strtotime('next Monday', mktime(0, 0, 0, 1, $day, date('Y'))); return $timestamp; } - Anders
Re: [PHP] Re: Pictureupload
As I'm not the serveradmin I have only checked the phpinfo wich says: mysql.connect_timeout60 default_socket_timeout60 Keep-Alive 300 HTTP_KEEP_ALIVE 300 Timeouts Connection: 300 - Keep-Alive: 15 Wich of these I should work out from and what they all have to say, I'm not sure of though since I'm quite new to this. The errormessage is written above James.
[PHP] Convert fake Unicode to real UTF-8
I've been searching for quite some time now and tried several functions, but didn't find a solution. I hope somebody can point me in the right direction. The problem: Russian text is entered through a web form. It's a rather badly administrated external webserver with old versions of everything, so I can not set the table to UTF-8. In the MySQL-Table the text gets converted to something like #1043;#1072; as an ASCII text. Using PHP I need to get the text out into a plain text file, as a real UTF-8 string. How can I convert this? All the conversion methods from PHP that I tried failed, as the text seems to really consist of the individual ASCII chars like , #. Therefore, a normal to-unicode-conversion doesn't change anything. Thanks in advance, Andreas Jakl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can figure out whats wrong
freudian slip in the subject me thinks. Anders Gjermshus wrote: I have I strange problem /bug in my function and I hoping someone can tell me whats wrong. This function return the timestamp for midnight Monday on the given week number. Its working fine, but on week 44 and week 45 it misses with 3600 seconds (1 hour) something about the clocks going back? I wounder if it's a bug in strtotime() or it something I'm doing, it only week 44 and 45. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert fake Unicode to real UTF-8
Have you tried feeding that through htmlentities()? e.g. echo htmlentities(#1043;#1072;); see if that outputs what you want on the page. -Mk Andreas Jakl wrote: I've been searching for quite some time now and tried several functions, but didn't find a solution. I hope somebody can point me in the right direction. The problem: Russian text is entered through a web form. It's a rather badly administrated external webserver with old versions of everything, so I can not set the table to UTF-8. In the MySQL-Table the text gets converted to something like #1043;#1072; as an ASCII text. Using PHP I need to get the text out into a plain text file, as a real UTF-8 string. How can I convert this? All the conversion methods from PHP that I tried failed, as the text seems to really consist of the individual ASCII chars like , #. Therefore, a normal to-unicode-conversion doesn't change anything. Thanks in advance, Andreas Jakl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Pictureupload
twistednetadmin wrote: I have made this script to upload pictures into a picturegallery on a website. The script works just as I expected, but with one huge flaw. It doesn't work from every users computer. I can upload pictures with no problem, but another user get's an errormessage. the other user emailed the picture to me and I could upload it with no errors. Here's the script. form name=guildimage_upload method=post action=?php $_SERVER['PHP_SELF'] ? enctype=multipart/form-data table class=normal border=0 align=center tr td height=200 align=center valign=bottom class=holyheader18Screenshot upload/td/tr tr td align=center colspan=2 table border=1 tr td Only pictures with the .jpg extension and size 300kb or less will be uploaded!br Imagenames should not contain quotes or any special signs!!br /td /tr /table /td /tr tr td File:nbsp;nbsp;nbsp;nbsp;nbsp; input type=hidden name=MAX_FILE_SIZE value=30 input type=file name=guildimage /td /tr tr td Comment: input name=guildimage_comment type=text size=40 maxlength=40 /td td input type=submit name=submit value=Summon /td /tr /tr tr td height=160 colspan=2 class=maintext valign=top ?php chmod(/guildimages/, 0777); ## ###Uploads the image and checks if the image exists already### ## if (isset($_POST['submit'])) //If you push the submit-button { $sysfolder=/guildimages/; $filename=.$_FILES['guildimage']['name'].; if (file_exists($sysfolder . $filename)) //If the filename exists. { echo Filename exists or no file selected. Please rename the file or select a file; } elseif ($_FILES['guildimage']['type'] == image/jpeg) //And if the image is .jpg less or equal 300kb... { You may want to also do something like if(filesize($filename) 300) { echo File too large; } copy ($_FILES['guildimage']['tmp_name'], /guildimages/.$_FILES['guildimage']['name']) //Copy the image to /guildimages or die(Could not copy file); //Or don't if it's wrong size or format Here you should be using move_uploaded_file() instead of copy() http://php.net/move_uploaded_file $insertSQL = sprintf(INSERT INTO guildimages (guildimage_date, guildimage_name, guildimage_comment, posted_by) VALUES (NOW(), '%s', '%s', '%s'), ($_FILES['guildimage']['name']), ($_POST['guildimage_comment']), ($_SESSION['logname'])); $guildimage_upload = mysql_query($insertSQL) or die(mysql_error()); //insert all info to the DB You probably want to do some checks above (before inserting), maybe use http://php.net/manual/en/function.is-uploaded-file.php echo Result:br\n; echo Filename: .$_FILES['guildimage']['name'].br\n; echo Filesize: .$_FILES['guildimage']['size']. bytebr\n; echo Filtype: .$_FILES['guildimage']['type'].br\n; echo Congrats! It worked!\n; } else { echo Result:br\n; echo Now that didn't seem to work... br\n Did you try a wrong format or size? br\n File that failed-- (.$_FILES['guildimage']['name'].)br; } } ? /td /tr /table /form Can anyone see what's wrong? Since it works from some computers and not from all? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] small windows odd problem
hello all, I have just installed php-4.4.0 on my windows xp system and added the directory to the path c:/php-4.4.0-Win32 but I am having problems with the cli version of php. I can get into the program but after i type a bit of code, I try the following keys to get output but it never parses it. I have tried ctrl-z and ctrl-m and ctrl-d but none of these will execute a darn thing. The bit of code I tried is as follows ? echo hello world; ? but like i said, nothing is output when i hit ctrl-m, ctrl-z, or ctrl-d on linux i am using php 4.3.10 and the command line works perfectly -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] proc_open, fwrite, 16384 bytes magic
Sorry, as a follow-up, I just realized that from 'cat' I AM finally getting an error in the log file, which will perhaps help trace the issue: cat: stdout: Broken pipe Could be wrong, but I think you're getting that error because you are closing $pipes[0] which well, closes the pipe and results in a broken pipe. Maybe... maybe not. Anyway, on FreeBSD 5.4 running CLI PHP 5.0.5 with your previously sent script I get output of: 10240 10240 anyway, thought that might be helpful... The output is: 10240 6144 which makes up exactly the magic 16384 bytes. So it's certainly not a qmail issue. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: small windows odd problem
If you mean entering code directly onto the command line then you dont need the opening/closing PHP tags, use something like... php -r echo 'hello world'; matt VanDeWalle wrote: hello all, I have just installed php-4.4.0 on my windows xp system and added the directory to the path c:/php-4.4.0-Win32 but I am having problems with the cli version of php. I can get into the program but after i type a bit of code, I try the following keys to get output but it never parses it. I have tried ctrl-z and ctrl-m and ctrl-d but none of these will execute a darn thing. The bit of code I tried is as follows ? echo hello world; ? but like i said, nothing is output when i hit ctrl-m, ctrl-z, or ctrl-d on linux i am using php 4.3.10 and the command line works perfectly -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Classes and Functions and If's (Problems Again)
Hi everyone, i have some code that proccesses a login form. i have an object $DB which works only in SOME areas, this is the code: ?php require_once(Include.php); global $DB; $Username= $_REQUEST['Username']; $Password= $_REQUEST['Password']; $SQL= SELECT * FROM members WHERE Username='$Username' AND Password='$Password'; ; $DB-Query($SQL); $UserInfo=$DB-QueryInfo(Array); if($UserInfo==0) $Login=FALSE; else $Login=TRUE; //Make Sure the user is not a duplicate user trying to log in again if($Login=TRUE) { global $DB; $RL=__; $LoginD=__; $ID=$UserInfo['ID']; echo $ID; $DB=membersp; $SQL=SELECT ID FROM membersonline WHERE ID='$ID' ; $DB-Query($SQL); $CheckFD=$Result; if($CheckFD!=0) $LoginD=TRUE; else $LoginD=FALSE; if($LoginD==TRUE) { $RL=TRUE; //code to allow user onto next page without interfering with the security measures $DB=membersp; $SQL=SELECT * FROM membersonline WHERE ID=$ID; DBConnect($DB,$SQL); $Slide=$Result; $NextCode=$Slide['NextCode']; } if($LoginD==FALSE) { // Now we start to create and write the data that will let other pages know if the user is logged in or not $Seed= rand(); srand($Seed); $NextCode= rand(); $PageNumber=1; $DB=membersp; $SQL=INSERT INTO MembersOnline (ID, Seed, PageNumber, NextCode) VALUES ('{$ID}', '$Seed', '$PageNumber', '$NextCode') ; DBConnect($DB,$SQL); } } ? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head ?php Init(2); ? title/title /head body ?php if($Login==FALSE) echo(p class='error'Login failed, wrong username and/or password please a href='Login.php'Try Again/a or a href=' Register.php'Register/a/p); if(@$RL==TRUE) echo(p class='error'You have already logged in, click a href='Projects.php?Code={$NextCode}'Here/a to go on/p); ? /body /html i get an error saying: *Fatal error*: Call to a member function Query() on a non-object in * D:\Apache\Apache(re)\Apache2\htdocs\LoginP.php* on line *21* but before line 21 i use $DB and it works fine, but line 21 is a problem, any help appreciated
Re: [PHP] Classes and Functions and If's (Problems Again)
On Thu, 2005-11-03 at 18:37 -0500, Unknown Unknown wrote: Hi everyone, i have some code that proccesses a login form. i have an object $DB which works only in SOME areas, this is the code: ?php require_once(Include.php); global $DB; There is no need to global $DB here. You are already in the global scope. $Username= $_REQUEST['Username']; $Password= $_REQUEST['Password']; $SQL= SELECT * FROM members WHERE Username='$Username' AND Password='$Password'; ; $DB-Query($SQL); $UserInfo=$DB-QueryInfo(Array); if($UserInfo==0) $Login=FALSE; else $Login=TRUE; Why aren't you using real boolean values here? //Make Sure the user is not a duplicate user trying to log in again if($Login=TRUE) { global $DB; Again, no need to global $DB. You are still in the global scope. $RL=__; $LoginD=__; $ID=$UserInfo['ID']; echo $ID; $DB=membersp; Here is your problem. You just replaced the $DB object with a string. Maybe you meant to set a property on the $DB object? I think you may need to do some reading on OOP, perhaps start at http://php.net/oop for PHP4 or http://php.net/oop5 for PHP5. -- Jasper Bryant-Greene General Manager Album Limited e: [EMAIL PROTECTED] w: http://www.album.co.nz/ b: http://jbg.name/ p: 0800 4 ALBUM (0800 425 286) or +64 21 232 3303 a: PO Box 579, Christchurch 8015, New Zealand -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Classes and Functions and If's (Problems Again)
On 11/4/05, Unknown Unknown [EMAIL PROTECTED] wrote: Hi everyone, i have some code that proccesses a login form. i have an object $DB which works only in SOME areas, this is the code: [...] $DB=membersp; $SQL=SELECT ID FROM membersonline WHERE ID='$ID' ; $DB-Query($SQL); [...] i get an error saying: *Fatal error*: Call to a member function Query() on a non-object in * D:\Apache\Apache(re)\Apache2\htdocs\LoginP.php* on line *21* but before line 21 i use $DB and it works fine, but line 21 is a problem, any help appreciated You've not indicated which is line 21, but I presume it's the bit shortly after you assigned a string to $DB. A string is not an object, hence the error message. -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Pictureupload
if (isset($_POST['submit'])) //If you push the submit-button Maybe the user pressed ENTER instead of clicking the button. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] client server question
hi... a rather basic question. i'm looking for examples of client/server apps. i'm also looking for input as to what's the best way to implement the underlying messaging protocols. i've started looking at soap/rpc, but i'm not sure as to how these protocols would fit/work.. the client/server apps are both web based apps on different servers. i'm envisioning a test app (client) where a user logs into a web app. the user is able to enter some information, do some functions, etc... the client app is then able to communicate with the 'server app' (server) to exchange information, and perform some actions. the actions might be to upload/download/delete/update information, or some other function. if possible i'd also like the ability to 'push' information from the server, to the client apps, or would it make more sense to have some type of client cron process that continuously checks the server app, and pulls any required information. i'd like the communication between client/server to be encrypted/authenticated/secure. i'd also like to be able to support multiple clients simultaneously communicating with the server. these are kind of basic thoughts to my putting this test app together. -bruce [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] to the freelancers!!
Hi, Just a quick question. Had a conversation with a person who works for a non-profit, and she was describing some of her dealings with obtaining grants for the development of 'open source' apps.Got me to thinking. If a company sponsored the initial development of an 'open source' kind of app (the exact licensing would need to be fleshed out) what do yout think would be the response of people to work on the apps.. I started to wnoder if there would be a pool of talented people who would be interested in working on projects that are initially funded. The funding would go to pay the resources, set up the project, do initial grass roots marketing, etc... The idea would be to focus in on the projects/technologies/apps that a given business would agree to initially support/fund. Thoughts/comments/etc... -bruce [EMAIL PROTECTED] ps. I'm not talking about a freshmeat.net/sourceforge kind of environment. The obvious goal of this kind of process would be to turn small applications/projects into profitable applications. My curiousity is whether you could then create applications/services that could be built along the same model as nagios/mysql/etc.. where you have a free/open version, as well as a fee based application/service. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Email Validation built-in? RFC
just to add my 0.02 worth to this conversation after throwing things at the wall regarding email verification/validation, i finally decided to cheat. i went with using the perl/cpan email function (can't recall right now) and created a wrapper around it. the perl function has been around alot longer than almost any other function that i could find, and it appeared to follow the rfc standard. but yeah, it would be nice/good if there was a verified/valid/accurate php email_valid function, as most of the ones that i found were really lacking... -bruce -Original Message- From: Robin Vickery [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 25, 2005 5:31 AM To: php-general@lists.php.net Subject: Re: [PHP] Re: Email Validation built-in? RFC On 10/25/05, Mark Charette [EMAIL PROTECTED] wrote: Ben Litton wrote: You could certainly write an extension to do so. That's what I did (mostly I was writing one for another purpose and added a function I stole from O'Reilly. As you stated in your article, it isn't rfc822 compliant (it isn't even close). Richard was pretty specific in his needs. Just in case anyone's inspired to read through the specs; It's RFC-2822 these days. RFC-822 is obsolete. -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP from the command line
Many linux distributions use a different php config file for the apache and cli versions. Using two different configurations might explain the problems you are seeing. David Robbert van Andel wrote: I run a linux webserver with Apache and PHP5. Does anyone out there know why a php script would work from the command line but fail when running it through a web browser? In particular, I'm trying to get a connection to an MSSQL server but PHP fails to connect when I run the script with a web browser. My regular scripts (i.e. ones without any mssql functions) work fine from the browser. When I run the script from the command line, the connection succeeds. Any idea if this is a PHP error or an apache error. If this is an apache error, does anyone know what I need to search for to find an answer? Thanks, Robbert van Andel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP from the command line
what's the error that you're getting from the web php app... also, what do you get from the php_info() for the web app? this tells you a great deal of information regarding your php/web setup (if you didn't already know!) get us the information and we can help track down your issue... also, is there a user/passwd setup to access the mssql db? -bruce -Original Message- From: David Tulloh [mailto:[EMAIL PROTECTED] Sent: Thursday, November 03, 2005 6:22 PM To: Robbert van Andel Cc: php-general@lists.php.net Subject: Re: [PHP] PHP from the command line Many linux distributions use a different php config file for the apache and cli versions. Using two different configurations might explain the problems you are seeing. David Robbert van Andel wrote: I run a linux webserver with Apache and PHP5. Does anyone out there know why a php script would work from the command line but fail when running it through a web browser? In particular, I'm trying to get a connection to an MSSQL server but PHP fails to connect when I run the script with a web browser. My regular scripts (i.e. ones without any mssql functions) work fine from the browser. When I run the script from the command line, the connection succeeds. Any idea if this is a PHP error or an apache error. If this is an apache error, does anyone know what I need to search for to find an answer? Thanks, Robbert van Andel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP from the command line
From the web, all I get is that the connection failed. Nothing more useful than that. PHP_INFO tells me that it sees the MS SQL ini file and the MS SQL configuration settings are displayed further down the list. The username and password work in the script because I am able to connect using the exact same script from the command line. -Original Message- From: bruce [mailto:[EMAIL PROTECTED] Sent: Thursday, November 03, 2005 7:28 PM To: 'David Tulloh'; 'Robbert van Andel' Cc: php-general@lists.php.net Subject: RE: [PHP] PHP from the command line what's the error that you're getting from the web php app... also, what do you get from the php_info() for the web app? this tells you a great deal of information regarding your php/web setup (if you didn't already know!) get us the information and we can help track down your issue... also, is there a user/passwd setup to access the mssql db? -bruce -Original Message- From: David Tulloh [mailto:[EMAIL PROTECTED] Sent: Thursday, November 03, 2005 6:22 PM To: Robbert van Andel Cc: php-general@lists.php.net Subject: Re: [PHP] PHP from the command line Many linux distributions use a different php config file for the apache and cli versions. Using two different configurations might explain the problems you are seeing. David Robbert van Andel wrote: I run a linux webserver with Apache and PHP5. Does anyone out there know why a php script would work from the command line but fail when running it through a web browser? In particular, I'm trying to get a connection to an MSSQL server but PHP fails to connect when I run the script with a web browser. My regular scripts (i.e. ones without any mssql functions) work fine from the browser. When I run the script from the command line, the connection succeeds. Any idea if this is a PHP error or an apache error. If this is an apache error, does anyone know what I need to search for to find an answer? Thanks, Robbert van Andel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP from the command line
ok.. show us the connection code you're using to access the db.. -bruce -Original Message- From: Robbert van Andel [mailto:[EMAIL PROTECTED] Sent: Thursday, November 03, 2005 8:37 PM To: [EMAIL PROTECTED]; 'David Tulloh' Cc: php-general@lists.php.net Subject: RE: [PHP] PHP from the command line From the web, all I get is that the connection failed. Nothing more useful than that. PHP_INFO tells me that it sees the MS SQL ini file and the MS SQL configuration settings are displayed further down the list. The username and password work in the script because I am able to connect using the exact same script from the command line. -Original Message- From: bruce [mailto:[EMAIL PROTECTED] Sent: Thursday, November 03, 2005 7:28 PM To: 'David Tulloh'; 'Robbert van Andel' Cc: php-general@lists.php.net Subject: RE: [PHP] PHP from the command line what's the error that you're getting from the web php app... also, what do you get from the php_info() for the web app? this tells you a great deal of information regarding your php/web setup (if you didn't already know!) get us the information and we can help track down your issue... also, is there a user/passwd setup to access the mssql db? -bruce -Original Message- From: David Tulloh [mailto:[EMAIL PROTECTED] Sent: Thursday, November 03, 2005 6:22 PM To: Robbert van Andel Cc: php-general@lists.php.net Subject: Re: [PHP] PHP from the command line Many linux distributions use a different php config file for the apache and cli versions. Using two different configurations might explain the problems you are seeing. David Robbert van Andel wrote: I run a linux webserver with Apache and PHP5. Does anyone out there know why a php script would work from the command line but fail when running it through a web browser? In particular, I'm trying to get a connection to an MSSQL server but PHP fails to connect when I run the script with a web browser. My regular scripts (i.e. ones without any mssql functions) work fine from the browser. When I run the script from the command line, the connection succeeds. Any idea if this is a PHP error or an apache error. If this is an apache error, does anyone know what I need to search for to find an answer? Thanks, Robbert van Andel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] proc_open, fwrite, 16384 bytes magic
On Thu, 03 Nov 2005 13:14:48 -0800, Philip Hallstrom wrote: ... Anyway, on FreeBSD 5.4 running CLI PHP 5.0.5 with your previously sent script I get output of: 10240 10240 anyway, thought that might be helpful... ... The output is: 10240 6144 which makes up exactly the magic 16384 bytes. So it's certainly not a qmail issue. I get the correct results with FreeBSD 5.4 and php versions 4.4, 5.0, 5.1, and 6.0 as well. I dont remember if you mentioned what version of bsd and php you have installed. Curt. -- http://news.zirzow.dyndns.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Convert fake Unicode to real UTF-8
UTF-8. In the MySQL-Table the text gets converted to something like #1043;#1072; as an ASCII text. where did you see this, phpmyadmin or mysql cli ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP from the command line
On Thu, 2005-11-03 at 20:58 -0800, bruce wrote: ok.. show us the connection code you're using to access the db.. I think you're on the wrong track. The connection code is known good because it works in CLI mode. What I would like to see is any notable differences between the output of phpinfo() in CLI mode and through your webserver. Jasper -Original Message- From: Robbert van Andel [mailto:[EMAIL PROTECTED] Sent: Thursday, November 03, 2005 8:37 PM To: [EMAIL PROTECTED]; 'David Tulloh' Cc: php-general@lists.php.net Subject: RE: [PHP] PHP from the command line From the web, all I get is that the connection failed. Nothing more useful than that. PHP_INFO tells me that it sees the MS SQL ini file and the MS SQL configuration settings are displayed further down the list. The username and password work in the script because I am able to connect using the exact same script from the command line. -Original Message- From: bruce [mailto:[EMAIL PROTECTED] Sent: Thursday, November 03, 2005 7:28 PM To: 'David Tulloh'; 'Robbert van Andel' Cc: php-general@lists.php.net Subject: RE: [PHP] PHP from the command line what's the error that you're getting from the web php app... also, what do you get from the php_info() for the web app? this tells you a great deal of information regarding your php/web setup (if you didn't already know!) get us the information and we can help track down your issue... also, is there a user/passwd setup to access the mssql db? -bruce -Original Message- From: David Tulloh [mailto:[EMAIL PROTECTED] Sent: Thursday, November 03, 2005 6:22 PM To: Robbert van Andel Cc: php-general@lists.php.net Subject: Re: [PHP] PHP from the command line Many linux distributions use a different php config file for the apache and cli versions. Using two different configurations might explain the problems you are seeing. David Robbert van Andel wrote: I run a linux webserver with Apache and PHP5. Does anyone out there know why a php script would work from the command line but fail when running it through a web browser? In particular, I'm trying to get a connection to an MSSQL server but PHP fails to connect when I run the script with a web browser. My regular scripts (i.e. ones without any mssql functions) work fine from the browser. When I run the script from the command line, the connection succeeds. Any idea if this is a PHP error or an apache error. If this is an apache error, does anyone know what I need to search for to find an answer? Thanks, Robbert van Andel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jasper Bryant-Greene General Manager Album Limited e: [EMAIL PROTECTED] w: http://www.album.co.nz/ b: http://jbg.name/ p: 0800 4 ALBUM (0800 425 286) or +64 21 232 3303 a: PO Box 579, Christchurch 8015, New Zealand -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php