php-general Digest 2 Jul 2009 13:45:48 -0000 Issue 6207
php-general Digest 2 Jul 2009 13:45:48 - Issue 6207 Topics (messages 294818 through 294827): Re: exasperated again 294818 by: Maximiliano Churichi PHP --info giving segmentation fault 294819 by: Vivek Katakam PHP Raw-listing Problem 294820 by: Parham Doustdar Re: removing an array from a compound array 294821 by: Ford, Mike 294823 by: zhoo 294827 by: Andres Gonzalez Re: Apache module PHP 5.3 on Windows 294822 by: Lester Caine Re: PHP 5.3.0 Released! 294824 by: Nick Cooper 294825 by: Michael A. Peters Dom PDF Problem 294826 by: Pravinc Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- 2009/6/30 PJ af.gour...@videotron.ca: Could somebody please explain to me what is wrong with this code? In my script it works, returns the correct id, but when I try it in a test pages, nothing in the world gets it to work. This is rather frustrating, again: THIS WORKS IN ANOTHER PAGE; IN THE TEST PAGE ID DOES NOT. $sql = SELECT id FROM publishers WHERE publisher = 'whoever'; $result = mysql_query($sql,$db); $row = mysql_fetch_assoc($result); if (mysql_num_rows($result) !== 0) { $pub = $row['id']; Syntax is ok, echo hello; works. This works in the test page: $aid = array(); $ord = array(); $sql = SELECT authID, ordinal FROM book_author WHERE bookid = 624 ORDER BY ordinal ASC; $result = mysql_query($sql, $db); //$row = mysql_fetch_assoc($result); while ( $row = mysql_fetch_assoc($result) ) { $aid[]=$row['authID']; $ord[]=$row['ordinal']; } var_dump($aid); echo br /; var_dump($ord); echo $aid[0], - ; echo $ord[0]; This does not: $fi=joe; $la=joe; $sql = SELECT id FROM author WHERE first_name = '$fi' last_name = '$la'; $result = msql_query($sql, $db); $row = mysql_fetch_assoc($result); $count=mysql_num_rows($result); echo $count; if (mysql_num_rows($result) 0) { $a_id=$row['id']; } echo $a_id, br /br /; The test page prints out echo some text; but no results when the results are there Tell me I have missed something simple here, or is this normal for php ? I have checked the queries on Mysql command line and they are fine. I have verified the syntax and Netbeans tells me it is fine. Same results Firefox3 (2 machines) IE 8. What is not fine? -- Hervé Kempf: Pour sauver la planète, sortez du capitalisme. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Is that exactly your code? see your 4th line: $result = msql_query($sql, $db); you forgot the y in mysql_query function... if you have a 500 error code maybe this is the problem -- Maximiliano Churichi mchuri...@gmail.com ---End Message--- ---BeginMessage--- Hi All, I am using CentOS 5.3-x8664. I installed PHP and Apache httpd. The following are the version informations present on the system: #httpd -v Server version: Apache/2.2.3 # php -v PHP 5.1.6 (cli) (built: Jan 21 2009 01:45:01) The problem is when accessing through web page it is giving blank, i am getting the following error messages in /var/log/httpd/error_log: ... ... [Wed Jul 01 00:48:58 2009] [notice] child pid 4408 exit signal Segmentation fault (11) [Wed Jul 01 00:49:10 2009] [notice] child pid 4411 exit signal Segmentation fault (11) [Wed Jul 01 00:55:32 2009] [notice] caught SIGTERM, shutting down [Wed Jul 01 00:55:43 2009] [notice] Digest: generating secret for digest authentication ... [Wed Jul 01 00:55:43 2009] [notice] Digest: done [Wed Jul 01 00:55:43 2009] [notice] Apache/2.2.3 (CentOS) configured -- resuming normal operations *** glibc detected *** /usr/sbin/httpd: double free or corruption (out): 0x2ab491c70cf0 *** ... ... From the command prompt when i ran the following i got the following error as the root cause: # php --info . . curl CURL support = enabled CURL Information = libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 date *** glibc detected *** php: munmap_chunk(): invalid pointer: 0x2b605055cc00 *** === Backtrace: = /lib64/libc.so.6(cfree+0x1b6)[0x3bd2675a36] php(timelib_builtin_db+0x283)[0x46f5d3] php(zm_info_date+0xa3)[0x456b23] php[0x4f3614] php(zend_hash_apply_with_argument+0x3f)[0x58360f] php(php_print_info+0xa04)[0x4f4a04]
php-general Digest 3 Jul 2009 03:27:48 -0000 Issue 6208
php-general Digest 3 Jul 2009 03:27:48 - Issue 6208 Topics (messages 294828 through 294840): Re: Dom PDF Problem 294828 by: Paul M Foster generally, where in cPanel can one set the default page to load? 294829 by: Govinda 294830 by: Daniel Brown 294831 by: Michael A. Peters 294833 by: Govinda 294834 by: Daniel Brown 294838 by: Govinda namespace keyword 294832 by: Martin Scotta 294835 by: Greg Beaver Implode a 2D Array 294836 by: salmarayan 294837 by: Shawn McKenzie Re: cannot figure out permissions for fopen/fwrite 294839 by: Waynn Lue Sessions 294840 by: Jason Carson Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- On Thu, Jul 02, 2009 at 04:29:01PM +0530, Pravinc wrote: Hey all, I am working with generating PDF using Dom PDF. My problem is when I generate a single PDF , Its working fine. But when I code it in a loop for generating more than one PDF it gives some error. $DomObj = new DOMPDF(); $DomObj-load_html_file($pth); $DomObj-render(); $pdf = $DomObj-output(); file_put_contents($MainDir./Order-.$rsOrder[$ro]['OrderNumber']./packing_ slip.pdf, $pdf); the above code is in a loop I come to know that ,there is problem with memory leak. Also I thought that it was because I had not destroy the previously created Object. So I also tried destroying it using unset.. I don't know whether its destroying or not. Error is something like Fatal error: Uncaught exception 'DOMPDF_Exception' with message 'No block-level parent found. Not good.' in D:\foldername\project\control\dompdf\include\inline_positioner.cls.php:68 Stack trace: #0 D:\foldername\ project \control\dompdf\include\frame_decorator.cls.php(381): Inline_Positioner-position() #1 D:\foldername\ project \control\dompdf\include\inline_frame_reflower.cls.php(56): Frame_Decorator-position(. Can anyone please give me some way to solve this. I had an error something like this when using FPDF. It would hack up the second PDF. I didn't investigate it a lot, but my solution was to instantiate the class *once*, and loop on the *rest* of it. Paul -- Paul M. Foster ---End Message--- ---BeginMessage--- Dear list-members I am using what I assume is a pretty standard cPanel setup (?) I would like to be able change the mime types/extension so that .html gets sent through the PHP interpreter, but I see the cPanel docs say ...(note that you can not alter the system defined mime type values)... So as a workaround, I need to *at least* be able to change the default file to return to the browser when someone hits my domain (or a subdirectory) without specifying the page in that dir/ to load. I cannot find where in cPanel to set that. The default now is the standard index.html.I want to change it to index.php. I realize this is really basic stuff, but I can't find it in my cPanel. Can someone point me to this? -Govinda ---End Message--- ---BeginMessage--- On Thu, Jul 2, 2009 at 12:40, Govindagovinda.webdnat...@gmail.com wrote: Can someone point me to this? Wrong list. ;-P In fact, check Google for .htaccess MIME aliasing. It's nothing to do with PHP, nor cPanel, really. -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Ask me about our fully-managed servers and proactive management clusters starting at just $200/mo.! ---End Message--- ---BeginMessage--- Govinda wrote: Dear list-members I am using what I assume is a pretty standard cPanel setup (?) I would like to be able change the mime types/extension so that .html gets sent through the PHP interpreter, but I see the cPanel docs say ...(note that you can not alter the system defined mime type values)... So as a workaround, I need to *at least* be able to change the default file to return to the browser when someone hits my domain (or a subdirectory) without specifying the page in that dir/ to load. I cannot find where in cPanel to set that. The default now is the standard index.html.I want to change it to index.php. I realize this is really basic stuff, but I can't find it in my cPanel. Can someone point me to this? -Govinda If you have mod_rewrite installed - put the following in your .htaccess file: RewriteEngine on RewriteRule ^index\.html$ index.php [L] That will cause index.php to be called when index.html is requested. If you want it to forward to index.php then use [R] instead of [L] If you want all .html to be sent to php equivalents - RewriteRule (^.*)\.html$ $1.php [L] should do the
RE: [PHP] removing an array from a compound array
-Original Message- From: Andres Gonzalez [mailto:and...@packetstorm.com] Sent: 02 July 2009 00:46 To: php-general@lists.php.net Subject: [PHP] removing an array from a compound array I have a compound array, that is, an array of an array of an array, etc, that is about 5 arrays deep. I currently search thru all of these arrays, and based on some criteria, I want to delete one of the arrays (along with all of its sub-arrays) in the middle. What is the easiest way to delete such an embedded array? If you know all the keys leading to the subarray you want to remove (which you probably do if you've just searched your way to it), then a simple unset() should work, similar to: Unset($array[$key1][$key2][$key3]); Cheers! Mike -- Mike Ford, Electronic Information Developer, C507, Leeds Metropolitan University, Civic Quarter Campus, Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom Email: m.f...@leedsmet.ac.uk Tel: +44 113 812 4730 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache module PHP 5.3 on Windows
Jonathan Tapicer wrote: What version, VC6 or VC9, TS or NTS? I use VC6 TS and the dll is there... Of cause no one has asked yet which version you use if you have to test BOTH Apache and IIS ;) -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RE: [PHP] removing an array from a compound array
yes,i agree with Mike's method. 2009-07-02 zhoo 发件人: Ford, Mike 发送时间: 2009-07-02 15:12:20 收件人: Andres Gonzalez; php-general@lists.php.net 抄送: 主题: RE: [PHP] removing an array from a compound array -Original Message- From: Andres Gonzalez [mailto:and...@packetstorm.com] Sent: 02 July 2009 00:46 To: php-general@lists.php.net Subject: [PHP] removing an array from a compound array I have a compound array, that is, an array of an array of an array, etc, that is about 5 arrays deep. I currently search thru all of these arrays, and based on some criteria, I want to delete one of the arrays (along with all of its sub-arrays) in the middle. What is the easiest way to delete such an embedded array? If you know all the keys leading to the subarray you want to remove (which you probably do if you've just searched your way to it), then a simple unset() should work, similar to: Unset($array[$key1][$key2][$key3]); Cheers! Mike -- Mike Ford, Electronic Information Developer, C507, Leeds Metropolitan University, Civic Quarter Campus, Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom Email: m.f...@leedsmet.ac.uk Tel: +44 113 812 4730 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP 5.3.0 Released!
Does anyone have any further information on the PECL Binaries for 5.3, will they be released? 2009/6/30 pan p...@syix.com Lukas Kahwe Smith wrote: Hello! The PHP Development Team would like to announce the immediate release of PHP 5.3.0. This release is a major improvement in the 5.X series, which includes a large number of new features and bug fixes. Release Announcement: http://www.php.net/release/5_3_0.php Downloads:http://php.net/downloads.php#v5.3.0 Changelog:http://www.php.net/ChangeLog-5.php#5.3.0 regards, Johannes and Lukas Great ! The downloads page is devoid of any note in re pRCL binaries for Windows. windows.php.net doesn't say anything either of which pre-existing PECL binaries will work with 5_3. Is the 5_2_6 set of PECL binaries compatible with 5_3 ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP 5.3.0 Released!
Nick Cooper wrote: Does anyone have any further information on the PECL Binaries for 5.3, will they be released? I don't, but I suspect it is just a matter of compile + test. On Linux (CentOS) I've only done testing with i386 but none of the pecl modules I personally am using w/ 5.2.9 failed to build (for i386 or x86_64) and they all seem to work as expected (i386). So I expect for most of them, the distributed binaries will appear once they have had a little testing. -=- The problems I personally have run into: eAccelerator (stable) fails to build. Devel version does (at least according to their bug system) but does not work properly. suhosin module builds and works but kills the ability of pear to properly work (pear packages work fine, it's the package management that suhosin kills - can't even list channels w/o segfault) Many of the pear packages throw deprecation errors to screen if you have display_errors enabled. They seem to work, and it seems that these are errors that were thrown before as well but only under strict reporting. My guess is they are being brought to the forefront so the code can be fixed before php 6. Not a biggie if error reporting disabled, but a PITA on a development machine where you are trying to see errors thrown in *your* code. Maybe it's time for the community to go through pear, fix the errors, and submit patches to the maintainers that take care of the deprecated usage. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Dom PDF Problem
Hey all, I am working with generating PDF using Dom PDF. My problem is when I generate a single PDF , Its working fine. But when I code it in a loop for generating more than one PDF it gives some error. $DomObj = new DOMPDF(); $DomObj-load_html_file($pth); $DomObj-render(); $pdf = $DomObj-output(); file_put_contents($MainDir./Order-.$rsOrder[$ro]['OrderNumber']./packing_ slip.pdf, $pdf); the above code is in a loop I come to know that ,there is problem with memory leak. Also I thought that it was because I had not destroy the previously created Object. So I also tried destroying it using unset.. I don't know whether its destroying or not. Error is something like Fatal error: Uncaught exception 'DOMPDF_Exception' with message 'No block-level parent found. Not good.' in D:\foldername\project\control\dompdf\include\inline_positioner.cls.php:68 Stack trace: #0 D:\foldername\ project \control\dompdf\include\frame_decorator.cls.php(381): Inline_Positioner-position() #1 D:\foldername\ project \control\dompdf\include\inline_frame_reflower.cls.php(56): Frame_Decorator-position(. Can anyone please give me some way to solve this.
Re: [PHP] removing an array from a compound array
Duh! I should have known that. I actually tried that and had a problem so I thought unset() would not work on an array. Guess that problem was elsewhere. Thanks for the responses... -Andres Ford, Mike wrote: -Original Message- From: Andres Gonzalez [mailto:and...@packetstorm.com] Sent: 02 July 2009 00:46 To: php-general@lists.php.net Subject: [PHP] removing an array from a compound array I have a compound array, that is, an array of an array of an array, etc, that is about 5 arrays deep. I currently search thru all of these arrays, and based on some criteria, I want to delete one of the arrays (along with all of its sub-arrays) in the middle. What is the easiest way to delete such an embedded array? If you know all the keys leading to the subarray you want to remove (which you probably do if you've just searched your way to it), then a simple unset() should work, similar to: Unset($array[$key1][$key2][$key3]); Cheers! Mike -- Mike Ford, Electronic Information Developer, C507, Leeds Metropolitan University, Civic Quarter Campus, Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom Email: m.f...@leedsmet.ac.uk Tel: +44 113 812 4730 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dom PDF Problem
On Thu, Jul 02, 2009 at 04:29:01PM +0530, Pravinc wrote: Hey all, I am working with generating PDF using Dom PDF. My problem is when I generate a single PDF , Its working fine. But when I code it in a loop for generating more than one PDF it gives some error. $DomObj = new DOMPDF(); $DomObj-load_html_file($pth); $DomObj-render(); $pdf = $DomObj-output(); file_put_contents($MainDir./Order-.$rsOrder[$ro]['OrderNumber']./packing_ slip.pdf, $pdf); the above code is in a loop I come to know that ,there is problem with memory leak. Also I thought that it was because I had not destroy the previously created Object. So I also tried destroying it using unset.. I don't know whether its destroying or not. Error is something like Fatal error: Uncaught exception 'DOMPDF_Exception' with message 'No block-level parent found. Not good.' in D:\foldername\project\control\dompdf\include\inline_positioner.cls.php:68 Stack trace: #0 D:\foldername\ project \control\dompdf\include\frame_decorator.cls.php(381): Inline_Positioner-position() #1 D:\foldername\ project \control\dompdf\include\inline_frame_reflower.cls.php(56): Frame_Decorator-position(. Can anyone please give me some way to solve this. I had an error something like this when using FPDF. It would hack up the second PDF. I didn't investigate it a lot, but my solution was to instantiate the class *once*, and loop on the *rest* of it. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] generally, where in cPanel can one set the default page to load?
Dear list-members I am using what I assume is a pretty standard cPanel setup (?) I would like to be able change the mime types/extension so that .html gets sent through the PHP interpreter, but I see the cPanel docs say ...(note that you can not alter the system defined mime type values)... So as a workaround, I need to *at least* be able to change the default file to return to the browser when someone hits my domain (or a subdirectory) without specifying the page in that dir/ to load. I cannot find where in cPanel to set that. The default now is the standard index.html.I want to change it to index.php. I realize this is really basic stuff, but I can't find it in my cPanel. Can someone point me to this? -Govinda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] generally, where in cPanel can one set the default page to load?
On Thu, Jul 2, 2009 at 12:40, Govindagovinda.webdnat...@gmail.com wrote: Can someone point me to this? Wrong list. ;-P In fact, check Google for .htaccess MIME aliasing. It's nothing to do with PHP, nor cPanel, really. -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Ask me about our fully-managed servers and proactive management clusters starting at just $200/mo.! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] generally, where in cPanel can one set the default page to load?
Govinda wrote: Dear list-members I am using what I assume is a pretty standard cPanel setup (?) I would like to be able change the mime types/extension so that .html gets sent through the PHP interpreter, but I see the cPanel docs say ...(note that you can not alter the system defined mime type values)... So as a workaround, I need to *at least* be able to change the default file to return to the browser when someone hits my domain (or a subdirectory) without specifying the page in that dir/ to load. I cannot find where in cPanel to set that. The default now is the standard index.html.I want to change it to index.php. I realize this is really basic stuff, but I can't find it in my cPanel. Can someone point me to this? -Govinda If you have mod_rewrite installed - put the following in your .htaccess file: RewriteEngine on RewriteRule ^index\.html$ index.php [L] That will cause index.php to be called when index.html is requested. If you want it to forward to index.php then use [R] instead of [L] If you want all .html to be sent to php equivalents - RewriteRule (^.*)\.html$ $1.php [L] should do the trick. btw - with those rules, the .html files do not need to exist. If/when they are requested, whether they exist or not, the link or redirect is made. mod_rewrite rocks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] namespace keyword
Hil all I'm a 5.2.0 user (WINXP) I have a class like this... Class IsThisBad { const NAMESPACE = 'something'; /* code */ function __construct( $other=self::NAMESPACE ) { /* do stuff */ } } Recently the version 5.3 was released, so... should I change the const NAMESPACE in the class? Is it a reserved word? -- Martin Scotta -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] generally, where in cPanel can one set the default page to load?
If you have mod_rewrite installed - put the following in your .htaccess file: RewriteEngine on RewriteRule ^index\.html$ index.php [L] That will cause index.php to be called when index.html is requested. If you want it to forward to index.php then use [R] instead of [L] If you want all .html to be sent to php equivalents - RewriteRule (^.*)\.html$ $1.php [L] should do the trick. btw - with those rules, the .html files do not need to exist. If/ when they are requested, whether they exist or not, the link or redirect is made. mod_rewrite rocks Thanks to you both Michael Dan, I must not have mod-rewrite installed (I am 98% uneducated about apache/server admin). I will save your post though MIchael, for when I get more to that level.. you gave a good lead. Meanwhile, Dan you gave me the quick fix lead I was after. DirectoryIndex index.php works. Found it at http://httpd.apache.org/docs/1.3/mod/mod_dir.html#directoryindex -G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] generally, where in cPanel can one set the default page to load?
On Thu, Jul 2, 2009 at 13:38, Govindagovinda.webdnat...@gmail.com wrote: I must not have mod-rewrite installed (I am 98% uneducated about apache/server admin). I will save your post though MIchael, for when I get more to that level.. you gave a good lead. You've got mod_rewrite on there. If you're getting an error of some kind, you can let me know privately again. (Sorry to keep sending you back and forth!) Meanwhile, Dan you gave me the quick fix lead I was after. DirectoryIndex index.php works. Found it at http://httpd.apache.org/docs/1.3/mod/mod_dir.html#directoryindex -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Ask me about our fully-managed servers and proactive management clusters starting at just $200/mo.! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: namespace keyword
Martin Scotta wrote: Hil all I'm a 5.2.0 user (WINXP) I have a class like this... Class IsThisBad { const NAMESPACE = 'something'; /* code */ function __construct( $other=self::NAMESPACE ) { /* do stuff */ } } Recently the version 5.3 was released, so... should I change the const NAMESPACE in the class? Is it a reserved word? Yes. Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Implode a 2D Array
Can any one tell me how can i implode a two D Array. i can implode normal arrays, but when i try to implode multidimensional Arrays, the result is empty. can some one tell me how to implode an array Like This $x=array ( [0] = array ( [side] = sell [stock_code] = AFMC.CA [quantity] = 200 ) , [1] = array ( [side] = buy [stock_code] = AFMC.CA [quantity] = 200 ); i want to implode it in a way, the later one i can seperate rows, meaning i can seperate [0] from [1] and the elements in each row, like the side stock code using the SPLIT function. Thanks in Advance. :) -- View this message in context: http://www.nabble.com/Implode-a-2D-Array-tp24313886p24313886.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Implode a 2D Array
salmarayan wrote: Can any one tell me how can i implode a two D Array. i can implode normal arrays, but when i try to implode multidimensional Arrays, the result is empty. can some one tell me how to implode an array Like This $x=array ( [0] = array ( [side] = sell [stock_code] = AFMC.CA [quantity] = 200 ) , [1] = array ( [side] = buy [stock_code] = AFMC.CA [quantity] = 200 ); i want to implode it in a way, the later one i can seperate rows, meaning i can seperate [0] from [1] and the elements in each row, like the side stock code using the SPLIT function. Thanks in Advance. :) You'll have to be more specific in what you want the end result to be becuse I'm confused. You already have 0 and 1 separated. How do you want to glue them? Maybe you don't really want to implode() them? If you really want to implode each one, then: foreach($x as $array) { $row[] = implode(',', $array); } Or maybe (not tested): $rows = array_map('implode', array_fill(0, count($x), ','), $x); -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] generally, where in cPanel can one set the default page to load?
On Jul 2, 2009, at 11:40 AM, Daniel Brown wrote: On Thu, Jul 2, 2009 at 13:38, Govindagovinda.webdnat...@gmail.com wrote: I must not have mod-rewrite installed (I am 98% uneducated about apache/server admin). I will save your post though MIchael, for when I get more to that level.. you gave a good lead. You've got mod_rewrite on there. If you're getting an error of some kind, you can let me know privately again. (Sorry to keep sending you back and forth!) my error. sorry/thanks! -G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cannot figure out permissions for fopen/fwrite
The tmp folder isn't accessible from the web though, right? Someone would first have to get access to your server for that. On 7/1/09, Mari Masuda mbmas...@stanford.edu wrote: On Jul 1, 2009, at 12:54, Shawn McKenzie wrote: Mari Masuda wrote: On Jul 1, 2009, at 12:20, Shawn McKenzie wrote: Shawn McKenzie wrote: Mari Masuda wrote: Hello, This is probably a dumb newbie question. I am running PHP 5.2.5 and Apache 2.2.8 on my Mac Book Pro OS X 10.4.11. I compiled PHP and Apache from source a while ago (as opposed to using the built-in web server that is included w/ Mac OS X). I have written the below PHP whose purpose is to read an existing comma separated (CSV) file and save the data into a text file that I can later copy and paste from into my website content management system. The problem is that on my Mac, I cannot seem to figure out what permissions I need to set in order to make the input CSV and the initially non-existant output text file readable and writable by Apache/PHP. I have Googled and come across many pages about different ways to set permissions and different permissions to set but none of the ways suggested that I tried seemed to work for me. As a temporary solution, I uploaded my PHP file to a Windows 2003 server running Apache and PHP and it worked flawlessly (and makes me suspicious that there is some huge security hole with the Windows box since it was able to execute with no permissions modifications). Any tips would be greatly appreciated. Thanks! Mari --- start my code --- ?php $in = fopen(/Applications/apache/htdocs/wp-php/wp.csv, r); $out = fopen(/Applications/apache/htdocs/wp-php/tableToCutAndPaste.txt, w); $counter = 0; fwrite($out, table\n); while(($data = fgetcsv($in)) !== FALSE) { $paperNumber = $data[0]; $authors = $data[1]; $title = $data[2]; $filename = $paperNumber . .pdf; if(($counter % 2) == 0) { fwrite($out, tr\n); } else { fwrite($out, tr style=\background: #cc;\\n); } fwrite($out, tda href=\http://www.example.com/workingpapers/getWorkingPaper.php? filename=$filename\$paperNumber/a/td\n); fwrite($out, td$authors/td\n); fwrite($out, td$title/td\n); fwrite($out, /tr\n); $counter++; } fwrite($out, /table\n); fclose($in); fclose($out); ? --- end my code --- What are the permissions on /Applications/apache/htdocs/wp-php/ ? Apache needs write permissions on that dir in order to create the file tableToCutAndPaste.txt. It's probably not a secure idea to give write permissions to that dir, so maybe create a subdir of tmp and change those permissions (one way): mkdir /Applications/apache/htdocs/wp-php/tmp chmod a+w /Applications/apache/htdocs/wp-php/tmp Also, turn on error reporting so that you can see the exact problem. It may not be what you think. -- Thanks! -Shawn http://www.spidean.com Thanks for the suggestions. I added the following lines to the very top of my code: error_reporting(E_ALL); mkdir(/Applications/apache/htdocs/wp-php/tmp, 0777, true); chmod(/Applications/apache/htdocs/wp-php/tmp, a+w); and I also changed the line where it tries to open the file to write to to go to the new directory: $out = fopen(/Applications/apache/htdocs/wp-php/tmp/ tableToCutAndPaste.txt, w); Below are the errors I got: --- start errors --- Warning: mkdir() [function.mkdir]: Permission denied in /Applications/apache/htdocs/wp-php/generateTable.php on line 5 Warning: chmod() [function.chmod]: No such file or directory in /Applications/apache/htdocs/wp-php/generateTable.php on line 6 Warning: fopen(/Applications/apache/htdocs/wp-php/tmp/tableToCutAndPaste.txt) [function.fopen]: failed to open stream: No such file or directory in /Applications/apache/htdocs/wp-php/generateTable.php on line 9 Warning: fwrite(): supplied argument is not a valid stream resource in /Applications/apache/htdocs/wp-php/generateTable.php on line 13 Warning: fwrite(): supplied argument is not a valid stream resource in /Applications/apache/htdocs/wp-php/generateTable.php on line 22 Warning: fwrite(): supplied argument is not a valid stream resource in /Applications/apache/htdocs/wp-php/generateTable.php on line 27 Warning: fwrite(): supplied argument is not a valid stream resource in /Applications/apache/htdocs/wp-php/generateTable.php on line 28 Warning: fwrite(): supplied argument is not a valid stream resource in /Applications/apache/htdocs/wp-php/generateTable.php on line 29 Warning: fwrite(): supplied argument is not a valid stream resource in /Applications/apache/htdocs/wp-php/generateTable.php on line 30 Warning: fwrite(): supplied argument is not a valid stream resource in /Applications/apache/htdocs/wp-php/generateTable.php on line 35 Warning: fclose():
[PHP] Sessions
Hello all, Do I have to add session_start() at the beginning of every page so that the $_SESSION variables work on all pages or do I use session_start() on the first page and something else on other pages? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions
On Thu, Jul 2, 2009 at 23:27, Jason Carsonja...@jasoncarson.ca wrote: Hello all, Do I have to add session_start() at the beginning of every page so that the $_SESSION variables work on all pages or do I use session_start() on the first page and something else on other pages? Yes, unless you're using session autoloading. Also, in most cases, you will only need to call session_start() once (before referencing $_SESSION), even if $_SESSION is accessed in an included file. -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Check out our hosting and dedicated server deals at http://twitter.com/pilotpig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cannot figure out permissions for fopen/fwrite
Yes, currently the tmp folder (or any folders in my Apache htdocs folder) is not accessible to the web due to the Mac's built-in firewall set to block all incoming traffic except network time and something installed by Adobe when I installed CS4 (e.g., Photoshop, InDesign, etc.). However, I was wondering what the normal technique is for writing files if the script that does the fopen/fwrite is located on a production server that IS on the web. It occurred to me that I could create a 777 folder outside of the web root so that it would not be accessible on the web even if the script was running on a production server, but I wasn't sure if that was a good or bad idea. On Jul 2, 2009, at 17:59, Waynn Lue wrote: The tmp folder isn't accessible from the web though, right? Someone would first have to get access to your server for that. On 7/1/09, Mari Masuda mbmas...@stanford.edu wrote: On Jul 1, 2009, at 12:54, Shawn McKenzie wrote: Mari Masuda wrote: On Jul 1, 2009, at 12:20, Shawn McKenzie wrote: Shawn McKenzie wrote: Mari Masuda wrote: Hello, This is probably a dumb newbie question. I am running PHP 5.2.5 and Apache 2.2.8 on my Mac Book Pro OS X 10.4.11. I compiled PHP and Apache from source a while ago (as opposed to using the built-in web server that is included w/ Mac OS X). I have written the below PHP whose purpose is to read an existing comma separated (CSV) file and save the data into a text file that I can later copy and paste from into my website content management system. The problem is that on my Mac, I cannot seem to figure out what permissions I need to set in order to make the input CSV and the initially non-existant output text file readable and writable by Apache/PHP. I have Googled and come across many pages about different ways to set permissions and different permissions to set but none of the ways suggested that I tried seemed to work for me. As a temporary solution, I uploaded my PHP file to a Windows 2003 server running Apache and PHP and it worked flawlessly (and makes me suspicious that there is some huge security hole with the Windows box since it was able to execute with no permissions modifications). Any tips would be greatly appreciated. Thanks! Mari --- start my code --- ?php $in = fopen(/Applications/apache/htdocs/wp-php/wp.csv, r); $out = fopen(/Applications/apache/htdocs/wp-php/ tableToCutAndPaste.txt, w); $counter = 0; fwrite($out, table\n); while(($data = fgetcsv($in)) !== FALSE) { $paperNumber = $data[0]; $authors = $data[1]; $title = $data[2]; $filename = $paperNumber . .pdf; if(($counter % 2) == 0) { fwrite($out, tr\n); } else { fwrite($out, tr style=\background: #cc;\ \n); } fwrite($out, tda href=\http://www.example.com/workingpapers/getWorkingPaper.php? filename=$filename\$paperNumber/a/td\n); fwrite($out, td$authors/td\n); fwrite($out, td$title/td\n); fwrite($out, /tr\n); $counter++; } fwrite($out, /table\n); fclose($in); fclose($out); ? --- end my code --- What are the permissions on /Applications/apache/htdocs/wp-php/ ? Apache needs write permissions on that dir in order to create the file tableToCutAndPaste.txt. It's probably not a secure idea to give write permissions to that dir, so maybe create a subdir of tmp and change those permissions (one way): mkdir /Applications/apache/htdocs/wp-php/tmp chmod a+w /Applications/apache/htdocs/wp-php/tmp Also, turn on error reporting so that you can see the exact problem. It may not be what you think. -- Thanks! -Shawn http://www.spidean.com Thanks for the suggestions. I added the following lines to the very top of my code: error_reporting(E_ALL); mkdir(/Applications/apache/htdocs/wp-php/tmp, 0777, true); chmod(/Applications/apache/htdocs/wp-php/tmp, a+w); and I also changed the line where it tries to open the file to write to to go to the new directory: $out = fopen(/Applications/apache/htdocs/wp-php/tmp/ tableToCutAndPaste.txt, w); Below are the errors I got: --- start errors --- Warning: mkdir() [function.mkdir]: Permission denied in /Applications/apache/htdocs/wp-php/generateTable.php on line 5 Warning: chmod() [function.chmod]: No such file or directory in /Applications/apache/htdocs/wp-php/generateTable.php on line 6 Warning: fopen(/Applications/apache/htdocs/wp-php/tmp/ tableToCutAndPaste.txt) [function.fopen]: failed to open stream: No such file or directory in /Applications/apache/htdocs/wp-php/generateTable.php on line 9 Warning: fwrite(): supplied argument is not a valid stream resource in /Applications/apache/htdocs/wp-php/generateTable.php on line 13 Warning: fwrite(): supplied argument is not a valid stream resource in /Applications/apache/htdocs/wp-php/generateTable.php on line 22 Warning: fwrite(): supplied argument is not a
[PHP] Encoding problems on IIS7 + FastCGI on windows server 2008
Hi, The php scripts works OK on windows 2000 server ( it supports chinese, english japanese - UTF-8 encoding) but it shows ??? ( non-english chars ) when copied to IIS7 + Fastcgi on windows 2008. Is there some settings to change in php.ini ? Regards, Jon Lau -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php