Re: [PHP] MIME type
Look up readfile(); Make sure you read the comments. On 9/11/07, Angelo Zanetti [EMAIL PROTECTED] wrote: Hi guys. I am linking to a file on a WAP site. the backend is written in PHP. However I need to link to a file but set the content type. I've done the following and am wondering if this is correct: ? // We'll be outputting a PDF header('Content-type: application/vnd.symbian.install'); // It will be called downloaded.pdf header('Content-Disposition: attachment; filename=../File/norEnglish.sis'); ? So basically I set the HREF to the file above (filename .php). Let me know if there is anything that im doing incorrectly. Thanks -- Angelo Zanetti Systems developer *Telephone:* +27 (021) 552 9799 *Mobile:* +27 (0) 72 441 3355 *Fax:*+27 (0) 86 681 5885 * Web:* http://www.zlogic.co.za *E-Mail:* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- 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] Just Thanks..
IRIran.net'Remove page referrer' was my first question from PHP.net mailing lists, that's great :) , php have a good support , I think all php lovers gather here :) , I love this place , Thanks to all
[PHP] html to xml?
i need to parse an html page for tabular data which i can then import into mysql so i thought converting the html to xml might be a feasible thing to do, however, other than using tidy from the command line i can't find a way to do this from php. does anyone know of any class (or other) that would allow me to do this? or maybe i just need a different approach. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MIME type
Thanks heavyccasey Im not sure which comment you are referring to, perhaps this one? There are many posts. |?php $file = '/var/www/html/file-to-download.xyz'; header('Content-Description: File Transfer'); header('Content-Type: application/force-download'); header('Content-Length: ' . filesize($filename)); header('Content-Disposition: attachment; filename=' . basename($file)); readfile($file); ?| [EMAIL PROTECTED] wrote: Look up readfile(); Make sure you read the comments. On 9/11/07, Angelo Zanetti [EMAIL PROTECTED] wrote: Hi guys. I am linking to a file on a WAP site. the backend is written in PHP. However I need to link to a file but set the content type. I've done the following and am wondering if this is correct: ? // We'll be outputting a PDF header('Content-type: application/vnd.symbian.install'); // It will be called downloaded.pdf header('Content-Disposition: attachment; filename=../File/norEnglish.sis'); ? So basically I set the HREF to the file above (filename .php). Let me know if there is anything that im doing incorrectly. Thanks -- Angelo Zanetti Systems developer *Telephone:* +27 (021) 552 9799 *Mobile:* +27 (0) 72 441 3355 *Fax:*+27 (0) 86 681 5885 * Web:* http://www.zlogic.co.za *E-Mail:* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Angelo Zanetti Systems developer *Telephone:* +27 (021) 552 9799 *Mobile:* +27 (0) 72 441 3355 *Fax:*+27 (0) 86 681 5885 * Web:* http://www.zlogic.co.za *E-Mail:* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] html to xml?
Slith wrote: i need to parse an html page for tabular data which i can then import into mysql so i thought converting the html to xml might be a feasible thing to do, however, other than using tidy from the command line i can't find a way to do this from php. does anyone know of any class (or other) that would allow me to do this? or maybe i just need a different approach. Is this a one-off or will you be doing this often? For a one-off I would just use sed/grep/awk/cut/tr etc. - HTML pages are rarely syntactically correct, so trying to parse them or even turn them into XML is tiresome at best. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP 5.2.3 - Segmentation fault (core dumped)
Dear all, I hope you can help me. I am running FreeBSD 6.2 and I decided to upgrade from php 4.4.7_1 to php5-5.2.3_1. However, after removing php4 and installing php5 and php5-extensions I am unable to start apache. php -v: PHP 5.2.3 with Suhosin-Patch 0.9.6.2 (cli) (built: Sep 12 2007 08:59:52) Copyright (c) 1997-2007 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies Segmentation fault (core dumped) pkg_info | grep php5 php5-5.2.3_1PHP Scripting Language (Apache Module and CLI) php5-bcmath-5.2.3_1 The bcmath shared extension for php php5-bz2-5.2.3_1The bz2 shared extension for php php5-calendar-5.2.3_1 The calendar shared extension for php php5-ctype-5.2.3_1 The ctype shared extension for php php5-curl-5.2.3_1 The curl shared extension for php php5-dbase-5.2.3_1 The dbase shared extension for php php5-dom-5.2.3_1The dom shared extension for php php5-exif-5.2.3_1 The exif shared extension for php php5-extensions-1.1 A meta-port to install PHP extensions php5-ftp-5.2.3_1The ftp shared extension for php php5-gd-5.2.3_1 The gd shared extension for php php5-gettext-5.2.3_1 The gettext shared extension for php php5-gmp-5.2.3_1The gmp shared extension for php php5-iconv-5.2.3_1 The iconv shared extension for php php5-imap-5.2.3_1 The imap shared extension for php php5-mbstring-5.2.3_1 The mbstring shared extension for php php5-mcrypt-5.2.3_1 The mcrypt shared extension for php php5-mhash-5.2.3_1 The mhash shared extension for php php5-mysql-5.2.3_1 The mysql shared extension for php php5-mysqli-5.2.3_1 The mysqli shared extension for php php5-openssl-5.2.3_1 The openssl shared extension for php php5-pcre-5.2.3_1 The pcre shared extension for php php5-pdo-5.2.3_1The pdo shared extension for php php5-pdo_sqlite-5.2.3_1 The pdo_sqlite shared extension for php php5-posix-5.2.3_3 The posix shared extension for php php5-pspell-5.2.3_1 The pspell shared extension for php php5-session-5.2.3_1 The session shared extension for php php5-simplexml-5.2.3_1 The simplexml shared extension for php php5-soap-5.2.3_1 The soap shared extension for php php5-sockets-5.2.3_1 The sockets shared extension for php php5-spl-5.2.3_1The spl shared extension for php php5-sqlite-5.2.3_1 The sqlite shared extension for php php5-tokenizer-5.2.3_1 The tokenizer shared extension for php php5-xml-5.2.3_1The xml shared extension for php php5-xmlreader-5.2.3_1 The xmlreader shared extension for php php5-xmlrpc-5.2.3_1 The xmlrpc shared extension for php php5-xmlwriter-5.2.3_1 The xmlwriter shared extension for php php5-zlib-5.2.3_1 The zlib shared extension for php httpd -v Server version: Apache/1.3.39 (Unix) Server built: Sep 11 2007 20:48:37 Many thanks for your help! Zbigniew Szalbot -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] html to xml?
Slith wrote: i need to parse an html page for tabular data which i can then import into mysql so i thought converting the html to xml might be a feasible thing to do, however, other than using tidy from the command line i can't find a way to do this from php. does anyone know of any class (or other) that would allow me to do this? or maybe i just need a different approach. Is this a one-off or will you be doing this often? For a one-off I would just use sed/grep/awk/cut/tr etc. - HTML pages are rarely syntactically correct, so trying to parse them or even turn them into XML is tiresome at best. For one-off, I'd simply copy/paste the data from the browser into Excel/OO Calc and save as CSV. Edward -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
Dear all, I hope you can help me. I am running FreeBSD 6.2 and I decided to upgrade from php 4.4.7_1 to php5-5.2.3_1. However, after removing php4 and installing php5 and php5-extensions I am unable to start apache. What do the Apache error logs say? Edward -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
Hello, 2007/9/12, Edward Kay [EMAIL PROTECTED]: Dear all, I hope you can help me. I am running FreeBSD 6.2 and I decided to upgrade from php 4.4.7_1 to php5-5.2.3_1. However, after removing php4 and installing php5 and php5-extensions I am unable to start apache. What do the Apache error logs say? Nothing that would be of help: httpd-error.log [Wed Sep 12 09:04:17 2007] [notice] mod_security/1.9.4 configured A new such line is added when I try to start apache. Apache does not start even when I use non-ssl option (apachectl start). messages: Sep 12 12:04:44 szalbot kernel: pid 26602 (httpd), uid 0: exited on signal 11 (core dumped) Many thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
Zbigniew Szalbot wrote: Hello, 2007/9/12, Edward Kay [EMAIL PROTECTED]: What do the Apache error logs say? Nothing that would be of help: httpd-error.log [Wed Sep 12 09:04:17 2007] [notice] mod_security/1.9.4 configured A new such line is added when I try to start apache. Apache does not start even when I use non-ssl option (apachectl start). messages: Sep 12 12:04:44 szalbot kernel: pid 26602 (httpd), uid 0: exited on signal 11 (core dumped) Migrating from v4 to v5 is not necessarily straight forward. Depending on what features you've used, you may have to rewrite some of your code. For instance, we used the xslt sablotron interface, which no longer exists in php5. Had to rewrite, which as it turns out was not too much effort, but I'm sure there are other more complex examples. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
Hi there, 2007/9/12, Per Jessen [EMAIL PROTECTED]: Zbigniew Szalbot wrote: Hello, 2007/9/12, Edward Kay [EMAIL PROTECTED]: What do the Apache error logs say? Nothing that would be of help: httpd-error.log [Wed Sep 12 09:04:17 2007] [notice] mod_security/1.9.4 configured A new such line is added when I try to start apache. Apache does not start even when I use non-ssl option (apachectl start). messages: Sep 12 12:04:44 szalbot kernel: pid 26602 (httpd), uid 0: exited on signal 11 (core dumped) Migrating from v4 to v5 is not necessarily straight forward. Depending on what features you've used, you may have to rewrite some of your code. For instance, we used the xslt sablotron interface, which no longer exists in php5. Had to rewrite, which as it turns out was not too much effort, but I'm sure there are other more complex examples. No, basically I just use wordpress on this site and that's all. No fancy or advanced scripting, etc. It is family machine for family issues. I can try and go back to v4 but I do think v5 should work just as fine. At least I hope so. Thank you! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
Zbigniew Szalbot wrote: No, basically I just use wordpress on this site and that's all. No fancy or advanced scripting, etc. It is family machine for family issues. I can try and go back to v4 but I do think v5 should work just as fine. At least I hope so. Hi Zbigniew Maybe it's worth doing some googling for wordpress and php5? If it's not your code, it's not easy to debug. I have seen the apache core dump many times, sometimes caused by obvious errors, other times by something obscure and difficult to find. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
Zbigniew Szalbot wrote: Hi there, No, basically I just use wordpress on this site and that's all. No fancy or advanced scripting, etc. It is family machine for family issues. I can try and go back to v4 but I do think v5 should work just as fine. At least I hope so. Does phpinfo work? What does it say? Also, when you have problems like this, he best to do is put error reporting to E_ALL and display_errors=on. -- 21:50:04 up 2 days, 9:07, 0 users, load average: 0.92, 0.37, 0.18 - Lic. Martín Marqués | SELECT 'mmarques' || Centro de Telemática| '@' || 'unl.edu.ar'; Universidad Nacional| DBA, Programador, del Litoral | Administrador - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
Per Jessen wrote: Zbigniew Szalbot wrote: No, basically I just use wordpress on this site and that's all. No fancy or advanced scripting, etc. It is family machine for family issues. I can try and go back to v4 but I do think v5 should work just as fine. At least I hope so. Hi Zbigniew Maybe it's worth doing some googling for wordpress and php5? If it's not your code, it's not easy to debug. I have seen the apache core dump many times, sometimes caused by obvious errors, other times by something obscure and difficult to find. Come on guys, use your heads. PHP is segfaulting when trying to display its version number - that's not going to have anything to do with Wordpress. To the OP: This probably means you've got a rogue extension in the mix. Edit /usr/local/etc/php/extensions.ini and put a # in front of every line. Try php -v again. If it works then you need to uncomment (remove the #) each line in that file one by one checking php -v each time until you find the one that's a problem. If it's an extension you need I suggest you uninstall and rebuild it. If not then just leave it commented and move on to the next. If php -v still segfaults with all the extensions disabled then you need to uninstall PHP and all the extensions completely and start again because something obviously went wrong when you built them. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] my paging task with PHP does not work. It uses cookie.
Dear my friends... I am trying to display the content of a table. Each page must content only 5 records maximum. Each page has Previous and Next buttons (made from anchor). I dump the primary of the working table and keep it in a cookie. So than the paging task work with the index of cookie array. But the $curguruescomidiklan stays 0 each time I click Next button. The main part of doing the paging task is this lines: for ($it=$curguruescomidiklan;$it$itot;$it++){ $idad=$guruescomidiklan[$it]; echo idad= $idadbr; echo it: $itbr; bukaiklan($idad); } . Please tell me why PHP does not work as I expect. Thank you very much in advance. = html ?php session_start(); session_register(tiket); setcookie(curguruescomidiklan); setcookie(guruescomidiklan,); setcookie(jmli); $tiket=session_id(); $pageamount = 5; ? table align=center tr !--Bagian Pencari Kerja-- td valign=top background=gambar/gbkiri.gif table align=right border=0 cellpadding=0 cellspacing=0 width=300 tr td align=left table border=1 cellpadding=0 cellspacing=0 ?php if ($curguruescomidiklan0){ echo trtda href=\index.php?p=t\ style=\text-decoration:none;\Previous/a/td/tr; } ? /table /td td/td td align=right table border=1 cellpadding=0 cellspacing=0 trtd ?php if (($jmli % $curguruescomidiklan)1 or $curguruescomidiklan==0){ echo a href=\index.php?p=n\ style=\text-decoration:none;\Next/a/td/tr; } ? /td/tr /table /td /tr trtd ?php echo trth colspan=12Lowongan Kerja/th/tr; include_once koneksi.php; $sqlnya= select l.id_iklan from perusahaan as p right join lowongan as l on l.id_account=p.id_account where l.lama_tayang = (current_date-l.mulai_tayang) order by bid desc ; $kelas=new koneksi(); $klas=$kelas-getkoneksi(headhunter,$sqlnya); $jmli=mysql_num_rows($klas); if ( $jmli 0 ) { $i=0; while(list($idiklan)=mysql_fetch_row($klas)) { // echo ID Iklannya: $idiklanbr; setcookie(guruescomidiklan[$i],$idiklan); $i++; } } else { echo No Ad of job vacancy currently in our databasebr; } if (empty($curguruescomidiklan)){ $curguruescomidiklan=0; } //echo pa: $pageamountbr; if (isset($p)){ $nt=$_GET['p']; } //I meant this part should direct the page content to be the next array contents if ($jmli=$pageamount){ echo curguruescomidiklan --$curguruescomidiklanbr; if ($nt=='t'){ $itot=$_COOKIE['curguruescomidiklan']-$pageamount; }else{ $itot=$_COOKIE['curguruescomidiklan']+$pageamount; echo lewat sini $curguruescomidiklan $pageamountbr; } echo itot 1 --$itotbr; }else{ $itot=$jmltot; echo itot 2 --$itotbr; } for ($it=$curguruescomidiklan;$it$itot;$it++){ $idad=$guruescomidiklan[$it]; echo idad= $idadbr; echo it: $itbr; bukaiklan($idad); } $itot=$itot+$pageamount; setcookie(curguruescomidiklan,$itot); echo curguruescomidiklan-- $curguruescomidiklanbr; function bukaiklan($myid){ //echo myid=$myidbr; $sqlnya= select p.company_fullname, p.company_address, p.city, p.country, p.postcode, p.phone, p.fax, p.url, p.company_description, l.iklan, l.id_iklan from perusahaan as p right join lowongan as l on l.id_account=p.id_account where l.lama_tayang = (current_date-l.mulai_tayang) and l.id_iklan='$myid' order by bid desc ; $kelassqlbukaiklan=new koneksi(); $klassqlbukaiklan=$kelassqlbukaiklan-getkoneksi(headhunter,$sqlnya); if ( mysql_num_rows($klassqlbukaiklan) 0 ) { while(list($namaprsh, $alamat, $kota, $negara, $kodepos, $telfon, $faks, $url, $comdesc, $iklan, $idiklan)=mysql_fetch_row($klassqlbukaiklan)) { echo trtd valign=\top\Employer/tdtd valign=\top\:/tdtd valign=\top\ colspan=10$namaprsh/td/tr; echo trtd valign=\top\Address/tdtd valign=\top\:/tdtd valign=\top\ colspan=10$alamat/td/tr; echo trtd valign=\top\City/tdtd valign=\top\:/tdtd valign=\top\ colspan=10$kota/td/tr; echo trtd valign=\top\Country/tdtd valign=\top\:/tdtd valign=\top\ colspan=10$negara/td/tr; echo trtd valign=\top\Postcode/tdtd valign=\top\:/tdtd colspan=10 valign=\top\$kodepos/td/tr; echo trtd valign=\top\Fax/tdtd valign=\top\:/tdtd valign=\top\ colspan=10$faks/td/tr; echo trtd valign=\top\Website/tdtd valign=\top\:/tdtd colspan=10 valign=\top\$url/td/tr; echo trtd valign=\top\Business Field/tdtd valign=\bottom\:/tdtd valign=\bottom\ colspan=10$comdesc/td/tr; echo trtd colspan=12$iklan/td/tr; echo trtd colspan=12 height=16/td/tr; } } else { echo No Ad of job vacancy currently in our database, possibly ads-id wrong.br; } } ? /td/tr/table /td !--Bagian Toko Buku Guru-- td valign=top /td !--Bagian Employer-- td valign=top /td /tr /table /body /html -- Patrik
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
Stut wrote: Hi Zbigniew Maybe it's worth doing some googling for wordpress and php5? If it's not your code, it's not easy to debug. I have seen the apache core dump many times, sometimes caused by obvious errors, other times by something obscure and difficult to find. Come on guys, use your heads. PHP is segfaulting when trying to display its version number - that's not going to have anything to do with Wordpress. Uh, how do know you it's do with the version-number?? Did I miss that posting? Anyway, I think it's exceptionally poor show by php to cause a segfault, probably due to user code. I know it does it every now and then, and nobody has ever been interested in looking at the core dump. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
On 9/12/07, Per Jessen [EMAIL PROTECTED] wrote: Migrating from v4 to v5 is not necessarily straight forward. Depending on what features you've used, you may have to rewrite some of your code. For instance, we used the xslt sablotron interface, which no longer exists in php5. Had to rewrite, which as it turns out was not too much effort, but I'm sure there are other more complex examples. While that's probable true, it wouldn't stop Apache from loading. At the far outside realm of possibility, user code could cause PHP to segfault and crash Apache, but when the httpd daemon is loading, it's not scanning the user scripts. Zbigniew, when you're checking the version number, keep in mind that it's only for the CLI --- completely different from the Apache module. Did you upgrade Apache in the process? Because the core that was dumped was the Apache server's binary (httpd), which may indicate that it's pure coincidence with the PHP version upgrade. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Give a man a fish, he'll eat for a day. Then you'll find out he was allergic and is hospitalized. See? No good deed goes unpunished -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
[snip] Anyway, I think it's exceptionally poor show by php to cause a segfault, probably due to user code. I know it does it every now and then, and nobody has ever been interested in looking at the core dump. [/snip] The Dev team looks at core dumps all of the time to try to figure out bugs and other problems. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
On 9/12/07, Daniel Brown [EMAIL PROTECTED] wrote: On 9/12/07, Per Jessen [EMAIL PROTECTED] wrote: Migrating from v4 to v5 is not necessarily straight forward. Depending on what features you've used, you may have to rewrite some of your code. For instance, we used the xslt sablotron interface, which no longer exists in php5. Had to rewrite, which as it turns out was not too much effort, but I'm sure there are other more complex examples. While that's probable true, it wouldn't stop Apache from loading. At the far outside realm of possibility, user code could cause PHP to segfault and crash Apache, but when the httpd daemon is loading, it's not scanning the user scripts. Zbigniew, when you're checking the version number, keep in mind that it's only for the CLI --- completely different from the Apache module. Did you upgrade Apache in the process? Because the core that was dumped was the Apache server's binary (httpd), which may indicate that it's pure coincidence with the PHP version upgrade. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Give a man a fish, he'll eat for a day. Then you'll find out he was allergic and is hospitalized. See? No good deed goes unpunished Okay, I just re-read the original post and I see that the CLI is actually segfault'ing, too. I should really finish my first cup of coffee before attempting to reply to the list. Are you using eAccelerator by chance? I have that on a box with 5.0.4, but noticed problems with that when I used it in combination with 5.2.3 (among other issues). -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Give a man a fish, he'll eat for a day. Then you'll find out he was allergic and is hospitalized. See? No good deed goes unpunished -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
Per Jessen wrote: Uh, how do know you it's do with the version-number?? Did I miss that posting? Not necessarily to do with the version number itself - it's that PHP is dying before having actually done anything - it never gets to any PHP code. From the first post - the last line of what I pasted below: php -v: PHP 5.2.3 with Suhosin-Patch 0.9.6.2 (cli) (built: Sep 12 2007 08:59:52) Copyright (c) 1997-2007 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies Segmentation fault (core dumped) In my experience, the Suhosin patch (while excellent for security) caused significant instability in several modules. I ended up having to scrap it. (It may not have been the patch - it could easily have been several of the PECL modules we were using. Regardless, they didn't segfault without the Suhosin patch.) If possible, you could try building without the patch. Assuming your machine isn't overclocked and has been tested for hardware problems... If the version of PHP you're using is a binary package, you should probably generate a backtrace from the core that was dumped and report it as a bug to the provider of that binary. The same goes if it was built as a FreeBSD port - they should probably know that their default port builds are segfaulting. I think Stut's advice for troubleshooting is a good path to take as well. jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
Per Jessen wrote: Stut wrote: Hi Zbigniew Maybe it's worth doing some googling for wordpress and php5? If it's not your code, it's not easy to debug. I have seen the apache core dump many times, sometimes caused by obvious errors, other times by something obscure and difficult to find. Come on guys, use your heads. PHP is segfaulting when trying to display its version number - that's not going to have anything to do with Wordpress. Uh, how do know you it's do with the version-number?? Did I miss that posting? From the original post... php -v: PHP 5.2.3 with Suhosin-Patch 0.9.6.2 (cli) (built: Sep 12 2007 08:59:52) Copyright (c) 1997-2007 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies Segmentation fault (core dumped) Anyway, I think it's exceptionally poor show by php to cause a segfault, probably due to user code. I know it does it every now and then, and nobody has ever been interested in looking at the core dump. This will have nothing to do with user code since no user code is involved in displaying the version info. It's most likely a problem with mixed version numbers, or possibly (but unlikely) a configuration issue. If there's an auto_prepend_file or auto_append_file in the configuration that may be loaded by php -v, I'm not sure. Blaming PHP for this is like blaming Microsoft because Photoshop crashed on a Windows machine. It's possible PHP is to blame but there is a whole stack of other considerations to go through before coming to that conclusion. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
Jon Anderson wrote: If the version of PHP you're using is a binary package, you should probably generate a backtrace from the core that was dumped and report it as a bug to the provider of that binary. The same goes if it was built as a FreeBSD port - they should probably know that their default port builds are segfaulting. I agree, except that you need to isolate whether it's an extension causing the segfault or PHP itself. I'd bet lunch on it being an extension. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
I have the same problem with PHP-5.2.3 on my freebsd 6.2. After commenting recode, sockets, ming, sysvshm modules, there were no more core dumps. So, you have to comment the sockets modules in extension.ini and everything will work fine.
[PHP] PHP Installer on Vista
Ave, Is it true that the PHP Installer does not work on Windows Vista? And if it does, it only installs the CGI version? ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely²
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
Per Jessen wrote: Maybe it's worth doing some googling for wordpress and php5? If it's not your code, it's not easy to debug. I have seen the apache core dump many times, sometimes caused by obvious errors, other times by something obscure and difficult to find. Come on guys, use your heads. PHP is segfaulting when trying to display its version number - that's not going to have anything to do with Wordpress. Uh, how do know you it's do with the version-number?? Did I miss that posting? Anyway, I think it's exceptionally poor show by php to cause a segfault, probably due to user code. I know it does it every now and then, and nobody has ever been interested in looking at the core dump. Zbigniew has not actually managed to get Apache started with PHP installed so trying to debug stuff running in PHP is a little pointless. Zbigniew - It is most likely one of the extensions is not able to load. I used to get the same problem with Windows, but without a seg fault nowadays - just a 'can't start'. -- Lester Caine - G8HFL - Contact - http://home.lsces.co.uk/lsces/wiki/?page=contact L.S.Caine Electronic Services - http://home.lsces.co.uk MEDW - http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/ 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: [PHP] PHP Installer on Vista
Rahul Sitaram Johari wrote: Ave, Is it true that the PHP Installer does not work on Windows Vista? And if it does, it only installs the CGI version? ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely² Did you try it? Easiest way to find out... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Installer on Vista
On 9/12/07 10:56 AM, M. Sokolewicz [EMAIL PROTECTED] wrote: Did you try it? Easiest way to find out... I installed - it didn't give me any errors - but PHP is not working. Apache starts without any errors either. The thing is, I can easily remove the installation and install PHP manually (Something I have done before) and then PHP will work - but I did want to establish whether the Installer Works on Vista or Not! On the other hand - if it is a fact that the Installer only installs PHP as CGI - then I won't even bother because I don't want PHP as CGI. Make sense? ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely² -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Publxic Announcement
On Tue, 11 Sep 2007, Tom Ray [Lists] wrote: Has anyone tried Nginx? The rewrite rules are a bit more clear than those of the Apache mod_rewrite variety. http://wiki.codemongers.com/NginxHttpRewriteModule But is it the greatest weapon system of our time? If its not then it's nothing to me. It is written by some very smart Russians.. -- Greg Donald Cyberfusion Consulting http://cyberfusionconsulting.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
Daniel Brown wrote: On 9/12/07, Per Jessen [EMAIL PROTECTED] wrote: Migrating from v4 to v5 is not necessarily straight forward. Depending on what features you've used, you may have to rewrite some of your code. For instance, we used the xslt sablotron interface, which no longer exists in php5. Had to rewrite, which as it turns out was not too much effort, but I'm sure there are other more complex examples. While that's probable true, it wouldn't stop Apache from loading. At the far outside realm of possibility, user code could cause PHP to segfault and crash Apache, but when the httpd daemon is loading, it's not scanning the user scripts. Sorry, I have to disagree strongly here. I have seen apache core dump many times due to PHP user code. I've also opened bug-reports based on such core-dumps, but the PHP developer community is not interested/capable in debugging in that fashion, IMHO. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
Lester Caine wrote: Anyway, I think it's exceptionally poor show by php to cause a segfault, probably due to user code. I know it does it every now and then, and nobody has ever been interested in looking at the core dump. Zbigniew has not actually managed to get Apache started with PHP installed so trying to debug stuff running in PHP is a little pointless. You don't actually need anything running to debug it. There is a core dump, that's plenty of diagnostics. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
On 9/12/07, Per Jessen [EMAIL PROTECTED] wrote: Sorry, I have to disagree strongly here. I have seen apache core dump many times due to PHP user code. I've also opened bug-reports based on such core-dumps, but the PHP developer community is not interested/capable in debugging in that fashion, IMHO. Right, and I'll agree with you that user code can cause that, which I mentioned. However, in the context of this issue, it's when Apache is first starting, prior to ever even being requested to serve the content. Hence my assertion. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Give a man a fish, he'll eat for a day. Then you'll find out he was allergic and is hospitalized. See? No good deed goes unpunished -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
Stut wrote: Anyway, I think it's exceptionally poor show by php to cause a segfault, probably due to user code. I know it does it every now and then, and nobody has ever been interested in looking at the core dump. This will have nothing to do with user code since no user code is involved in displaying the version info. It's most likely a problem with mixed version numbers, or possibly (but unlikely) a configuration issue. If there's an auto_prepend_file or auto_append_file in the configuration that may be loaded by php -v, I'm not sure. Blaming PHP for this is like blaming Microsoft because Photoshop crashed on a Windows machine. It's possible PHP is to blame but there is a whole stack of other considerations to go through before coming to that conclusion. Stut, put this problem aside for a sec, and let me ask this - if I can produce an apache core-dump using vanilla apache, vanilla php (even with no extensions if you want) and a PHP script, you'll get someone to debug it? (I cannot promise a easily reproducable problem, just the core-dump, and a few hundred lines of script) FYI, I've tried that before, and the PHP developers are not interested and/or they do not work with core dumps. I still maintain it is exceptionally poor show by php to let user code produce segfaults in apache. Here's a brief excerpt from a recent apache error-log: [Thu Aug 30 12:31:20 2007] [notice] child pid 18836 exit signal Segmentation fault (11) [Fri Sep 07 10:09:22 2007] [notice] child pid 2634 exit signal Segmentation fault (11) [Fri Sep 07 12:25:07 2007] [notice] child pid 18835 exit signal Segmentation fault (11) [Fri Sep 07 12:26:10 2007] [notice] child pid 18834 exit signal Segmentation fault (11) [Fri Sep 07 12:26:48 2007] [notice] child pid 21729 exit signal Segmentation fault (11) [Fri Sep 07 17:18:55 2007] [notice] child pid 18647 exit signal Segmentation fault (11) [Fri Sep 07 21:04:45 2007] [notice] child pid 20318 exit signal Segmentation fault (11) [Fri Sep 07 21:04:54 2007] [notice] child pid 18403 exit signal Segmentation fault (11) [Sun Sep 09 17:43:26 2007] [notice] child pid 18826 exit signal Segmentation fault (11) [Sun Sep 09 17:43:53 2007] [notice] child pid 18827 exit signal Segmentation fault (11) [Sun Sep 09 17:44:10 2007] [notice] child pid 18825 exit signal Segmentation fault (11) [Sun Sep 09 17:45:08 2007] [notice] child pid 18447 exit signal Segmentation fault (11) [Sun Sep 09 17:45:24 2007] [notice] child pid 18785 exit signal Segmentation fault (11) [Sun Sep 09 17:46:06 2007] [notice] child pid 25399 exit signal Segmentation fault (11) [Mon Sep 10 15:18:52 2007] [notice] child pid 28626 exit signal Segmentation fault (11) [Mon Sep 10 15:19:22 2007] [notice] child pid 28608 exit signal Segmentation fault (11) [Mon Sep 10 15:20:10 2007] [notice] child pid 28856 exit signal Segmentation fault (11) [Mon Sep 10 15:20:12 2007] [notice] child pid 28605 exit signal Segmentation fault (11) [Mon Sep 10 15:23:07 2007] [notice] child pid 28607 exit signal Segmentation fault (11) [Mon Sep 10 18:31:39 2007] [notice] child pid 20378 exit signal Segmentation fault (11) These were all caused by PHP user code with PHP5 and apache22. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
Jay Blanchard wrote: [snip] Anyway, I think it's exceptionally poor show by php to cause a segfault, probably due to user code. I know it does it every now and then, and nobody has ever been interested in looking at the core dump. [/snip] The Dev team looks at core dumps all of the time to try to figure out bugs and other problems. Whenever I've reported a core-dump (which I've stopped doing), nothing's been done about it unless I've been able to produce a short script to reproduce. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: RE: Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
[snip] [snip] Anyway, I think it's exceptionally poor show by php to cause a segfault, probably due to user code. I know it does it every now and then, and nobody has ever been interested in looking at the core dump. [/snip] The Dev team looks at core dumps all of the time to try to figure out bugs and other problems. Whenever I've reported a core-dump (which I've stopped doing), nothing's been done about it unless I've been able to produce a short script to reproduce. [/snip] That is to be expected and is standard operating procedure for any development team. In order to replicate the issue they have to duplicate the action that caused the failure. You see that time and again on this list as wellwithout the offending action all we can do is attempt to guess at what was going on at the time of the failure. Diligent trouble-shooting on your part would have gotten a much better response. You could have likely isolated the code that caused the core dump (just as we isolate problem code on this list...see yesterday's SEARCHING for an answer thread), provided that to the dev team (as I have done before) and gotten a response. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] my paging task with PHP does not work. It uses cookie.
Patrik Hasibuan wrote: Dear my friends... I am trying to display the content of a table. Each page must content only 5 records maximum. Each page has Previous and Next buttons (made from anchor). I dump the primary of the working table and keep it in a cookie. So than the paging task work with the index of cookie array. But the $curguruescomidiklan stays 0 each time I click Next button. Patrick, i can't say what the problem is, but i recommend using the PEAR Pager package for this if you have PEAR available. It takes care of a lot of the heavy lifting and is very configurable. http://pear.php.net/package/Pager This does not require setting any cookies. brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to clean up extended charset or ASCII characters on form input?
I've searched of 21000 messages in this list and I don't quite understand how to best protect user input. Let's say you have a form that posts to itself just do see how messed up data can get: if(get_magic_quotes_gpc()) { $_POST=array_map('stripslashes',$_POST); } $_POST=array_map('trim',$_POST); $fname=$_POST[fname]; input name=fname value=? echo htmlentities($fname); ? htmlentities() does a good job to protecting quotes and allows for pretty flexible data entry characters. I found another function on the internet called cleanconvertaccents which I can run through array_map. However it's not perfect. If you enter an ALT-151 charcter, the value of the input keeps getting longer and longer as it double encodes on each submission. newegg.com does a good job to maintaining extended characters (presenting them back to the user) and keeps them from getting out of hand. How do other do this? thanks, -Eric Wood
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
Dear all, 2007/9/12, Lester Caine [EMAIL PROTECTED]: Per Jessen wrote: Maybe it's worth doing some googling for wordpress and php5? If it's not your code, it's not easy to debug. I have seen the apache core dump many times, sometimes caused by obvious errors, other times by something obscure and difficult to find. Come on guys, use your heads. PHP is segfaulting when trying to display its version number - that's not going to have anything to do with Wordpress. Uh, how do know you it's do with the version-number?? Did I miss that posting? Anyway, I think it's exceptionally poor show by php to cause a segfault, probably due to user code. I know it does it every now and then, and nobody has ever been interested in looking at the core dump. Zbigniew has not actually managed to get Apache started with PHP installed so trying to debug stuff running in PHP is a little pointless. Zbigniew - It is most likely one of the extensions is not able to load. I used to get the same problem with Windows, but without a seg fault nowadays - just a 'can't start'. First of all - allow me to thank numerous people who tried to help! Thanks to all of you! I thought the idea of testing php extensions to see which ones result in segmentation faults was a very good one indeed. Yes, there is no scripting issue here. I am unable to even start apache so whatever scripts I may have, it does not really matter. I am not able to go very far. So I commented out all extensions and then brought them in one by one. The one which was causing core dumps was simplexml.so. I had a few others that I had to comment as otherwise they were giving me trouble (because of the simplexml being commented out I guess): pdo.so, pdo_sqlite.so, spl.so, mysqli.so, sqlite.so. I am not really worried about these. I am not really sure if I will ever need them. So fine for the time being. php -v does not produce core dumps and I can start apache. There's only one problem left to be solved. After the upgrade php scripts behave as if they were not recognized. I made a test and put a standard index.html file in a directory, called a browser and the page was displayed properly. I then changed the page name to index.php and ran the browser again. This time the directory content was displayed, showing the index.php file present in it (it wasn't parsed by the browser). When I reloaded, the page content was finally displayed in a browser. So in other words it seems as if the php page was not properly parsed at first. It happens the same way with my wordpress family blog. It just shows directory content and when I click refresh index.php is called into the broser. But links to further php pages result in directory being shown again. I do have: AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps inside httpd.conf. Thoughts anyone? Again thank you so much for so many responses. I read them all and they were very helpful! Zbigniew Szalbot -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
On 9/12/07, Zbigniew Szalbot [EMAIL PROTECTED] wrote: There's only one problem left to be solved. After the upgrade php scripts behave as if they were not recognized. I made a test and put a standard index.html file in a directory, called a browser and the page was displayed properly. I then changed the page name to index.php and ran the browser again. This time the directory content was displayed, showing the index.php file present in it (it wasn't parsed by the browser). When I reloaded, the page content was finally displayed in a browser. So in other words it seems as if the php page was not properly parsed at first. It happens the same way with my wordpress family blog. It just shows directory content and when I click refresh index.php is called into the broser. But links to further php pages result in directory being shown again. I do have: AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps inside httpd.conf. Thoughts anyone? Again thank you so much for so many responses. I read them all and they were very helpful! Add index.php to your DirectoryIndex area of httpd.conf and that will fix it. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Give a man a fish, he'll eat for a day. Then you'll find out he was allergic and is hospitalized. See? No good deed goes unpunished -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] html to xml?
On 9/12/07, Slith [EMAIL PROTECTED] wrote: i need to parse an html page for tabular data which i can then import into mysql so i thought converting the html to xml might be a feasible thing to do, however, other than using tidy from the command line i can't find a way to do this from php. does anyone know of any class (or other) that would allow me to do this? or maybe i just need a different approach. use tidy. i do it all the time. note that it does its best, but it will get to xhtml at least; which is an xml compliant document. there's a pecl module for it, or you can just install the command line and run system() type calls too. http://tidy.sf.net (that would be if this is a regular thing, if it's a one time thing then yeah... do what Edward suggested and just manually do it once. sometimes you can't script things or it's too much effort... i've done way too many migrations and you usually always have some manual work :)) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
2007/9/12, Daniel Brown [EMAIL PROTECTED]: On 9/12/07, Zbigniew Szalbot [EMAIL PROTECTED] wrote: There's only one problem left to be solved. After the upgrade php scripts behave as if they were not recognized. I made a test and put a standard index.html file in a directory, called a browser and the page was displayed properly. I then changed the page name to index.php and ran the browser again. This time the directory content was displayed, showing the index.php file present in it (it wasn't parsed by the browser). When I reloaded, the page content was finally displayed in a browser. So in other words it seems as if the php page was not properly parsed at first. It happens the same way with my wordpress family blog. It just shows directory content and when I click refresh index.php is called into the broser. But links to further php pages result in directory being shown again. I do have: AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps inside httpd.conf. Thoughts anyone? Again thank you so much for so many responses. I read them all and they were very helpful! Add index.php to your DirectoryIndex area of httpd.conf and that will fix it. Thank you but I think it is already there? IfModule mod_dir.c IfModule mod_php3.c IfModule mod_php4.c DirectoryIndex index.php index.php3 index.html /IfModule IfModule mod_php5.c DirectoryIndex index.php index.php3 index.html /IfModule IfModule !mod_php4.c DirectoryIndex index.php3 index.html /IfModule /IfModule IfModule !mod_php3.c IfModule mod_php4.c DirectoryIndex index.php index.html /IfModule IfModule !mod_php4.c DirectoryIndex index.html /IfModule /IfModule /IfModule Thanks again! Zbigniew Szalbot -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
On 9/12/07, Zbigniew Szalbot [EMAIL PROTECTED] wrote: 2007/9/12, Daniel Brown [EMAIL PROTECTED]: On 9/12/07, Zbigniew Szalbot [EMAIL PROTECTED] wrote: There's only one problem left to be solved. After the upgrade php scripts behave as if they were not recognized. I made a test and put a standard index.html file in a directory, called a browser and the page was displayed properly. I then changed the page name to index.php and ran the browser again. This time the directory content was displayed, showing the index.php file present in it (it wasn't parsed by the browser). When I reloaded, the page content was finally displayed in a browser. So in other words it seems as if the php page was not properly parsed at first. It happens the same way with my wordpress family blog. It just shows directory content and when I click refresh index.php is called into the broser. But links to further php pages result in directory being shown again. I do have: AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps inside httpd.conf. Thoughts anyone? Again thank you so much for so many responses. I read them all and they were very helpful! Add index.php to your DirectoryIndex area of httpd.conf and that will fix it. Thank you but I think it is already there? IfModule mod_dir.c IfModule mod_php3.c IfModule mod_php4.c DirectoryIndex index.php index.php3 index.html /IfModule IfModule mod_php5.c DirectoryIndex index.php index.php3 index.html /IfModule IfModule !mod_php4.c DirectoryIndex index.php3 index.html /IfModule /IfModule IfModule !mod_php3.c IfModule mod_php4.c DirectoryIndex index.php index.html /IfModule IfModule !mod_php4.c DirectoryIndex index.html /IfModule /IfModule /IfModule Thanks again! Zbigniew Szalbot Was it in there before you last started Apache? If not, you should restart Apache for it to take effect. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Give a man a fish, he'll eat for a day. Then you'll find out he was allergic and is hospitalized. See? No good deed goes unpunished -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
Hello, 2007/9/12, Daniel Brown [EMAIL PROTECTED]: On 9/12/07, Zbigniew Szalbot [EMAIL PROTECTED] wrote: 2007/9/12, Daniel Brown [EMAIL PROTECTED]: On 9/12/07, Zbigniew Szalbot [EMAIL PROTECTED] wrote: There's only one problem left to be solved. After the upgrade php scripts behave as if they were not recognized. I made a test and put a standard index.html file in a directory, called a browser and the page was displayed properly. I then changed the page name to index.php and ran the browser again. This time the directory content was displayed, showing the index.php file present in it (it wasn't parsed by the browser). When I reloaded, the page content was finally displayed in a browser. So in other words it seems as if the php page was not properly parsed at first. It happens the same way with my wordpress family blog. It just shows directory content and when I click refresh index.php is called into the broser. But links to further php pages result in directory being shown again. I do have: AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps inside httpd.conf. Thoughts anyone? Again thank you so much for so many responses. I read them all and they were very helpful! Add index.php to your DirectoryIndex area of httpd.conf and that will fix it. Thank you but I think it is already there? IfModule mod_dir.c IfModule mod_php3.c IfModule mod_php4.c DirectoryIndex index.php index.php3 index.html /IfModule IfModule mod_php5.c DirectoryIndex index.php index.php3 index.html /IfModule IfModule !mod_php4.c DirectoryIndex index.php3 index.html /IfModule /IfModule IfModule !mod_php3.c IfModule mod_php4.c DirectoryIndex index.php index.html /IfModule IfModule !mod_php4.c DirectoryIndex index.html /IfModule /IfModule /IfModule Thanks again! Zbigniew Szalbot Was it in there before you last started Apache? If not, you should restart Apache for it to take effect. Indeed it was. Error log does not show anything special when I run a php file in browser and it shows directory content. Thanks! zbigniew szalbot -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] my paging task with PHP does not work. It uses cookie.
On 9/12/07, Patrik Hasibuan [EMAIL PROTECTED] wrote: Dear my friends... I am trying to display the content of a table. Each page must content only 5 records maximum. Each page has Previous and Next buttons (made from anchor). I dump the primary of the working table and keep it in a cookie. So than the paging task work with the index of cookie array. But the $curguruescomidiklan stays 0 each time I click Next button. yeah there is no reason to be using cookies for this. just using query string parameters should work. for pagination you need to know: total number of items number of items per page after that you know how many pages (numitems / itemsperpage) and work out the links appropriately (i.e. page1 has no previous, $maxpage has no next) and you can put the number of pages down how you want (if you want to do prev 3 4 5 next, or next 1 2 3 4 5 6 7 8 9 prev, there's a ton of strategies to print out what pages to show, and next, previous, jump to end, jump to beginning, etc) i've never used the PEAR class or anything else, i made a function a long time ago that actually works in conjunction with mysql's SELECT FOUND_ROWS() and uses a LIMIT offset,number to save the overhead of fetching every row from the database to only show the ones for that page. it's actually worked well for 4 years now without a single change... at some point perhaps i'll clean it up and post it somewhere, and someone might be able to make it even better. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
On 9/12/07, Zbigniew Szalbot [EMAIL PROTECTED] wrote: Hello, 2007/9/12, Daniel Brown [EMAIL PROTECTED]: On 9/12/07, Zbigniew Szalbot [EMAIL PROTECTED] wrote: 2007/9/12, Daniel Brown [EMAIL PROTECTED]: On 9/12/07, Zbigniew Szalbot [EMAIL PROTECTED] wrote: There's only one problem left to be solved. After the upgrade php scripts behave as if they were not recognized. I made a test and put a standard index.html file in a directory, called a browser and the page was displayed properly. I then changed the page name to index.php and ran the browser again. This time the directory content was displayed, showing the index.php file present in it (it wasn't parsed by the browser). When I reloaded, the page content was finally displayed in a browser. So in other words it seems as if the php page was not properly parsed at first. It happens the same way with my wordpress family blog. It just shows directory content and when I click refresh index.php is called into the broser. But links to further php pages result in directory being shown again. I do have: AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps inside httpd.conf. Thoughts anyone? Again thank you so much for so many responses. I read them all and they were very helpful! Add index.php to your DirectoryIndex area of httpd.conf and that will fix it. Thank you but I think it is already there? IfModule mod_dir.c IfModule mod_php3.c IfModule mod_php4.c DirectoryIndex index.php index.php3 index.html /IfModule IfModule mod_php5.c DirectoryIndex index.php index.php3 index.html /IfModule IfModule !mod_php4.c DirectoryIndex index.php3 index.html /IfModule /IfModule IfModule !mod_php3.c IfModule mod_php4.c DirectoryIndex index.php index.html /IfModule IfModule !mod_php4.c DirectoryIndex index.html /IfModule /IfModule /IfModule Thanks again! Zbigniew Szalbot Was it in there before you last started Apache? If not, you should restart Apache for it to take effect. Indeed it was. Error log does not show anything special when I run a php file in browser and it shows directory content. Thanks! zbigniew szalbot Since it loaded after refreshing then, my guess is that it was cached in your browser. Try creating a brand-new directory with an index.php file containing only the following: ? phpinfo(); ? When you access that new directory in your web browser, without calling the index.php file directly, it should show the PHP information page. If that's the case, then it was almost certainly just a local browser cache issue. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Give a man a fish, he'll eat for a day. Then you'll find out he was allergic and is hospitalized. See? No good deed goes unpunished -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to clean up extended charset or ASCII characters on form input?
On 9/12/07, Eric Wood [EMAIL PROTECTED] wrote: I've searched of 21000 messages in this list and I don't quite understand how to best protect user input. Let's say you have a form that posts to itself just do see how messed up data can get: http://php.net/filter has great easy to use functions. depending on the type of input, i use intval() which will guarantee me safely an integer. note that foo.php?bar=123x456 will produce 123456 (i think...) so you can't expect it will be what you want all the time. personally i would do this: 1) disable magic quotes 2) use filter_input() function to sanitize the input 3) then use intval() or perhaps regular expressions to scrub and normalize the input to its expected type i believe that will take care of everything you need. just remember that if you use any of this data again for SQL and such, you need to use mysql_escape_string() or other functions to escape the data - since you've disabled magic quotes. even if you didn't disable magic quotes it's always a good idea to use that before putting it in any type of query. there may be a need (you should test) to make sure that any parameters you pass [almost] directly to sql don't allow for SQL injection. i would think between the steps above that it can't but i haven't really sanity checked myself on the above :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
can i ask why you have anything to do with mod_php3 there? and if you don't plan on trying to use php4 and php5, then remove any looking for php4 too. IfModule mod_dir.c IfModule mod_php3.c IfModule mod_php4.c DirectoryIndex index.php index.php3 index.html /IfModule IfModule mod_php5.c DirectoryIndex index.php index.php3 index.html /IfModule IfModule !mod_php4.c DirectoryIndex index.php3 index.html /IfModule /IfModule IfModule !mod_php3.c IfModule mod_php4.c DirectoryIndex index.php index.html /IfModule IfModule !mod_php4.c DirectoryIndex index.html /IfModule /IfModule /IfModule -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
On 9/12/07, Zbigniew Szalbot [EMAIL PROTECTED] wrote: Hello, 2007/9/12, Daniel Brown [EMAIL PROTECTED]: On 9/12/07, Zbigniew Szalbot [EMAIL PROTECTED] wrote: 2007/9/12, Daniel Brown [EMAIL PROTECTED]: On 9/12/07, Zbigniew Szalbot [EMAIL PROTECTED] wrote: There's only one problem left to be solved. After the upgrade php scripts behave as if they were not recognized. I made a test and put a standard index.html file in a directory, called a browser and the page was displayed properly. I then changed the page name to index.php and ran the browser again. This time the directory content was displayed, showing the index.php file present in it (it wasn't parsed by the browser). When I reloaded, the page content was finally displayed in a browser. So in other words it seems as if the php page was not properly parsed at first. It happens the same way with my wordpress family blog. It just shows directory content and when I click refresh index.php is called into the broser. But links to further php pages result in directory being shown again. I do have: AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps inside httpd.conf. Thoughts anyone? Again thank you so much for so many responses. I read them all and they were very helpful! Add index.php to your DirectoryIndex area of httpd.conf and that will fix it. Thank you but I think it is already there? IfModule mod_dir.c IfModule mod_php3.c IfModule mod_php4.c DirectoryIndex index.php index.php3 index.html /IfModule IfModule mod_php5.c DirectoryIndex index.php index.php3 index.html /IfModule IfModule !mod_php4.c DirectoryIndex index.php3 index.html /IfModule /IfModule IfModule !mod_php3.c IfModule mod_php4.c DirectoryIndex index.php index.html /IfModule IfModule !mod_php4.c DirectoryIndex index.html /IfModule /IfModule /IfModule Thanks again! Zbigniew Szalbot Was it in there before you last started Apache? If not, you should restart Apache for it to take effect. Indeed it was. Error log does not show anything special when I run a php file in browser and it shows directory content. Thanks! zbigniew szalbot Zbigniew, Also, check for this line in your httpd.conf file: IfModule mod_dir.c Make sure index.php is in that list if the entry exists. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Give a man a fish, he'll eat for a day. Then you'll find out he was allergic and is hospitalized. See? No good deed goes unpunished -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
Hello again, 2007/9/12, Daniel Brown [EMAIL PROTECTED]: IfModule mod_dir.c IfModule mod_php3.c IfModule mod_php4.c DirectoryIndex index.php index.php3 index.html /IfModule IfModule mod_php5.c DirectoryIndex index.php index.php3 index.html /IfModule IfModule !mod_php4.c DirectoryIndex index.php3 index.html /IfModule /IfModule IfModule !mod_php3.c IfModule mod_php4.c DirectoryIndex index.php index.html /IfModule IfModule !mod_php4.c DirectoryIndex index.html /IfModule /IfModule /IfModule Also, check for this line in your httpd.conf file: IfModule mod_dir.c Make sure index.php is in that list if the entry exists. Daniel as you say: PHP is properly loading, but your DirectoryIndex is not working. The only refrences to DirectoryIndex and IfModule mod_dir.c are in the above quoted content in httpd.conf. I will get rid of all php3 entries and let you know if this has solved the problem. Thank you for your patience! Zbigniew Szalbot -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Getting line count of a text file
Hi all, In PHP 5, I'm counting the number of lines in a text file using the following code: $myfile = file ( '/path/to/myfile.txt'); $count = count ($myfile); However, sometimes it fails with the following error: PHP Fatal error: Allowed memory size of bytes exhausted (tried to allocate 35 bytes) in /path/to/myprogram.php on line 16 Line 16 is the first line above. I'm sure there is a better - more memory efficient - way to do this. Any suggestions? Thanks! Frank Schima Foraker Design http://www.foraker.com
Re: [PHP] Getting line count of a text file
$command= escapeshellcmd(cat {$file} | wc -l); // Run command and capture results $count = exec($command); Frank J. Schima [EMAIL PROTECTED] wrote: Hi all, In PHP 5, I'm counting the number of lines in a text file using the following code: $myfile = file ( '/path/to/myfile.txt'); $count = count ($myfile); However, sometimes it fails with the following error: PHP Fatal error: Allowed memory size of bytes exhausted (tried to allocate 35 bytes) in /path/to/myprogram.php on line 16 Line 16 is the first line above. I'm sure there is a better - more memory efficient - way to do this. Any suggestions? Thanks! Frank Schima Foraker Design http://www.foraker.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting line count of a text file
On 9/12/07, Frank J. Schima [EMAIL PROTECTED] wrote: In PHP 5, I'm counting the number of lines in a text file using the following code: $myfile = file ( '/path/to/myfile.txt'); $count = count ($myfile); However, sometimes it fails with the following error: PHP Fatal error: Allowed memory size of bytes exhausted (tried to allocate 35 bytes) in /path/to/myprogram.php on line 16 Line 16 is the first line above. I'm sure there is a better - more memory efficient - way to do this. Any suggestions? it's sloppy but you could use system(wc -l $file) and grab the first part before the space (doesn't seem to be an option to NOT display the filename again) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting line count of a text file
On 9/12/07, Wolf [EMAIL PROTECTED] wrote: $command= escapeshellcmd(cat {$file} | wc -l); // Run command and capture results $count = exec($command); that would work on *nix, but not windows. Frank J. Schima [EMAIL PROTECTED] wrote: Hi all, In PHP 5, I'm counting the number of lines in a text file using the following code: $myfile = file ( '/path/to/myfile.txt'); $count = count ($myfile); However, sometimes it fails with the following error: PHP Fatal error: Allowed memory size of bytes exhausted (tried to allocate 35 bytes) in /path/to/myprogram.php on line 16 Line 16 is the first line above. I'm sure there is a better - more memory efficient - way to do this. Any suggestions? Thanks! Frank Schima Foraker Design http://www.foraker.com if you want a cross-platform solution (not that i use windows :)) or you dont want to use exec() or related functions look to the stream functions. they support buffered reading, so theorectically a script could read portions of a file and count lines as it read through the portions. -nathan
Re: [PHP] Getting line count of a text file
On Sep 12, 2007, at 1:46 PM, Nathan Nobbe wrote: On 9/12/07, Wolf [EMAIL PROTECTED] wrote: $command= escapeshellcmd(cat {$file} | wc -l); // Run command and capture results $count = exec($command); that would work on *nix, but not windows. Since I am developing and deploying on *nix, shell commands are fine with me. Frank J. Schima [EMAIL PROTECTED] wrote: Hi all, In PHP 5, I'm counting the number of lines in a text file using the following code: $myfile = file ( '/path/to/myfile.txt'); $count = count ($myfile); However, sometimes it fails with the following error: PHP Fatal error: Allowed memory size of bytes exhausted (tried to allocate 35 bytes) in /path/to/myprogram.php on line 16 Line 16 is the first line above. I'm sure there is a better - more memory efficient - way to do this. Any suggestions? Thanks! Frank Schima Foraker Design http://www.foraker.com if you want a cross-platform solution (not that i use windows :)) or you dont want to use exec() or related functions look to the stream functions. they support buffered reading, so theorectically a script could read portions of a file and count lines as it read through the portions. Sounds a little painful. I'll look into it though. -nathan Thanks! Frank Schima Foraker Design http://www.foraker.com 303-449-0202
Re: [PHP] Getting line count of a text file
We all know REAL servers are *nix... :) And his path is *nix based... :) Nathan Nobbe [EMAIL PROTECTED] wrote: On 9/12/07, Wolf [EMAIL PROTECTED] wrote: $command= escapeshellcmd(cat {$file} | wc -l); // Run command and capture results $count = exec($command); that would work on *nix, but not windows. Frank J. Schima [EMAIL PROTECTED] wrote: Hi all, In PHP 5, I'm counting the number of lines in a text file using the following code: $myfile = file ( '/path/to/myfile.txt'); $count = count ($myfile); However, sometimes it fails with the following error: PHP Fatal error: Allowed memory size of bytes exhausted (tried to allocate 35 bytes) in /path/to/myprogram.php on line 16 Line 16 is the first line above. I'm sure there is a better - more memory efficient - way to do this. Any suggestions? Thanks! Frank Schima Foraker Design http://www.foraker.com if you want a cross-platform solution (not that i use windows :)) or you dont want to use exec() or related functions look to the stream functions. they support buffered reading, so theorectically a script could read portions of a file and count lines as it read through the portions. -nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Getting line count of a text file
hey... if you're going to do the system approach, go ahead and use awk/cut... wc -l foo.txt | awk -F' ' '{print $1}' should work assuming you're on linux. -Original Message- From: mike [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 12, 2007 12:46 PM To: Frank J. Schima Cc: php-general@lists.php.net Subject: Re: [PHP] Getting line count of a text file On 9/12/07, Frank J. Schima [EMAIL PROTECTED] wrote: In PHP 5, I'm counting the number of lines in a text file using the following code: $myfile = file ( '/path/to/myfile.txt'); $count = count ($myfile); However, sometimes it fails with the following error: PHP Fatal error: Allowed memory size of bytes exhausted (tried to allocate 35 bytes) in /path/to/myprogram.php on line 16 Line 16 is the first line above. I'm sure there is a better - more memory efficient - way to do this. Any suggestions? it's sloppy but you could use system(wc -l $file) and grab the first part before the space (doesn't seem to be an option to NOT display the filename again) -- 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] Getting line count of a text file
Novel approach... But mine's less typing. :) never thought of using awk for it though. Good one! :) bruce [EMAIL PROTECTED] wrote: hey... if you're going to do the system approach, go ahead and use awk/cut... wc -l foo.txt | awk -F' ' '{print $1}' should work assuming you're on linux. -Original Message- From: mike [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 12, 2007 12:46 PM To: Frank J. Schima Cc: php-general@lists.php.net Subject: Re: [PHP] Getting line count of a text file On 9/12/07, Frank J. Schima [EMAIL PROTECTED] wrote: In PHP 5, I'm counting the number of lines in a text file using the following code: $myfile = file ( '/path/to/myfile.txt'); $count = count ($myfile); However, sometimes it fails with the following error: PHP Fatal error: Allowed memory size of bytes exhausted (tried to allocate 35 bytes) in /path/to/myprogram.php on line 16 Line 16 is the first line above. I'm sure there is a better - more memory efficient - way to do this. Any suggestions? it's sloppy but you could use system(wc -l $file) and grab the first part before the space (doesn't seem to be an option to NOT display the filename again) -- 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
Re: [PHP] Getting line count of a text file
personally i try to use as little shell commands as possible, especially stacked on top of each other in exec(). i'd just use explode, str_split, substr/strpos, etc. after i got it back. On 9/12/07, Wolf [EMAIL PROTECTED] wrote: Novel approach... But mine's less typing. :) never thought of using awk for it though. Good one! :) bruce [EMAIL PROTECTED] wrote: hey... if you're going to do the system approach, go ahead and use awk/cut... wc -l foo.txt | awk -F' ' '{print $1}' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting line count of a text file
Frank J. Schima wrote: In PHP 5, I'm counting the number of lines in a text file using the following code: $myfile = file ( '/path/to/myfile.txt'); $count = count ($myfile); However, sometimes it fails with the following error: PHP Fatal error: Allowed memory size of bytes exhausted (tried to allocate 35 bytes) in /path/to/myprogram.php on line 16 Line 16 is the first line above. I'm sure there is a better - more memory efficient - way to do this. Any suggestions? $f=fopen( yourfile, r ); $i=0; while( fgets($f) ) $i++; fclose($f); $count=$i; /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
Hello, 2007/9/12, Zbigniew Szalbot [EMAIL PROTECTED]: Hello again, 2007/9/12, Daniel Brown [EMAIL PROTECTED]: IfModule mod_dir.c IfModule mod_php3.c IfModule mod_php4.c DirectoryIndex index.php index.php3 index.html /IfModule IfModule mod_php5.c DirectoryIndex index.php index.php3 index.html /IfModule IfModule !mod_php4.c DirectoryIndex index.php3 index.html /IfModule /IfModule IfModule !mod_php3.c IfModule mod_php4.c DirectoryIndex index.php index.html /IfModule IfModule !mod_php4.c DirectoryIndex index.html /IfModule /IfModule /IfModule Also, check for this line in your httpd.conf file: IfModule mod_dir.c Make sure index.php is in that list if the entry exists. Daniel as you say: PHP is properly loading, but your DirectoryIndex is not working. The only refrences to DirectoryIndex and IfModule mod_dir.c are in the above quoted content in httpd.conf. I will get rid of all php3 entries and let you know if this has solved the problem. I took the safe approach and just removed index.php from each statements, one by one until I was left with none. I was still able to display httpd://szalbot.homedns.org/test/ Currently I have index.php in mod_php5.c: IfModule mod_dir.c IfModule mod_php3.c IfModule mod_php4.c DirectoryIndex index.html /IfModule IfModule mod_php5.c DirectoryIndex index.php index.html /IfModule IfModule !mod_php4.c DirectoryIndex index.html /IfModule /IfModule IfModule !mod_php3.c IfModule mod_php4.c DirectoryIndex index.html /IfModule IfModule !mod_php4.c DirectoryIndex index.html /IfModule /IfModule /IfModule Funny thing is that it was never a problem with php 4.7. I actually changed nothing in httpd.conf between the versions. I installed php5 from ports and during installation of course all references to php4 were replaced with php5 (in httpd.conf). It is clearly problem with indexes but how and where that is an issue for me. there is a solution which I could live with. That is I can create an index.html page which will simply redirect to index.php and so index-wise everything will work but I would really prefer to find out what is wrong. Thanks! Zbigniew Szalbot -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
On 9/12/07, Zbigniew Szalbot [EMAIL PROTECTED] wrote: Hello, 2007/9/12, Zbigniew Szalbot [EMAIL PROTECTED]: Hello again, 2007/9/12, Daniel Brown [EMAIL PROTECTED]: IfModule mod_dir.c IfModule mod_php3.c IfModule mod_php4.c DirectoryIndex index.php index.php3 index.html /IfModule IfModule mod_php5.c DirectoryIndex index.php index.php3 index.html /IfModule IfModule !mod_php4.c DirectoryIndex index.php3 index.html /IfModule /IfModule IfModule !mod_php3.c IfModule mod_php4.c DirectoryIndex index.php index.html /IfModule IfModule !mod_php4.c DirectoryIndex index.html /IfModule /IfModule /IfModule Also, check for this line in your httpd.conf file: IfModule mod_dir.c Make sure index.php is in that list if the entry exists. Daniel as you say: PHP is properly loading, but your DirectoryIndex is not working. The only refrences to DirectoryIndex and IfModule mod_dir.c are in the above quoted content in httpd.conf. I will get rid of all php3 entries and let you know if this has solved the problem. I took the safe approach and just removed index.php from each statements, one by one until I was left with none. I was still able to display httpd://szalbot.homedns.org/test/ Currently I have index.php in mod_php5.c: IfModule mod_dir.c IfModule mod_php3.c IfModule mod_php4.c DirectoryIndex index.html /IfModule IfModule mod_php5.c DirectoryIndex index.php index.html /IfModule IfModule !mod_php4.c DirectoryIndex index.html /IfModule /IfModule IfModule !mod_php3.c IfModule mod_php4.c DirectoryIndex index.html /IfModule IfModule !mod_php4.c DirectoryIndex index.html /IfModule /IfModule /IfModule Funny thing is that it was never a problem with php 4.7. I actually changed nothing in httpd.conf between the versions. I installed php5 from ports and during installation of course all references to php4 were replaced with php5 (in httpd.conf). It is clearly problem with indexes but how and where that is an issue for me. there is a solution which I could live with. That is I can create an index.html page which will simply redirect to index.php and so index-wise everything will work but I would really prefer to find out what is wrong. Thanks! Zbigniew Szalbot That's not solving the issue, though. That's creating a workaround for it and ignoring its existence --- and a very hacky workaround, at that. There's no need to remove the index.php entries. In fact, quite the opposite: if Apache doesn't know that it should serve index.php as an index file, there's no way it will. Try commenting out the whole block of data you sent to the list from your httpd.conf file and entering only this instead: IfModule mod_dir.c DirectoryIndex index.php index.php3 index.html index.htm /IfModule If even that doesn't work, then you don't have mod_dir.so loading when Apache is started. You can either add that or simply comment out the entire IfModule section and just simply have DirectoryIndex out in the open, by itself, which is perfectly safe to do as well. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Give a man a fish, he'll eat for a day. Then you'll find out he was allergic and is hospitalized. See? No good deed goes unpunished -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting line count of a text file
Hi Gang, On Sep 12, 2007, at 1:58 PM, bruce wrote: if you're going to do the system approach, go ahead and use awk/cut... wc -l foo.txt | awk -F' ' '{print $1}' should work assuming you're on linux. I have solved the problem with this approach. Thanks for all the suggestions. FYI, it was a (very) minor pain to make that into a string. I ended up using this: $count = system(wc -l /path/to/myfile.txt | awk -F' ' '{print . '$' . 1}'); I didn't need to escape anything because the file was hardcoded - no user input. Cheers, Frank Schima Foraker Design http://www.foraker.com 303-449-0202
Re: [PHP] Getting line count of a text file
Frank J. Schima wrote: Hi all, In PHP 5, I'm counting the number of lines in a text file using the following code: $myfile = file ( '/path/to/myfile.txt'); $count = count ($myfile); However, sometimes it fails with the following error: PHP Fatal error: Allowed memory size of bytes exhausted (tried to allocate 35 bytes) in /path/to/myprogram.php on line 16 Line 16 is the first line above. I'm sure there is a better - more memory efficient - way to do this. Any suggestions? Thanks! Frank Schima Foraker Design http://www.foraker.com echo intval(str_replace(' '.$file, '', trim(system('wc -l '.$file; -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped) [SOLVED]
Dear Daniel and all! 2007/9/12, Daniel Brown [EMAIL PROTECTED]: IfModule mod_dir.c IfModule mod_php3.c IfModule mod_php4.c DirectoryIndex index.php index.php3 index.html /IfModule IfModule mod_php5.c DirectoryIndex index.php index.php3 index.html /IfModule IfModule !mod_php4.c DirectoryIndex index.php3 index.html /IfModule /IfModule IfModule !mod_php3.c IfModule mod_php4.c DirectoryIndex index.php index.html /IfModule IfModule !mod_php4.c DirectoryIndex index.html /IfModule /IfModule /IfModule Try commenting out the whole block of data you sent to the list from your httpd.conf file and entering only this instead: IfModule mod_dir.c DirectoryIndex index.php index.php3 index.html index.htm /IfModule Problem solved! Daniel - this really helped. I do not even know how to thank you but surely, this is amazing. This thing actually works! :) Thanks to all! Zbigniew Szalbot -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped) [SOLVED]
On 9/12/07, Zbigniew Szalbot [EMAIL PROTECTED] wrote: Dear Daniel and all! 2007/9/12, Daniel Brown [EMAIL PROTECTED]: IfModule mod_dir.c IfModule mod_php3.c IfModule mod_php4.c DirectoryIndex index.php index.php3 index.html /IfModule IfModule mod_php5.c DirectoryIndex index.php index.php3 index.html /IfModule IfModule !mod_php4.c DirectoryIndex index.php3 index.html /IfModule /IfModule IfModule !mod_php3.c IfModule mod_php4.c DirectoryIndex index.php index.html /IfModule IfModule !mod_php4.c DirectoryIndex index.html /IfModule /IfModule /IfModule Try commenting out the whole block of data you sent to the list from your httpd.conf file and entering only this instead: IfModule mod_dir.c DirectoryIndex index.php index.php3 index.html index.htm /IfModule Problem solved! Daniel - this really helped. I do not even know how to thank you but surely, this is amazing. This thing actually works! :) Thanks to all! Zbigniew Szalbot No problem at all. Now my guess at explaining it Notice how `IfModule mod_php5.c` if only mentioned when nested inside of the `IfModule mod_php3.c` container. If you want to have the intelligent-detection of PHP's availability, you should be able to update this: IfModule mod_dir.c DirectoryIndex index.php index.php3 index.html index.htm /IfModule like so: IfModule mod_dir.c IfModule mod_php5.c DirectoryIndex index.php index.php3 index.html index.htm /IfModule !IfModule mod_php5.c DirectoryIndex index.html index.htm /IfModule /IfModule -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Give a man a fish, he'll eat for a day. Then you'll find out he was allergic and is hospitalized. See? No good deed goes unpunished -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped) [SOLVED]
Hello, 2007/9/12, Daniel Brown [EMAIL PROTECTED]: No problem at all. Your help was very much appreciated! Now my guess at explaining it Notice how `IfModule mod_php5.c` if only mentioned when nested inside of the `IfModule mod_php3.c` container. If you want to have the intelligent-detection of PHP's availability, you should be able to update this: IfModule mod_dir.c DirectoryIndex index.php index.php3 index.html index.htm /IfModule like so: IfModule mod_dir.c IfModule mod_php5.c DirectoryIndex index.php index.php3 index.html index.htm /IfModule !IfModule mod_php5.c DirectoryIndex index.html index.htm /IfModule /IfModule By now you almost made me an expert :) and the above should actually say: IfModule mod_dir.c IfModule mod_php5.c DirectoryIndex index.php index.php3 index.html index.htm /IfModule IfModule !mod_php5.c DirectoryIndex index.html index.htm /IfModule /IfModule Regards, Zbigniew Szalbot -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
Zbigniew Szalbot wrote: It is clearly problem with indexes but how and where that is an issue for me. there is a solution which I could live with. That is I can create an index.html page which will simply redirect to index.php and so index-wise everything will work but I would really prefer to find out what is wrong. Get hold of one of core dumps, and submit it to the PHP developers. They understand those. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
Jay Blanchard wrote: Whenever I've reported a core-dump (which I've stopped doing), nothing's been done about it unless I've been able to produce a short script to reproduce. [/snip] That is to be expected and is standard operating procedure for any development team. I beg to differ. In the past 20 years, I've spent plenty of time working with core dumps, stand-alone dumps, slip traps and system traces debugging my own software (running at customer sites) without the remotest possibility of reproducing a problem on-demand. If you think a problem must be reproducable for any development team to solve it, you need to try working in a real one. No offence, just my opinion. In order to replicate the issue they have to duplicate the action that caused the failure. Unless you work based on trialerror, there is no real need to replicate the issue until you feel you may have identified the problem. A core dump or an strace or some debug output at the right time will have 99% of the information you need - provided you understand how to read it. I submit there is generally no need to reproduce a problem in order to diagnose it. To fix it, yes, it will undoubtedly help if you can reproduce it, but once you've diagnosed it, reproducing it is a lot easier. You see that time and again on this list as wellwithout the offending action all we can do is attempt to guess at what was going on at the time of the failure. Diligent trouble-shooting on your part would have gotten a much better response. You could have likely isolated the code that caused the core dump (just as we isolate problem code on this list... Jay, this is the same kind of c... that PHP developers have responded with in the past. I'm sorry, but IMO that is entirely unprofessional. OK, so maybe one isn't being paid to write open source software, but that's no excuse for not being professional about it. IMHO. What's the purpose of a core dump if it does not provide the key information for solving a problem? If I still have to isolate and reproduce the issue in user code, there seems to be very little need for the core dump, right? /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped) [SOLVED]
On 9/12/07, Zbigniew Szalbot [EMAIL PROTECTED] wrote: Hello, 2007/9/12, Daniel Brown [EMAIL PROTECTED]: No problem at all. Your help was very much appreciated! Now my guess at explaining it Notice how `IfModule mod_php5.c` if only mentioned when nested inside of the `IfModule mod_php3.c` container. If you want to have the intelligent-detection of PHP's availability, you should be able to update this: IfModule mod_dir.c DirectoryIndex index.php index.php3 index.html index.htm /IfModule like so: IfModule mod_dir.c IfModule mod_php5.c DirectoryIndex index.php index.php3 index.html index.htm /IfModule !IfModule mod_php5.c DirectoryIndex index.html index.htm /IfModule /IfModule By now you almost made me an expert :) and the above should actually say: IfModule mod_dir.c IfModule mod_php5.c DirectoryIndex index.php index.php3 index.html index.htm /IfModule IfModule !mod_php5.c DirectoryIndex index.html index.htm /IfModule /IfModule Regards, Zbigniew Szalbot Heh. Yup, you're right forgot the ! to indicate NOT in the second case. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Give a man a fish, he'll eat for a day. Then you'll find out he was allergic and is hospitalized. See? No good deed goes unpunished -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped) [SOLVED]
Zbigniew Szalbot wrote: Problem solved! Daniel - this really helped. I do not even know how to thank you but surely, this is amazing. This thing actually works! :) Amazing indeed. PHP does good work for me, but I'm not impressed. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting line count of a text file
On 9/12/07, Greg Donald [EMAIL PROTECTED] wrote: Why? Shell commands are a lot less likely to change than the current PHP function names. I'm aware the PHP function naming algorithm currently remains a secret, but without a doubt, someday someone _will_ crack it. I personally hope this occurs before the renaming of PHP to Java. if the basic functions i mentioned above change names that one line of code will be the least of everyone's concerns. not to mention PHP maintains cross-platform support, whereas shell commands wouldn't, shell commands may have inherent security risks, disabled, not installed, selinux or some other weird limitations, etc. PHP most likely wouldn't have specific basic functions disabled. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting line count of a text file
On Wed, 12 Sep 2007, mike wrote: personally i try to use as little shell commands as possible, especially stacked on top of each other in exec(). Why? Shell commands are a lot less likely to change than the current PHP function names. I'm aware the PHP function naming algorithm currently remains a secret, but without a doubt, someday someone _will_ crack it. I personally hope this occurs before the renaming of PHP to Java. -- Greg Donald Cyberfusion Consulting http://cyberfusionconsulting.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)
Per Jessen wrote: Stut wrote: Anyway, I think it's exceptionally poor show by php to cause a segfault, probably due to user code. I know it does it every now and then, and nobody has ever been interested in looking at the core dump. This will have nothing to do with user code since no user code is involved in displaying the version info. It's most likely a problem with mixed version numbers, or possibly (but unlikely) a configuration issue. If there's an auto_prepend_file or auto_append_file in the configuration that may be loaded by php -v, I'm not sure. Blaming PHP for this is like blaming Microsoft because Photoshop crashed on a Windows machine. It's possible PHP is to blame but there is a whole stack of other considerations to go through before coming to that conclusion. Stut, put this problem aside for a sec, and let me ask this - if I can produce an apache core-dump using vanilla apache, vanilla php (even with no extensions if you want) and a PHP script, you'll get someone to debug it? (I cannot promise a easily reproducable problem, just the core-dump, and a few hundred lines of script) FYI, I've tried that before, and the PHP developers are not interested and/or they do not work with core dumps. Please tell me you're kidding? If you can't provide a piece of code that always causes the segfault are you seriously expecting the devs to waste their time trying to find the cause? Talk about a needle in a haystack. The ease of reproduction is not particularly important, although the easier the better. The important thing is that every time you run the script it causes a segfault. I still maintain it is exceptionally poor show by php to let user code produce segfaults in apache. To me this comment indicates a lack of experience in software development with C. Segfaults are a fact of life and it's very difficult to cover every possible cause, especially when you are using a number of external libraries. Expecting PHP to be perfect is unrealistic. The core development team is a limited resource and they need to put their time where their time provides the most benefit. I'm not saying they always get this right, but you can't expect them to invest their time into fixing a problem you've found unless you've done the work yourself to isolate where the problem is and you have a piece of code that causes it 100% of the time. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] blocking exec() silently
Hey guys, Actually I'm still looking for a way to block for example the exec() function without throwing an error! Since there seems to be no way to do this, without hacking the code of php, it seems like that is what I'll have to do... Do you people think it would be a good way to just look for where the exec() function is defined in the source and then just empty it out an let it return true or whatever value it normaly returns? Or would there be a better, different way? And could some of you devs, just give me a short hint where to look for example for the exec() function in the source, since I never looked into php? Regards, Samy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Getting line count of a text file
greg... while you are correct in your assertion that the shell cmds provided are specific to linux, your assertion/statement that the functions might be 'turned off' are fud... basic bash functions are inherently part of the shell and yes, you are correct in your statement that php is relatively cross platform, however, i imagine that you can quite easily get into situations where your php code has to have different branches based upon the platform that it's running on... every other language i've ever written for has required me to have subtle differences based upon the underlying platform, i'm pretty sure php would/can as well the assumption here, is that you're getting into complex stuff.. peace. -Original Message- From: mike [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 12, 2007 2:18 PM To: Greg Donald Cc: php-general@lists.php.net Subject: Re: [PHP] Getting line count of a text file On 9/12/07, Greg Donald [EMAIL PROTECTED] wrote: Why? Shell commands are a lot less likely to change than the current PHP function names. I'm aware the PHP function naming algorithm currently remains a secret, but without a doubt, someday someone _will_ crack it. I personally hope this occurs before the renaming of PHP to Java. if the basic functions i mentioned above change names that one line of code will be the least of everyone's concerns. not to mention PHP maintains cross-platform support, whereas shell commands wouldn't, shell commands may have inherent security risks, disabled, not installed, selinux or some other weird limitations, etc. PHP most likely wouldn't have specific basic functions disabled. -- 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] Getting line count of a text file
bruce wrote: greg... while you are correct in your assertion that the shell cmds provided are specific to linux, your assertion/statement that the functions might be 'turned off' are fud... basic bash functions are inherently part of the shell Sure they can - enable safe-mode and it causes all sorts of weirdness with running exec or system calls. I also disable exec/system calls in php altogether by editing my php.ini file (see disabled_functions). Lastly wc and awk and sed are not part of the shell, they are external programs. Shell functions are things like if, while, do. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] blocking exec() silently
Samuel Vogel wrote: Hey guys, Actually I'm still looking for a way to block for example the exec() function without throwing an error! Since there seems to be no way to do this, without hacking the code of php, it seems like that is what I'll have to do... Why do you have to do this and not your customers or their developers? Seems like you're going to have to run a cron script or something to check once a week in case someone uploads a new file with this stuff in it. Do you people think it would be a good way to just look for where the exec() function is defined in the source and then just empty it out an let it return true or whatever value it normaly returns? Well it returns a string (see http://www.php.net/manual/en/function.exec.php) so it's hard to give a default answer because it depends on the context. And could some of you devs, just give me a short hint where to look for example for the exec() function in the source, since I never looked into php? If you're on a *nix box, you could do something like: grep -nri '[^_]exec(' /path/to/folder/ and it will show you the files line numbers you need to look at. The [^_] means it skips pg_exec, curl_exec, stuff like that. But you'll have to run a separate check for shell_exec (unless you want to play with the regex). If you're on windows, use the filters in the search area to do it. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Fatal error: Call to undefined function hash_hmac()
We are running Novell SUSE Linux Enterprise Server 10 sp1. It has php 5.1.2. We are using a standard out of the box install, and for some reason the hash functions only work using the cli interface, and fails to work with apache giving the following error: PHP Fatal error: Call to undefined function hash_hmac() Does anyone have any suggestions as to what might be causing this? -- Aaron Axelsen [EMAIL PROTECTED] Great hosting, low prices. Modevia Web Services LLC -- http://www.modevia.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] blocking exec() silently
i dont know why you wouldnt just use the disable_functions directive in php.ini disable_functions = exec this will indeed raise an error, well a warning rather, from my test [12-Sep-2007 19:22:24] PHP Warning: exec() has been disabled for security reasons but i always suppress warnings and errors to the browser in production anyway, which is good practice. i dont see a problem letting the warnings spit out in preproduction either, then developers would get the hint.. -nathan in /home/nathan/testDisable.php on line 2 On 9/12/07, Samuel Vogel [EMAIL PROTECTED] wrote: Hey guys, Actually I'm still looking for a way to block for example the exec() function without throwing an error! Since there seems to be no way to do this, without hacking the code of php, it seems like that is what I'll have to do... Do you people think it would be a good way to just look for where the exec() function is defined in the source and then just empty it out an let it return true or whatever value it normaly returns? Or would there be a better, different way? And could some of you devs, just give me a short hint where to look for example for the exec() function in the source, since I never looked into php? Regards, Samy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting line count of a text file
On 9/12/07, Chris [EMAIL PROTECTED] wrote: bruce wrote: greg... actually, i was the one that said this. Sure they can - enable safe-mode and it causes all sorts of weirdness with running exec or system calls. not to mention shell commands expect to be in PATH, and if you hardcode in /bin/awk, it might not be the same location in freebsd vs. linux vs. solaris vs. another unix. or a crippled or broken system. I also disable exec/system calls in php altogether by editing my php.ini file (see disabled_functions). Lastly wc and awk and sed are not part of the shell, they are external programs. thank you. Shell functions are things like if, while, do. exactly, thank you. your reply was much more eloquent than what i would have said. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php