[PHP] php via cmdline including unwanted headers
I run some scripts via php (cgi) which sends output to another file, but it's including unwanted cookie header, etc in the outfile. example: php /home/dev/script.php /home/production/feeds/news.xml 21 and at the top of news.xml i get: X-Powered-By: PHP/5.2.2 Set-Cookie: . Set-Cookie: . Cache-Control: private Content-Type: text/html; charset=ISO-8859-1 i turned off expose php which gets rid of the x-powered-by but what about the rest? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php via cmdline including unwanted headers
Yeni Setiawan wrote: On 5/30/07, *Sebe* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: I run some scripts via php (cgi) which sends output to another file, but it's including unwanted cookie header, etc in the outfile. example: php /home/dev/script.php /home/production/feeds/news.xml 21 and at the top of news.xml i get: X-Powered-By: PHP/5.2.2 Set-Cookie: . Set-Cookie: . Cache-Control: private Content-Type: text/html; charset=ISO-8859-1 i turned off expose php which gets rid of the x-powered-by but what about the rest? try to use quiet mode by using -q option as follow: php -q /home/dev/script.php /home/production/feeds/news.xml 21 i tried using -q still shows the headers.. this problem started when i switched to php cgi. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php via cmdline including unwanted headers
Stut wrote: Sebe wrote: Yeni Setiawan wrote: On 5/30/07, *Sebe* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: I run some scripts via php (cgi) which sends output to another file, but it's including unwanted cookie header, etc in the outfile. example: php /home/dev/script.php /home/production/feeds/news.xml 21 and at the top of news.xml i get: X-Powered-By: PHP/5.2.2 Set-Cookie: . Set-Cookie: . Cache-Control: private Content-Type: text/html; charset=ISO-8859-1 i turned off expose php which gets rid of the x-powered-by but what about the rest? try to use quiet mode by using -q option as follow: php -q /home/dev/script.php /home/production/feeds/news.xml 21 i tried using -q still shows the headers.. this problem started when i switched to php cgi. Well that's your mistake. The CGI binary is meant for use as a web page generator. You need php-cli. -Stut turning cgi.check_shebang_line in php.ini solved the problem without using php cli -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: [ANNOUNCE] TODO parser
Daevid Vincent wrote: -Original Message- From: Alexander Elder [mailto:[EMAIL PROTECTED] Sent: Saturday, April 28, 2007 10:30 AM To: php-general@lists.php.net Subject: [PHP] Re: [ANNOUNCE] TODO parser Daevid Vincent wrote: For a long time I've wanted a tool that would traverse my source code to find all those little forgotten TODO entries. http://daevid.com/examples/todo/ It would be nice if you added a flag for parsing 'FIXME' entries too. Quite a lot of source I've read contains 'TODO' and 'FIXME', often with little variation between meanings. Just my $0.02. it would also be nice if you were able to exclude certain directories... maybe an array of disallowed directories so it doesn't check them. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] explode in mysql query
i have a mysql column that looks like this: groups --- 12,7,10,6,14,11,2 is it possible to select the row if `groups` contain 7 or 14? trying to avoid running two queries and running explode() on it. i don't remember but i thought there was a way to use explode() on something like this within a single query. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] explode in mysql query
Paul Novitski wrote: At 4/26/2007 11:33 PM, Sebe wrote: i have a mysql column that looks like this: groups --- 12,7,10,6,14,11,2 is it possible to select the row if `groups` contain 7 or 14? trying to avoid running two queries and running explode() on it. I would think a more efficient strategy would be a simple string search. If you append a comma to the beginning and the end of your list so it becomes: ,12,7,10,6,14,11,2, then you can search for: ,#, where # is the desired integer. Therefore you could use the MySQL syntax: WHERE CONCAT(',', `groups`, ',') LIKE '%,7,%' OR CONCAT(',', `groups`, ',') LIKE '%,14,%' Regards, Paul thanks for the idea.. i also just came up with a solution using mysql FIND_IN_SET eg: FIND_IN_SET('7', groups) OR FIND_IN_SET('14', groups) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] move if logic from php into query
Chris wrote: Thufir wrote: I couldn't get the page to load when the logic for line 31, ($id == $_POST[recordID]), was in the query. Can the logic for that be moved to the query? I expect so. $query = SELECT contacts.id, px_items.id, title, notes FROM contacts, px_items WHERE contacts.id=px_items.id AND recordid=' . (int)$_POST['recordID'] . '; The (int) will make sure that it is a number (so a string becomes 0). i always use intval() on something i'm inserting into database that *should* be a integer. i don't know if there is a difference or a good reason to pick one or the other.. i'm not Richard so maybe he can create an interesting story for us on the *proper* way ;-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] a little math
maybe someone can figure why sometimes i get negative values for seconds.. $job['finished'] and $job['finished'] are both unix timestamp. i subtract both to get how many seconds some thing took.. well you should be able to read the rest. sometimes it works fine but other times i get negative seconds. $job['run_time'] = ($job['finished'] - $job['started']); $minutes = number_format($job['run_time'] / 60, 0, '', ''); // seconds left after calculating minutes $seconds = (($job['run_time']- 60) * $minutes); $job['runtime'] = $minutes . ' mins ' . $seconds . ' secs'; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] a little math
Edward Kay wrote: maybe someone can figure why sometimes i get negative values for seconds.. $job['finished'] and $job['finished'] are both unix timestamp. i subtract both to get how many seconds some thing took.. well you should be able to read the rest. sometimes it works fine but other times i get negative seconds. $job['run_time'] = ($job['finished'] - $job['started']); $minutes = number_format($job['run_time'] / 60, 0, '', ''); // seconds left after calculating minutes $seconds = (($job['run_time']- 60) * $minutes); $job['runtime'] = $minutes . ' mins ' . $seconds . ' secs'; If $job['run_time'] 60 then clearly $seconds will be negative. Why don't you use: $minutes = floor($job['run_time'] / 60); $seconds = $job['run_time'] % 60; Edward yeah that seems more simple, but i do check if it's less than 60 seconds. $job['run_time'] = ($job['finished'] - $job['started']); if ($job['run_time'] 60) { $job['runtime'] = $rsync['run_time'] . ' secs'; } else { $minutes = number_format($job['run_time'] / 60, 0, '', ''); $seconds = (($job['run_time'] - 60) * $minutes); $job['runtime'] = $minutes . ' mins ' . $seconds . ' secs'; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why can't I ini_set('upload_max_filesize')?
Brian Dunning wrote: If I do this: ini_set('upload_max_filesize', 30720); echo ini_get('upload_max_filesize'); it returns 2M. Why is it not accepting the ini_set? The server is Windows, PHP 5.2. probably because upload_max_filesize is PHP_INI_PERDIR not PHP_INI_ALL use: http://us.php.net/manual/en/configuration.changes.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dreamhost! PHP as CGI!???
Richard Lynch wrote: On Fri, April 13, 2007 3:46 am, Micky Hulse wrote: I think I just read that PHP is ran as CGI on Dreamhost... this does not sound good. Can anyone confirm? You could confirm what you have on YOUR setup with: ?php phpinfo();? faster and with more assurance of correctness than any mailing list answer yeah or `php -v` via cmdline. by the way, isn't PHP w/FastCGI faster than using apache module? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] foreach question
[EMAIL PROTECTED] wrote: I have .. foreach( $_POST as $key ) {echo $keybr /; } and that gives me item1 item2 item3 item4 item5br / how do I write it to give me item1br / item2br / item3br / item4br / item5br / Thanks both examples do the same thing.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] foreach question
[EMAIL PROTECTED] wrote: both examples do the same thing.. no, ex1 only has 1 br / so outputs like.. item1item2item3item4item5br / Where as I want this.. item1br / item2br / item3br / item4br / item5br / ie a line break after every item. hmm, if you're getting 5 results from the loop each should already have a br / so i dont understand what is wrong but the code it's set to put out a line break after each item. maybe i'm blind but the code is fine (with the exception that i don't use double quotes). - Original Message - From: Sebe [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Monday, April 09, 2007 1:22 AM Subject: Re: [PHP] foreach question [EMAIL PROTECTED] wrote: I have .. foreach( $_POST as $key ) {echo $keybr /; } and that gives me item1 item2 item3 item4 item5br / how do I write it to give me item1br / item2br / item3br / item4br / item5br / Thanks both examples do the same thing.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: link counting
Tijnema ! wrote: On 4/7/07, itoctopus [EMAIL PROTECTED] wrote: Use the function is_url (note that I haven't written it) instead to check if the link is a URL. Not only your method may count some links twice, but it will count wrong URLs also. a href='www.externaldomainnamehere.com'External/a is not a URL that will take someone externally. Below is the function is_url function is_url($url) { return preg_match('#^http\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $url);} taken from this link: http://plurged.com/code.php?id=26 Hmm, it does only take http links, not https,ftp, etc. Tijnema I came up with this, not sure if there is a better/faster way but it works for me. it's case insensitive so you don't have to use strtolower() preg_match_all('%http://|https://|ftp://%i', $string, $links); if(count($links[0]) 2) { // error... } -- itoctopus - http://www.itoctopus.com Sebe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] i thought of an idea of counting the number of links to reduce comment spam. unfortunately my methods is not reliable, i haven't tested it yet though.. anyone have maybe a better solution using some regexp? $links = array('http://', 'https://', 'www.'); $total_links = 0; foreach($links as $link) { $total_links = substr_count($string, $link); } if($total_links X) { . } -- 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] ribs (rsync) problem
anyone here using the ribs php rsync script? i keep getting: rsync: link_stat /home/site failed: No such file or directory (2) does the directory structure need to match on both local/remote servers? example, i'm trying to back up /home/site to /home/backup not sure if the remote backup server has to be /home/site as well.. or if the problem is in the php script as i'm running php5. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] link counting
i thought of an idea of counting the number of links to reduce comment spam. unfortunately my methods is not reliable, i haven't tested it yet though.. anyone have maybe a better solution using some regexp? $links = array('http://', 'https://', 'www.'); $total_links = 0; foreach($links as $link) { $total_links = substr_count($string, $link); } if($total_links X) { . } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forking doesn't work on php 5.2.1?
Jochem Maas wrote: Frederic Belleudy wrote: Well Ill let you know guys if it works after I've recompiled apache try recompiling php - recompiling apache won't have an effect as far as that compile option goes. it will if php is complied statically into apache, then you have to recompile apache each time you compile php.. i use static because u get better performance, but that's another topic of it's own.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php