php-general Digest 27 Feb 2006 08:48:39 -0000 Issue 3987
php-general Digest 27 Feb 2006 08:48:39 - Issue 3987 Topics (messages 231113 through 231126): Re: Parsing PHP variables in XML document 231113 by: Ivan Nedialkov 231119 by: Bogdan Ribic Re: PHP upgrade on Go Daddy virtual server 231114 by: Nicolas Verhaeghe 231118 by: John Nichel recompiling php 231115 by: blackwater dev Re: How do I read Exif data without a file? 231116 by: tedd 231117 by: Niels Constant Scope 231120 by: Adrian Cid Almaguer 231121 by: Adrian Cid Almaguer 231122 by: Chris mail function 231123 by: Mohsen Pahlevanzadeh 231126 by: Cristian MARIN QUARANTINED: 231124 by: WorkgroupMail Content Filter PHP and Unicode 231125 by: Foofy Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: php-general@lists.php.net -- ---BeginMessage--- Well isn't there a way instead of using only variables, to use sth like ?php echo $foo; ? I tried it but it doesnt work The parser returns blank! On Sun, 2006-02-26 at 12:02 +0100, Bogdan Ribic wrote: Hmmm, come to think of it, it would only work if short_open_tags ini directive is turned OFF, which in most cases it won't be :( Bogdan Ribic wrote: Hi Ivan, You might be able to use output buffering in conjunction with including your xml file. Something like: ob_start(); include $xml_file; $content = ob_end_flush(); and then parse the $content string. If you are doing this from within a function and you want access to global variables, you should import all global variables first, via extract($GLOBALS); Btw, this is just an idea, and untested - use at your own risk :) Boban. ---End Message--- ---BeginMessage--- Ivan, Did you try entering the code with debugger, or at least printing out what output buffer was holding, ie $content var in my example? Can you post exact code? Also, is short_tags turned on or off in php.ini? If it is on, php will get confused on first line of your xml file, it will think that ?xml is a php openning tag. In your original code you were calling the parser that was expecting $foo3 to be set, but you were setting the $foo3 *after* parsing, are you sure you're not making a mistake like that again? Ivan Nedialkov wrote: Well isn't there a way instead of using only variables, to use sth like ?php echo $foo; ? I tried it but it doesnt work The parser returns blank! -- Open source PHP code generator for DB operations http://sourceforge.net/projects/bfrcg/ ---End Message--- ---BeginMessage--- Can't help. They basically tell you you are on your own. -Original Message- From: Gerry Danen [mailto:[EMAIL PROTECTED] Sent: Sunday, February 26, 2006 12:15 PM To: Nicolas Verhaeghe Cc: PHP General (E-mail) Subject: Re: [PHP] PHP upgrade on Go Daddy virtual server Have you tried GoDaddy support? On 2/25/06, Nicolas Verhaeghe [EMAIL PROTECTED] wrote: Has anybody heard (or done it himself) how to upgrade PHP on a Go Daddy virtual server? Current version is 4.3.11 and I'd like to upgrade to 5.1.2. All I know is that this server is a Red Hat Fedora 2. I have SSH access and root as well. ---End Message--- ---BeginMessage--- Nicolas Verhaeghe wrote: Can't help. They basically tell you you are on your own. http://us2.php.net/manual/en/install.php -- By-Tor.com ...it's all about the Rush http://www.by-tor.com ---End Message--- ---BeginMessage--- I am trying to recompile php 5 with freetds so am using this : ./configure '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-mysql=/root/mysql-standard-4.1.9-pc-linux-gnu-i686' '--with-mssql=/usr/local/freetds' Things seem ok so I do make and at the end of make I get this error: /usr/bin/ld:ext/mssql/php_mssql.lo: file format not recognized; treating as linker script /usr/bin/ld:ext/mssql/php_mssql.lo:2: syntax error collect2: ld returned 1 exit status make: *** [libphp5.la] Error 1 I then did make install and of course got the same error: /usr/bin/ld:ext/mssql/php_mssql.lo: file format not recognized; treating as linker script /usr/bin/ld:ext/mssql/php_mssql.lo:2: syntax error collect2: ld returned 1 exit status make: *** [libphp5.la] Error 1 I then do make clean. Of course, it doesn't seem to regenerate the libphp5.so so once I restart apache, and check out phpinfo, it shows the old configuration. What's wrong? Thanks! ---End Message--- ---BeginMessage--- tedd wrote: Sameer said: To get the thumbnails you must rewrite the resized file to some place (if you want real thumbnail image). No, that's not correct. You can take an image from a db, create a thumbnail while it is in memory and display it. You don't need to make it a file first. That *is* correct. You must rewrite the
[PHP] Re: mail function
I don't know exactly if this problem belongs to this news forum. This is more or less a SMTP question. The email servers names are kept into the mail MIME headers even if the message only passed through them and was then forwarded the servers names and IP's. This is done for anti-spam mesures, relay purposes, bouncing and other SMTP good reasons. There are 3 ways to avoid this as far as I know: 1. To use internal networks relay servers with fake unroutable IP's like 127.x.x.x or 192.168.x.x. However the IP address of the gateway is visible and this will work only in case of big networks. 2. To use so many email redirect servers that the MIME message beeing too long will start cutting the origins. 3. To connect to the relay server using a masquerading anonymous public server with squid or other proxy software running on it. However this is not legal and I will advise to not use these methods. You may be considered a SPAM sender and be sued for these kind of actions. Cristian MARIN - [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Developer Designers Division InterAKT Online - http://www.interaktonline.com Mohsen Pahlevanzadeh wrote: Dear all, I wanna mail to x user that x can't see my IP address. Do you know same function? --Mohsen
[PHP] Secure input
Hi, What shall one do to avoid people that trys to manipulate my server? I mysql_real_escape_string() all input from GET and POST. A long time ago I think I used addslashes or something like that too, so people couldn't insert php code in their input. Is that still something I should do, or does mysql_real_escape_string() take care of that too? And is it even possible for a user to execute there own php code if I not output the input via the eval() function? When users input is displayed for others then themself I try to filter out html tags too. Anything else I should think of? Sorry if this has been asked a million times before. Thanks for your time /Regards Emil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] URL output query
Greetings PHP folks, Which PHP function do I use if I want to achieve the following : http://www.somesite.com/gallery/pics.php is the url...how do I get it to read only http://www.somesite.com in the browser address bar without the rest of the directory and filename appearing ? Regards -- Chris Blake Cell: 082 775 1492 Work: +27 11 880 2825 Fax : +27 11 782 0841 Mail: [EMAIL PROTECTED] I do not care if half the league strikes. Those who do will encounter quick retribution. All will be suspended, and I don't care if it wrecks the National League for five years. This is the United States of America and one citizen has as much right to play as another. -- Ford Frick, National League President, reacting to a threatened strike by some Cardinal players in 1947 if Jackie Robinson took the field against St. Louis. The Cardinals backed down and played. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Secure input
On 2/27/06 6:20 AM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: When users input is displayed for others then themself I try to filter out html tags too. I type cast all relevant variables before processing them as one last check. Type casting forces the variable to be of the type you expect. For example, if you are expecting two integers: $id1 and $id2 but you get the following user input: $_GET[id1] = 1234; $_GET[id2] = evil hakor code; if you type cast these as: $id1 = (int)$_GET[id1]; $id2 = (int)$_GET[id2]; the output of print $id1, $id2 would be: 1234, 0 Possible types you can use (not all relevant to $_GET): (int), (integer) - cast to integer (bool), (boolean) - cast to boolean (float), (double), (real) - cast to float (string) - cast to string (array) - cast to array (object) - cast to object - schnippy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RSS / XML
Gustav Wiberg wrote: Hi there guys! Where is a good startpoint for learning XML Reader on a very, very basic level? (I appreciate links) Is RSS a technique for retrieving XML? I can't clue the pieces together... /G Please turn off your mail client's request for read receipts when sending to a mailing list. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Manual in PDF format
ÃmìtVërmå wrote: snip Please turn off your mail client's request for read receipts when sending to a mailing list. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] classes and return values
I am attempting to work up a class and because I am unfamiliar with some of the code flow I am only able to get a return value of 'object'. How can I pull the data out of a class? Any help, or pointers on what I am doing wrong is appreciated. class myAuth { var $user; var $pass; var $lvl; var $id; function login( $user, $pass ) { require 'templates/auth.tmplte.php'; global $defined, $error_message; if( ( empty( $user ) ) || ( empty( $pass ) ) ) { if( $_SESSION['count']++ = 1 ) { $errors = img src=\images/error.jpg\nbsp;nbsp;bYou need to provide a user name and password!/bbrbr; } $data = new myAuthTmplte(); $data-auth_template( 1, NULL, NULL, NULL, $errors ); logs( $error_message['str_chk'] ); } } } -- Jason Gerfen Student Computing Labs, University Of Utah [EMAIL PROTECTED] J. Willard Marriott Library 295 S 1500 E, Salt Lake City, UT 84112-0860 801-585-9810 When asked what love is: Love is the Jager talking. ~Craig Baldo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Linux distributions and tools for Linux/Apache/PHP/MySQL dev
Chris Lott wrote: I'm making the switch from Windows to Linux for mydesktop and development environment and would greatly appreciate suggestions for development tools on this platform. Ubuntu seems to be getting all the press, but suggestions about Linux distributions are welcome as well! c User preference. Find what you like. I'm a Red Hat guy, but really only because that's the Linux version I cut my teeth on in '96. Over the years, I've used vi, Quanta, Bluefish, Kate and Zend. Today I just use Zend or vi. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Linux distributions and tools for Linux/Apache/PHP/MySQL dev
Curt Zirzow wrote: On Sat, Feb 25, 2006 at 01:41:06PM -0900, Chris Lott wrote: I'm making the switch from Windows to Linux for mydesktop and development environment and would greatly appreciate suggestions for development tools on this platform. Ubuntu seems to be getting all the press, but suggestions about Linux distributions are welcome as well! Basically what everyone else has said... they all work basically the same, it's just personal preference. I've tried a few and personally find Debian the best, I run screaming from anything that uses rpms. Before I get into what distib to use there are a few things i'd like to point out: 1) Avoid using the packaging system the OS provides for the developement server. If you do, you will be under the control of the OS for your choice of versions of webserver, db server, php, or any dependency that is needed for those. I would consider the above to be the worst advice you could possibly give someone starting out in Linux land. The easiest, nastiest and most confusing way to screw up your linux install is to start manually installing packages. I killed my first install and nearly my second before I learnt my lesson. Dependancy hell is the reason why package management systems exist, to compile php5 on a fairly clean debian install I would need to install roughly 130 packages, there is no way that I'm going to try to do that by hand. When one of my friends starts using linux I give tell them to never do a manual install. You stick with the packages supplied or go with unofficial packages like debian backports. Compiling packages has it's place, many of my computers have a manually compiled PHP, but it's definantly not something to do on a first date. I also use the package manager to get all the dependancies (apt-get build-dep php5) and all the related programs such as apache and postgres. David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Expiring other resources with HTTP headers
Hello everybody, I write here to find out if this is possible: I want to expire an static file in the web browser through an HTTP header (Expires, Cache-Control or something else) sent from a PHP program. The usual thing is that those headers apply only to the program or file sending those headers, what I want is that a program sends those headers to affect a different file in the browser cache. In more detail, My web app generates a JavaScript file from the information stored in the database, that file represents the user menu and it is what the user sees in the web browser. Now, through an apache directive I set expiration times for several kinds of static resources so the web server doesn't get slash dotted with lots of unnecessary requests (this is a web app with lots of traffic). Although the JavaScript files are generated from PHP, it is seen as static content from the web browser POV. Right now I have set the expiration time for the menu files to 20 minutes. But let's say an admin user change the permissions of a user and the affected user hits a link that says Regenerate menu. What will happen is that the JavaScript file will be regenerated on the web server but there is a chance that the browser won't see the change because the file is still valid in the cache. I know I could reduce the expiration time to reduce this problem but most of the time those files do not change. What can I do to notify the web browser that the file in the cache is no longer valid? I hope there is enough information here and that somebody can give me a hint in the right direction. Thanks, -William -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Expiring other resources with HTTP headers
William Lovaton wrote: Hello everybody, I write here to find out if this is possible: I want to expire an static file in the web browser through an HTTP header (Expires, Cache-Control or something else) sent from a PHP program. The usual thing is that those headers apply only to the program or file sending those headers, what I want is that a program sends those headers to affect a different file in the browser cache. In more detail, My web app generates a JavaScript file from the information stored in the database, that file represents the user menu and it is what the user sees in the web browser. Now, through an apache directive I set expiration times for several kinds of static resources so the web server doesn't get slash dotted with lots of unnecessary requests (this is a web app with lots of traffic). Although the JavaScript files are generated from PHP, it is seen as static content from the web browser POV. Right now I have set the expiration time for the menu files to 20 minutes. But let's say an admin user change the permissions of a user and the affected user hits a link that says Regenerate menu. What will happen is that the JavaScript file will be regenerated on the web server but there is a chance that the browser won't see the change because the file is still valid in the cache. I know I could reduce the expiration time to reduce this problem but most of the time those files do not change. What can I do to notify the web browser that the file in the cache is no longer valid? I hope there is enough information here and that somebody can give me a hint in the right direction. Thanks, -William Set the HTML expire to yesterday. Therfore the browser will reload the whole page. Barry -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Expiring other resources with HTTP headers
I don't think you can expire another file, I would consider any ability to do so a bug in the browser. Someone with too much time on their hands could possibly turn something like that into a security risk. I would solve the changing javascript problem by subtly altering the pages that use the javascript file. A web browser will recognise menu.js, menu.js?ver=1 and menu.js?ver=2 as different pages. You can use this for your application by including menu.js?ver=$ver in each of your pages. When the menu is modified and regenerated, increment $ver. Every client will refetch menu.js as it views it as a different file. David William Lovaton wrote: Hello everybody, I write here to find out if this is possible: I want to expire an static file in the web browser through an HTTP header (Expires, Cache-Control or something else) sent from a PHP program. The usual thing is that those headers apply only to the program or file sending those headers, what I want is that a program sends those headers to affect a different file in the browser cache. In more detail, My web app generates a JavaScript file from the information stored in the database, that file represents the user menu and it is what the user sees in the web browser. Now, through an apache directive I set expiration times for several kinds of static resources so the web server doesn't get slash dotted with lots of unnecessary requests (this is a web app with lots of traffic). Although the JavaScript files are generated from PHP, it is seen as static content from the web browser POV. Right now I have set the expiration time for the menu files to 20 minutes. But let's say an admin user change the permissions of a user and the affected user hits a link that says Regenerate menu. What will happen is that the JavaScript file will be regenerated on the web server but there is a chance that the browser won't see the change because the file is still valid in the cache. I know I could reduce the expiration time to reduce this problem but most of the time those files do not change. What can I do to notify the web browser that the file in the cache is no longer valid? I hope there is enough information here and that somebody can give me a hint in the right direction. Thanks, -William -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Secure input
Hi, What shall one do to avoid people that trys to manipulate my server? I mysql_real_escape_string() all input from GET and POST. A long time ago I think I used addslashes or something like that too, so people couldn't insert php code in their input. Is that still something I should do, or does mysql_real_escape_string() take care of that too? And is it even possible for a user to execute there own php code if I not output the input via the eval() function? When users input is displayed for others then themself I try to filter out html tags too. Anything else I should think of? Sorry if this has been asked a million times before. Thanks for your time /Regards Emil Emil: I use the following as an include on all my form and cookie processing: function stripFormSlashes($arr) { if (!is_array($arr)) { return stripslashes($arr); } else { return array_map('stripFormSlashes', $arr); } } if (get_magic_quotes_gpc()) { $_GET = stripFormSlashes($_GET); $_POST = stripFormSlashes($_POST); } If anyone see's a reason why I shouldn't, please clue me. tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sr. PHP Salary North Carolina
Can anyone possibly tell me what the salary range is for a Sr. PHP/MySQL Developer in North Carolina? Thanks -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.375 / Virus Database: 268.1.0/269 - Release Date: 2/24/2006 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Class calling Class returning 'object'
I am in need of some assistance working with classes. I have a function (X) which calls a class (A), that class calls another class (B) and returns the results. At this point I think I am doing everything correctly within' class A because if I echo the results of Class A calling Class B the data is displayed. However, when I use 'return $data' from function X (ex. $data = $ClassA-function( $var1, $var2 ); ) the word 'object' is being displayed in the browser. Here is the code; any help, tips, pointers is appreciated. // function 'chooser' calls class 'myAuth' and returns $data function chooser( $level, $page, $user, $pass ) { if( $page == auth ) { require 'auth.inc.php'; $data = new myAuth; $data = $data-login( $_POST['user'], $_POST['pass'] ); } else { $data = error; } return $data; } // myAuth class class myAuth { var $data; function login( $user, $pass ) { if( ( empty( $user ) ) || ( empty( $pass ) ) ) { $data = new myAuthTmplte(); $data = $data-AuthTemplate( 1, NULL, NULL, NULL, $errors ); } else { $data = error; } return $data; // If I do echo $data I can see the results of calling the myAuthTmplte Class } // myAuthTmplte class class myAuthTmplte { var $data; function AuthTemplate( $cmd, $args, $num, $message, $errors ) { $data = I should be seeing this text right here; // This data should be displayed but I am only seeing the word 'object' in the browser return $data; } -- Jason Gerfen When asked what love is: Love is the Jager talking. ~Craig Baldo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Expiring other resources with HTTP headers
Nice idea... thanks. I agree with you that the ability to expire another file would be somewhat risky but I fail to see how this could be exploited. May be the browser should allow this kind of operations from pages coming from the same server. But again, I don't think this is posible to begin with, I just wanted to make sure about that. Thanks again, -William El mar, 28-02-2006 a las 02:35 +1100, David Tulloh escribió: I don't think you can expire another file, I would consider any ability to do so a bug in the browser. Someone with too much time on their hands could possibly turn something like that into a security risk. I would solve the changing javascript problem by subtly altering the pages that use the javascript file. A web browser will recognise menu.js, menu.js?ver=1 and menu.js?ver=2 as different pages. You can use this for your application by including menu.js?ver=$ver in each of your pages. When the menu is modified and regenerated, increment $ver. Every client will refetch menu.js as it views it as a different file. David William Lovaton wrote: Hello everybody, I write here to find out if this is possible: I want to expire an static file in the web browser through an HTTP header (Expires, Cache-Control or something else) sent from a PHP program. The usual thing is that those headers apply only to the program or file sending those headers, what I want is that a program sends those headers to affect a different file in the browser cache. In more detail, My web app generates a JavaScript file from the information stored in the database, that file represents the user menu and it is what the user sees in the web browser. Now, through an apache directive I set expiration times for several kinds of static resources so the web server doesn't get slash dotted with lots of unnecessary requests (this is a web app with lots of traffic). Although the JavaScript files are generated from PHP, it is seen as static content from the web browser POV. Right now I have set the expiration time for the menu files to 20 minutes. But let's say an admin user change the permissions of a user and the affected user hits a link that says Regenerate menu. What will happen is that the JavaScript file will be regenerated on the web server but there is a chance that the browser won't see the change because the file is still valid in the cache. I know I could reduce the expiration time to reduce this problem but most of the time those files do not change. What can I do to notify the web browser that the file in the cache is no longer valid? I hope there is enough information here and that somebody can give me a hint in the right direction. Thanks, -William -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Expiring other resources with HTTP headers
I know I could reduce the expiration time to reduce this problem but most of the time those files do not change. What can I do to notify the web browser that the file in the cache is no longer valid? -William William: Include this: ?php # nocache.php // this script prevents all caching // expires on any past date header (Expires: Mon, 26 Jul 1997 05:00: GMT); // last modified at current date and time header (Last-Modified: . gmdate(D, d M Y H:i:s) . GMT); // for HTTP 1.1: header (Cache-Control: no-store, no-cache, must-revalidate); header (Cache-Control: post-check=0, pre-check=0, false); // for HTTP 1.0 header (Pragma: no-cache); ? HTH's tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Expiring other resources with HTTP headers
El lun, 27-02-2006 a las 16:21 +0100, Barry escribió: Set the HTML expire to yesterday. Therfore the browser will reload the whole page. Barry Hi Barry, I don't think this would work, this should refresh the HTML page only but the link pointing to the javascript file will be taken from the cache I think. -William -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Optional pass-by-reference parameters?
I would like to have an optional pass-by-reference. i.e. you can call the function w/o the variable. Basically, like how you don't need to pass $matches to the preg_match function. I've tried, function some_func($var = null) and this doesn't work. func_get_args only gets copies, does anyone have any other solutions? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Sr. PHP Salary North Carolina
Beau Gould wrote: Can anyone possibly tell me what the salary range is for a Sr. PHP/MySQL Developer in North Carolina? Thanks Depends on the workspace and what kind of work somone has to do. Is it a monitoring position, or a leading one. More infos would probably help though. -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Sr. PHP Salary North Carolina
No I haven't. Thanks for the lead. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, February 27, 2006 11:18 AM To: [EMAIL PROTECTED]; php-general@lists.php.net Subject: RE: [PHP] Sr. PHP Salary North Carolina [snip] Can anyone possibly tell me what the salary range is for a Sr. PHP/MySQL Developer in North Carolina? [/snip] Have you tried looking at salary.com ? -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.375 / Virus Database: 268.1.0/269 - Release Date: 2/24/2006 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Sr. PHP Salary North Carolina
[snip] Can anyone possibly tell me what the salary range is for a Sr. PHP/MySQL Developer in North Carolina? [/snip] Have you tried looking at salary.com ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Expiring other resources with HTTP headers
Hi Tedd, That's not exactly what I am looking for. That would cause the JavaScript file to be requested to the web server every single time. I just want the browser to request the file only when it have been modified on the server. Let's say that by default, those JavaScript files expires every 4 hours and that when a PHP program regenerates the file in the server it should, somehow, notify the web browser that the file changed and that it should request that file the next time it reloads the page or else the user will be seeing an outdated menu. I am almost sure this is not posible using HTTP headers. The only way I see this could be achieved is by sending some random parameter to the JS file so that the browser thinks it is a different file. This was suggested by David Tulloh in a previous email. Thanks again, -William El lun, 27-02-2006 a las 11:12 -0500, tedd escribió: I know I could reduce the expiration time to reduce this problem but most of the time those files do not change. What can I do to notify the web browser that the file in the cache is no longer valid? -William William: Include this: ?php # nocache.php // this script prevents all caching // expires on any past date header (Expires: Mon, 26 Jul 1997 05:00: GMT); // last modified at current date and time header (Last-Modified: . gmdate(D, d M Y H:i:s) . GMT); // for HTTP 1.1: header (Cache-Control: no-store, no-cache, must-revalidate); header (Cache-Control: post-check=0, pre-check=0, false); // for HTTP 1.0 header (Pragma: no-cache); ? HTH's tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Expiring other resources with HTTP headers
William Lovaton wrote: Let's say that by default, those JavaScript files expires every 4 hours and that when a PHP program regenerates the file in the server it should, somehow, notify the web browser that the file changed and that it should request that file the next time it reloads the page or else the user will be seeing an outdated menu. I am almost sure this is not posible using HTTP headers. The only way I see this could be achieved is by sending some random parameter to the JS file so that the browser thinks it is a different file. This was suggested by David Tulloh in a previous email. The best way I've found to do this is to put the file modification time in the querystring for the JS file. Set the expiry for that file to 365 days (or whatever) using Apache. That way you don't need to do anything when you update the JS file for it to be rolled out and the only cost per request is looking up the file modification time. Another way to do it is to store the version number actually in the JS filename itself. This would have the added benefit of being able to quickly rollback to a previous version if needed. Hope that helps. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sr. PHP Salary North Carolina
Beau Gould wrote: Can anyone possibly tell me what the salary range is for a Sr. PHP/MySQL Developer in North Carolina? Thanks http://.salary.com -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Expiring other resources with HTTP headers
William said: That's not exactly what I am looking for. That would cause the JavaScript file to be requested to the web server every single time. I just want the browser to request the file only when it have been modified on the server. Let's say that by default, those JavaScript files expires every 4 hours and that when a PHP program regenerates the file in the server it should, somehow, notify the web browser that the file changed and that it should request that file the next time it reloads the page or else the user will be seeing an outdated menu. I am almost sure this is not posible using HTTP headers. The only way I see this could be achieved is by sending some random parameter to the JS file so that the browser thinks it is a different file. This was suggested by David Tulloh in a previous email. William: I may not understand what you're trying to do -- but, perhaps using something like: ?php echo Last modified: . date (F d Y H:i:s., getlastmod());? In concert with what I suggested might work. tedd ps: your email address has generated a couple of bounced blog stuff thus far. William: Include this: ?php # nocache.php // this script prevents all caching // expires on any past date header (Expires: Mon, 26 Jul 1997 05:00: GMT); // last modified at current date and time header (Last-Modified: . gmdate(D, d M Y H:i:s) . GMT); // for HTTP 1.1: header (Cache-Control: no-store, no-cache, must-revalidate); header (Cache-Control: post-check=0, pre-check=0, false); // for HTTP 1.0 header (Pragma: no-cache); ? HTH's tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] move_uploaded_file and CPU wait state (IO)
Hi, My first mailing, if I'm in wrong group or such, let me know ;) Here comes my question. I have implemented file uploads to my server. At the end of upload, file is beeing moved from /tmp to permanent directory. However, whenever this happens, CPU goes berzerk and waits for disk to finish moving file. As allowed files may be up to 100 MB per file, having more then 3 users makes complete server freeze. Meantime, server load reaches skyhigh 40+. After file is moved, server resumes normal operation, however while moving file server is completely not responding. Is there a work around? I am not so good with linux (yet ^^), so I do not know if there is place for improvement on OS itself. I asked this question on Debian forum, but am trying here as well. If someone has same problem and prefferably solution, or even sugestions - all is welcome! :) Server P4 2.0 512 MB RAM (will be 2 GB by the end of the week) 2 x 80 GB IDE HDD Thank you! Regards, Aleksandar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] move_uploaded_file and CPU wait state (IO)
Are you sure its the move_uploaded_file() function that is causing the delay? It could be the actual upload of the file itself. If it is the function causing the delay than try the rename() function instead. Also, I have used the copy() and unlink() functions and they work fast. Aaron On 2/27/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, My first mailing, if I'm in wrong group or such, let me know ;) Here comes my question. I have implemented file uploads to my server. At the end of upload, file is beeing moved from /tmp to permanent directory. However, whenever this happens, CPU goes berzerk and waits for disk to finish moving file. As allowed files may be up to 100 MB per file, having more then 3 users makes complete server freeze. Meantime, server load reaches skyhigh 40+. After file is moved, server resumes normal operation, however while moving file server is completely not responding. Is there a work around? I am not so good with linux (yet ^^), so I do not know if there is place for improvement on OS itself. I asked this question on Debian forum, but am trying here as well. If someone has same problem and prefferably solution, or even sugestions - all is welcome! :) Server P4 2.0 512 MB RAM (will be 2 GB by the end of the week) 2 x 80 GB IDE HDD Thank you! Regards, Aleksandar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- + | Aaron Koning | Information Technologist | Prince George, BC, Canada. + | http://datashare.gis.unbc.ca/fist/ | http://datashare.gis.unbc.ca/gctp-js/ +
Re: [PHP] Linux distributions and tools for Linux/Apache/PHP/MySQL dev
On Tue, Feb 28, 2006 at 02:13:15AM +1100, David Tulloh wrote: Curt Zirzow wrote: Before I get into what distib to use there are a few things i'd like to point out: 1) Avoid using the packaging system the OS provides for the developement server. If you do, you will be under the control of the OS for your choice of versions of webserver, db server, php, or any dependency that is needed for those. I would consider the above to be the worst advice you could possibly give someone starting out in Linux land. The easiest, nastiest and most confusing way to screw up your linux install is to start manually installing packages. I killed my first install and nearly my second before I learnt my lesson. Yeah, i guess you're correct that this isn't very good advise. I guess my point is more on the fact that you are limited on what version of application you have available within the distros package system. Dependancy hell is the reason why package management systems exist, to compile php5 on a fairly clean debian install I would need to install roughly 130 packages, there is no way that I'm going to try to do that by hand. ... Compiling packages has it's place, many of my computers have a manually compiled PHP, but it's definantly not something to do on a first date. I also use the package manager to get all the dependancies (apt-get build-dep php5) and all the related programs such as apache and postgres. Very much agreed. Thanks for this pointing out, i guess my mindset wasn't focused on a new user of linux. Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] classes and return values
Jason Gerfen wrote: I am attempting to work up a class and because I am unfamiliar with some of the code flow I am only able to get a return value of 'object'. How can I pull the data out of a class? which data? It doesn't seem as if anyone knows what your trying to do. (try to explain it again) there is a difference between class and object - it's quite fundamental to the whole OO concept. ? // the following is a [php4] class class Test { var $foo = bar; function getData() { return $this-foo; } } // $t is an object (assuming an error doesn't occur when instantiating it) $t = new Test; // this is an echo statement that outputs the return val from a method call echo $t-getData(),\n; Any help, or pointers on what I am doing wrong is appreciated. class myAuth { var $user; var $pass; var $lvl; var $id; function login( $user, $pass ) { require 'templates/auth.tmplte.php'; global $defined, $error_message; if( ( empty( $user ) ) || ( empty( $pass ) ) ) { if( $_SESSION['count']++ = 1 ) { $errors = img src=\images/error.jpg\nbsp;nbsp;bYou need to provide a user name and password!/bbrbr; } $data = new myAuthTmplte(); $data-auth_template( 1, NULL, NULL, NULL, $errors ); logs( $error_message['str_chk'] ); } } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Optional pass-by-reference parameters?
TomS wrote: I would like to have an optional pass-by-reference. i.e. you can call the function w/o the variable. Basically, like how you don't need to pass $matches to the preg_match function. I've tried, function some_func($var = null) and this doesn't work. func_get_args only gets copies, does anyone have any other solutions? use php5. the following is from a method that has worked since php5beta3: static function findRange( $className, $order = null, $first = null, $skip = null, $f = null, $totalcount = null, $trans = false, $autocommit = false, $minimal = false) { /**/ } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Strange slowdowns in PHP
Hi there, I just setted up some changes to the Apache configuration and made some programming in PHP to log a request (and information about that request) when it is taking a lot of time to finish (let's say 20 secs). In the logs, there have been lots of useful information and I already improved the performance on several pages, specially related to database queries. But from time to time there are pages in the log that shouldn't be slow but still they take 20 or 30 secs to complete. The strategy I used is the following: 1. Configure Apache to register the request time in the request headers RequestHeader set requestTime %t 2. Create a function an register it with register_shutdown_function() so it is executed after PHP ends the execution of every script. 3. This function will take the requestTime and calculate the difference with the current time (time stamp). 4. If the difference (execution time) is less than 20 seconds it exits normally, else, it logs the information about this request in a file. 5. The registered information includes: $_REQUEST data and $_SESSION data at the time of execution. And finally a profile of some critical functions. This functions are often the ones that goes to the database and they are likely to be slow. The page I am talking about doesn't execute any database query. It just generates an image from the data that is stored in the session. I however, profile some function that are not database queries but they are the only critical path in the script. Looking at the log I get the following information: - Execution time: 29.3 secs - Request started at: 11:08:06 AM - Request ended at: 11:08:35 AM - The functions that got executed were (time, class::method, duration): - 11:08:06, GraficoMaterno::alturaUterina, 0.009499 - 11:08:06, GraficoAlturaUterina::session_start, 0.001259 - 11:08:06, GraficoAlturaUterina::session_write_close, 0.001613 - 11:08:06, GraficoAlturaUterina::sendImage, 0.029186 The last record in the profile (GraficoAlturaUterina::sendImage) corresponds to the last couple of lines of code in the script which are: imagepng($image); imagedestroy($image); As you can see they took only 0.029186 seconds which is very fast. the other thing that you can see in the profile is that the last line of code got executed exactly in the very same second in which the request started. This means that the script is very fast and that something is taking a lot of time after the last line of execution. Note that I open and close the user session to update some data in a safe manner that might be being accessed at the same time by other apache processes. And as you can see it is very fast too... that was the only suspect I had. :( Finally, I don't think this is a problem of the function that logs the execution time and that is executed automatically at shutdown. I was seeing the sporadic slowdown even before implementing this instrumentation and the function implementation is so simple that it is very unlikely that the delay is in there. For further information I am using PHP 4.3.11 and Apache 2, all of them are official packages from a Fedora Core 3 system with the latest updates. Is there a known bug in PHP that might be causing this sporadic slowdowns? In general our web app is very fast but this are the corner cases. Any ideas about this? Thanks in advance, -William -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Secure input
On Mon, Feb 27, 2006 at 12:20:51PM +0100, [EMAIL PROTECTED] wrote: Hi, What shall one do to avoid people that trys to manipulate my server? I mysql_real_escape_string() all input from GET and POST. The mysql_escape_string() will protect you from sql injections, the thing you have to watch out for is if you have the php.ini directive magic_quotes_gpc set to On then you will end up with data in your database like: I\'m escaped Which if magic_quotes_gpc is Off you will have in the db: I'm escaped The latter is the one you want in the db. To avoid these issues I would tend to avoid any magic_* .ini directives and escape the data when i desire to. If you are building a tool that may be used in any configuration setup, you have to detect in your code what to do if the magic_* directive is on or off. *see the magic directives in: http://php.net/ref.info A long time ago I think I used addslashes or something like that too, so people couldn't insert php code in their input. Is that still something I should do, or does mysql_real_escape_string() take care of that too? And is it even possible for a user to execute there own php code if I not output the input via the eval() function? The main difference between addslashes and mysql_real_escape_string() is that addslashes() is designed to protect what php may think is harmful, mysql_real_escape_sting() is designed to protect what the db server thinks is harmful. When users input is displayed for others then themself I try to filter out html tags too. Instead of filtering out html tags, your best option is to apply either htmlentities() or htmlspecialchars() to the output from the input by a user. Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strange slowdowns in PHP
What about session garbage collection? Can you log when that happens and see if it correlates with your problem? Cheers, Rob. On Mon, 2006-02-27 at 16:15, William Lovaton wrote: Hi there, I just setted up some changes to the Apache configuration and made some programming in PHP to log a request (and information about that request) when it is taking a lot of time to finish (let's say 20 secs). In the logs, there have been lots of useful information and I already improved the performance on several pages, specially related to database queries. But from time to time there are pages in the log that shouldn't be slow but still they take 20 or 30 secs to complete. The strategy I used is the following: 1. Configure Apache to register the request time in the request headers RequestHeader set requestTime %t 2. Create a function an register it with register_shutdown_function() so it is executed after PHP ends the execution of every script. 3. This function will take the requestTime and calculate the difference with the current time (time stamp). 4. If the difference (execution time) is less than 20 seconds it exits normally, else, it logs the information about this request in a file. 5. The registered information includes: $_REQUEST data and $_SESSION data at the time of execution. And finally a profile of some critical functions. This functions are often the ones that goes to the database and they are likely to be slow. The page I am talking about doesn't execute any database query. It just generates an image from the data that is stored in the session. I however, profile some function that are not database queries but they are the only critical path in the script. Looking at the log I get the following information: - Execution time: 29.3 secs - Request started at: 11:08:06 AM - Request ended at: 11:08:35 AM - The functions that got executed were (time, class::method, duration): - 11:08:06, GraficoMaterno::alturaUterina, 0.009499 - 11:08:06, GraficoAlturaUterina::session_start, 0.001259 - 11:08:06, GraficoAlturaUterina::session_write_close, 0.001613 - 11:08:06, GraficoAlturaUterina::sendImage, 0.029186 The last record in the profile (GraficoAlturaUterina::sendImage) corresponds to the last couple of lines of code in the script which are: imagepng($image); imagedestroy($image); As you can see they took only 0.029186 seconds which is very fast. the other thing that you can see in the profile is that the last line of code got executed exactly in the very same second in which the request started. This means that the script is very fast and that something is taking a lot of time after the last line of execution. Note that I open and close the user session to update some data in a safe manner that might be being accessed at the same time by other apache processes. And as you can see it is very fast too... that was the only suspect I had. :( Finally, I don't think this is a problem of the function that logs the execution time and that is executed automatically at shutdown. I was seeing the sporadic slowdown even before implementing this instrumentation and the function implementation is so simple that it is very unlikely that the delay is in there. For further information I am using PHP 4.3.11 and Apache 2, all of them are official packages from a Fedora Core 3 system with the latest updates. Is there a known bug in PHP that might be causing this sporadic slowdowns? In general our web app is very fast but this are the corner cases. Any ideas about this? Thanks in advance, -William -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Strange slowdowns in PHP
Hello, on 02/27/2006 06:15 PM William Lovaton said the following: Looking at the log I get the following information: - Execution time: 29.3 secs - Request started at: 11:08:06 AM - Request ended at: 11:08:35 AM - The functions that got executed were (time, class::method, duration): - 11:08:06, GraficoMaterno::alturaUterina, 0.009499 - 11:08:06, GraficoAlturaUterina::session_start, 0.001259 - 11:08:06, GraficoAlturaUterina::session_write_close, 0.001613 - 11:08:06, GraficoAlturaUterina::sendImage, 0.029186 The last record in the profile (GraficoAlturaUterina::sendImage) corresponds to the last couple of lines of code in the script which are: imagepng($image); imagedestroy($image); If you are generating a large image, it may take some time to flush the output buffer to serve to the user browser. -- Regards, Manuel Lemos Metastorage - Data object relational mapping layer generator http://www.metastorage.net/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strange slowdowns in PHP
Mmmm... can you elaborate on that please? I kind of have the idea of what you mean but I don't know how to do it. What is exactly garbage collection in the context of a PHP session? I guess it is when PHP scans every session file to see if there are stale data or something like that and you can tune the probability of this process being triggered in the php.ini file. How would you measure that? is there a way to do that? Thanks for you insight. -William El lun, 27-02-2006 a las 16:34 -0500, Robert Cummings escribió: What about session garbage collection? Can you log when that happens and see if it correlates with your problem? Cheers, Rob. On Mon, 2006-02-27 at 16:15, William Lovaton wrote: Hi there, I just setted up some changes to the Apache configuration and made some programming in PHP to log a request (and information about that request) when it is taking a lot of time to finish (let's say 20 secs). In the logs, there have been lots of useful information and I already improved the performance on several pages, specially related to database queries. But from time to time there are pages in the log that shouldn't be slow but still they take 20 or 30 secs to complete. The strategy I used is the following: 1. Configure Apache to register the request time in the request headers RequestHeader set requestTime %t 2. Create a function an register it with register_shutdown_function() so it is executed after PHP ends the execution of every script. 3. This function will take the requestTime and calculate the difference with the current time (time stamp). 4. If the difference (execution time) is less than 20 seconds it exits normally, else, it logs the information about this request in a file. 5. The registered information includes: $_REQUEST data and $_SESSION data at the time of execution. And finally a profile of some critical functions. This functions are often the ones that goes to the database and they are likely to be slow. The page I am talking about doesn't execute any database query. It just generates an image from the data that is stored in the session. I however, profile some function that are not database queries but they are the only critical path in the script. Looking at the log I get the following information: - Execution time: 29.3 secs - Request started at: 11:08:06 AM - Request ended at: 11:08:35 AM - The functions that got executed were (time, class::method, duration): - 11:08:06, GraficoMaterno::alturaUterina, 0.009499 - 11:08:06, GraficoAlturaUterina::session_start, 0.001259 - 11:08:06, GraficoAlturaUterina::session_write_close, 0.001613 - 11:08:06, GraficoAlturaUterina::sendImage, 0.029186 The last record in the profile (GraficoAlturaUterina::sendImage) corresponds to the last couple of lines of code in the script which are: imagepng($image); imagedestroy($image); As you can see they took only 0.029186 seconds which is very fast. the other thing that you can see in the profile is that the last line of code got executed exactly in the very same second in which the request started. This means that the script is very fast and that something is taking a lot of time after the last line of execution. Note that I open and close the user session to update some data in a safe manner that might be being accessed at the same time by other apache processes. And as you can see it is very fast too... that was the only suspect I had. :( Finally, I don't think this is a problem of the function that logs the execution time and that is executed automatically at shutdown. I was seeing the sporadic slowdown even before implementing this instrumentation and the function implementation is so simple that it is very unlikely that the delay is in there. For further information I am using PHP 4.3.11 and Apache 2, all of them are official packages from a Fedora Core 3 system with the latest updates. Is there a known bug in PHP that might be causing this sporadic slowdowns? In general our web app is very fast but this are the corner cases. Any ideas about this? Thanks in advance, -William -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] recompiling php
blackwater dev wrote: I am trying to recompile php 5 with freetds so am using this : which specific version? try another [pristine] src tarball. ./configure '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-mysql=/root/mysql-standard-4.1.9-pc-linux-gnu-i686' '--with-mssql=/usr/local/freetds' you found freetds there I take it? (I saw your previous related post) Things seem ok so I do make and at the end of make I get this error: /usr/bin/ld:ext/mssql/php_mssql.lo: file format not recognized; treating as linker script /usr/bin/ld:ext/mssql/php_mssql.lo:2: syntax error collect2: ld returned 1 exit status make: *** [libphp5.la] Error 1 I then did make install and of course got the same error: /usr/bin/ld:ext/mssql/php_mssql.lo: file format not recognized; treating as linker script /usr/bin/ld:ext/mssql/php_mssql.lo:2: syntax error collect2: ld returned 1 exit status make: *** [libphp5.la] Error 1 I then do make clean. Of course, it doesn't seem to regenerate the libphp5.so so once I restart apache, and check out phpinfo, it shows the old 'make clean' doesn't install anything. it's the 'make install' that would install the .so if the error didn't occur. no? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Strange slowdowns in PHP
Hi Manuel, El lun, 27-02-2006 a las 18:54 -0300, Manuel Lemos escribió: Hello, on 02/27/2006 06:15 PM William Lovaton said the following: Looking at the log I get the following information: - Execution time: 29.3 secs - Request started at: 11:08:06 AM - Request ended at: 11:08:35 AM - The functions that got executed were (time, class::method, duration): - 11:08:06, GraficoMaterno::alturaUterina, 0.009499 - 11:08:06, GraficoAlturaUterina::session_start, 0.001259 - 11:08:06, GraficoAlturaUterina::session_write_close, 0.001613 - 11:08:06, GraficoAlturaUterina::sendImage, 0.029186 The last record in the profile (GraficoAlturaUterina::sendImage) corresponds to the last couple of lines of code in the script which are: imagepng($image); imagedestroy($image); If you are generating a large image, it may take some time to flush the output buffer to serve to the user browser. The image is small. And as you can see in the profile, that operation took 0.02 secs, so it is very fast. Unless those operations are being executed in asynchronous mode (which I don't think they are) this might be the responsible of the slowdown. I have to note that this problem is happening on random pages which also generates regular HTML, this is not something particular to images. So my guess would be that the problem is somewhere in the session code. Thanks, -William -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Expiring other resources with HTTP headers
El lun, 27-02-2006 a las 12:35 -0500, tedd escribió: ps: your email address has generated a couple of bounced blog stuff thus far. Yeah, I seen that a couple of time now. What is going on? I have not anything to do with blogger.com, I don't know what is happening. What can I do to solve this? I don't want to annoy everyone in the mailing list. -William -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Strange slowdowns in PHP
Hello, on 02/27/2006 07:22 PM William Lovaton said the following: Looking at the log I get the following information: - Execution time: 29.3 secs - Request started at: 11:08:06 AM - Request ended at: 11:08:35 AM - The functions that got executed were (time, class::method, duration): - 11:08:06, GraficoMaterno::alturaUterina, 0.009499 - 11:08:06, GraficoAlturaUterina::session_start, 0.001259 - 11:08:06, GraficoAlturaUterina::session_write_close, 0.001613 - 11:08:06, GraficoAlturaUterina::sendImage, 0.029186 The last record in the profile (GraficoAlturaUterina::sendImage) corresponds to the last couple of lines of code in the script which are: imagepng($image); imagedestroy($image); If you are generating a large image, it may take some time to flush the output buffer to serve to the user browser. The image is small. And as you can see in the profile, that operation took 0.02 secs, so it is very fast. Unless those operations are being executed in asynchronous mode (which I don't think they are) this might be the responsible of the slowdown. I have to note that this problem is happening on random pages which also generates regular HTML, this is not something particular to images. So my guess would be that the problem is somewhere in the session code. What I am trying to tell you is that generating data and serving it to the user browser are to separate steps. The output that your PHP script produces goes to a buffer that needs to be flushed after the script ends. I suppose you are serving data to users with slow connections. That would explain why you have the problem some times but not always. -- Regards, Manuel Lemos Metastorage - Data object relational mapping layer generator http://www.metastorage.net/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Parsing PHP variables in XML document
So I have found this code in http://bg.php.net/manual/en/ref.xmlrpc.php and it evaluates PHP but when I try to use the PIHandler separately. It doesnt work. So I ask if someone could help me to make parser1 return an array just like parser2. PARSER1 ?php $file = xmltest2.xml; function trustedFile($file) { // only trust local files owned by ourselves if (!eregi(^([a-z]+)://, $file) fileowner($file) == getmyuid()) { return true; } return false; } function startElement($parser, $name, $attribs) { echo lt;font color=\#cc\$name/font; if (count($attribs)) { foreach ($attribs as $k = $v) { echo font color=\#009900\$k/font=\font color=\#99\$v/font\; } } echo gt;; } function endElement($parser, $name) { echo lt;/font color=\#cc\$name/fontgt;; } function characterData($parser, $data) { echo b$data/b; } function PIHandler($parser, $target, $data) { switch (strtolower($target)) { case php: global $parser_file; // If the parsed document is trusted, we say it is safe // to execute PHP code inside it. If not, display the code // instead. if (trustedFile($parser_file[$parser])) { eval($data); } else { printf(Untrusted PHP code: i%s/i, htmlspecialchars($data)); } break; } } function defaultHandler($parser, $data) { if (substr($data, 0, 1) == substr($data, -1, 1) == ;) { printf('font color=#aa00aa%s/font', htmlspecialchars($data)); } else { printf('font size=-1%s/font', htmlspecialchars($data)); } } function externalEntityRefHandler($parser, $openEntityNames, $base, $systemId, $publicId) { if ($systemId) { if (!list($parser, $fp) = new_xml_parser($systemId)) { printf(Could not open entity %s at %s\n, $openEntityNames, $systemId); return false; } while ($data = fread($fp, 4096)) { if (!xml_parse($parser, $data, feof($fp))) { printf(XML error: %s at line %d while parsing entity %s \n, xml_error_string(xml_get_error_code($parser)), xml_get_current_line_number($parser), $openEntityNames); xml_parser_free($parser); return false; } } xml_parser_free($parser); return true; } return false; } function new_xml_parser($file) { global $parser_file; $xml_parser = xml_parser_create(); xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 1); xml_set_element_handler($xml_parser, startElement, endElement); xml_set_character_data_handler($xml_parser, characterData); xml_set_processing_instruction_handler($xml_parser, PIHandler); xml_set_default_handler($xml_parser, defaultHandler); xml_set_external_entity_ref_handler($xml_parser, externalEntityRefHandler); if (!($fp = @fopen($file, r))) { return false; } if (!is_array($parser_file)) { settype($parser_file, array); } $parser_file[$xml_parser] = $file; return array($xml_parser, $fp); } if (!(list($xml_parser, $fp) = new_xml_parser($file))) { die(could not open XML input); } echo pre; while ($data = fread($fp, 4096)) { if (!xml_parse($xml_parser, $data, feof($fp))) { die(sprintf(XML error: %s at line %d\n, xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); } } echo /pre; echo parse complete\n; xml_parser_free($xml_parser); ? PARSER2 ?php $file = 'data.xml'; $stack = array(); function startTag($parser, $name, $attrs) { global $stack; $tag=array(name=$name,attrs=$attrs); array_push($stack,$tag); } function cdata($parser, $cdata) { global $stack,$i; if(trim($cdata)) { $stack[count($stack)-1]['cdata']=$cdata; } } function endTag($parser, $name) { global $stack; $stack[count($stack)-2]['children'][] = $stack[count($stack)-1]; array_pop($stack); } $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, startTag, endTag); xml_set_character_data_handler($xml_parser, cdata); $data = xml_parse($xml_parser,file_get_contents($file)); if(!$data) { die(sprintf(XML error: %s at line %d, xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); } xml_parser_free($xml_parser); print(pre\n); print_r($stack); print(/pre\n); ? Here is the xml file I used to test: ?xml version=1.0? !DOCTYPE foo [ !ENTITY testEnt test entity ] foo element attrib=value/ testEnt; ?php echo This is some more PHP code being executed.; ? /foo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sessions in PHP... where to start???
Hi everybody! I have a problem and I was told to check out the sessions part in PHP. What I want to deal with is the following : I have a PHP page with a form, where the user writes some data. These data are then written into a file which is then used in a system command as input for an external program (NOTE: The data MUST be written into a file, it cannot be done elsewhise, because the external program takes a file as input). The thing is that I must somehow create a file everytime a user enters data into the form, so I must learn something on sessions I think. My question is, since I don't have a login system or something like that, but just want to create a different file each time (with the session_id being part of it, so that the file is unique), which session commands do I need? - Yahoo! Mail Use Photomail to share photos without annoying attachments.
Re: [PHP] recompiling php
Jochem Maas wrote: blackwater dev wrote: I am trying to recompile php 5 with freetds so am using this : which specific version? try another [pristine] src tarball. ./configure '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-mysql=/root/mysql-standard-4.1.9-pc-linux-gnu-i686' '--with-mssql=/usr/local/freetds' you found freetds there I take it? (I saw your previous related post) Things seem ok so I do make and at the end of make I get this error: /usr/bin/ld:ext/mssql/php_mssql.lo: file format not recognized; treating as linker script /usr/bin/ld:ext/mssql/php_mssql.lo:2: syntax error collect2: ld returned 1 exit status make: *** [libphp5.la] Error 1 I then did make install and of course got the same error: /usr/bin/ld:ext/mssql/php_mssql.lo: file format not recognized; treating as linker script /usr/bin/ld:ext/mssql/php_mssql.lo:2: syntax error collect2: ld returned 1 exit status make: *** [libphp5.la] Error 1 I then do make clean. Of course, it doesn't seem to regenerate the libphp5.so so once I restart apache, and check out phpinfo, it shows the old 'make clean' doesn't install anything. it's the 'make install' that would install the .so if the error didn't occur. no? 'make clean' undoes all of the compiling, so you have to do at least 'make' again (maybe configure too, can't remember off hand). You won't be able to install this module because it didn't finish compiling properly. As for the problem.. This suggests (found through google by searching for the error message :P): http://www.phparch.com/discuss/index.php/m/8536/062674b9ac3b46fc71fa818bdc36dc04/ using --with-mssql=/usr/local instead of --with-mssql=/usr/local/freetds -- 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] URL output query
Chris wrote: Greetings PHP folks, Which PHP function do I use if I want to achieve the following : http://www.somesite.com/gallery/pics.php is the url...how do I get it to read only http://www.somesite.com in the browser address bar without the rest of the directory and filename appearing ? If you're using php through a webserver then you might find it in one of the $_SERVER variables (create a phpinfo page). If you're not, then probably use parse_url: http://www.php.net/parse_url The second way is probably better and more reliable. -- 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] Class calling Class returning 'object'
Jason Gerfen wrote: I am in need of some assistance working with classes. I have a function (X) which calls a class (A), that class calls another class (B) and returns the results. At this point I think I am doing everything correctly within' class A because if I echo the results of Class A calling Class B the data is displayed. However, when I use 'return $data' from function X (ex. $data = $ClassA-function( $var1, $var2 ); ) the word 'object' is being displayed in the browser. Here is the code; any help, tips, pointers is appreciated. // function 'chooser' calls class 'myAuth' and returns $data function chooser( $level, $page, $user, $pass ) { if( $page == auth ) { require 'auth.inc.php'; $data = new myAuth; $data = $data-login( $_POST['user'], $_POST['pass'] ); snip Please rename your variables! You're creating an object called 'data' then assigning it to text - which gets even more confusing when you use the same idea in your other classes. $authclass = new myAuth; $login_check = $authclass-login() Way easier to read and follow - you'll find your bug easily enough by doing this. -- 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] move_uploaded_file and CPU wait state (IO)
My first mailing, if I'm in wrong group or such, let me know ;) You've come to the right place :) Here comes my question. I have implemented file uploads to my server. At the end of upload, file is beeing moved from /tmp to permanent directory. However, whenever this happens, CPU goes berzerk and waits for disk to finish moving file. As allowed files may be up to 100 MB per file, having more then 3 users makes complete server freeze. Meantime, server load reaches skyhigh 40+. After file is moved, server resumes normal operation, however while moving file server is completely not responding. Is /tmp on a different disk partition to the final directory ? That could explain it - it's like moving a file on your windows machine from c: to d: Can you move the 'upload_tmp_dir' to a new directory on the same partition as the final directory? See 'upload_tmp_dir' in your php.ini file. Don't change your move_uploaded_file call to use rename() and unlink() - you'll run into problems and it bypasses the checks built into move_uploaded_file. -- 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] Sessions in PHP... where to start???
Hi everybody! I have a problem and I was told to check out the sessions part in PHP. What I want to deal with is the following : I have a PHP page with a form, where the user writes some data. These data are then written into a file which is then used in a system command as input for an external program (NOTE: The data MUST be written into a file, it cannot be done elsewhise, because the external program takes a file as input). The thing is that I must somehow create a file everytime a user enters data into the form, so I must learn something on sessions I think. My question is, since I don't have a login system or something like that, but just want to create a different file each time (with the session_id being part of it, so that the file is unique), which session commands do I need? If it were me I'd use tempnam() to create a unique file for that particular user and then use sessions to store the name of that file in the user's cookies... http://us2.php.net/tempnam http://us2.php.net/manual/en/ref.session.php -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Parsing PHP variables in XML document
I comed up with this ?php $file = xmltest2.xml; $stack = array(); $foo3 = wddw; // start_element_handler ( resource parser, string name, array attribs ) function startElement($parser, $name, $attribs) { global $stack; $tag=array(name=$name,attrs=$attrs); array_push($stack,$tag); } // end_element_handler ( resource parser, string name ) function endElement($parser, $name) { global $stack; $stack[count($stack)-2]['children'][] = $stack[count($stack)-1]; array_pop($stack); } // handler ( resource parser, string data ) function characterData($parser, $data) { global $stack,$i; eval(\$data = \$data\;); if(trim($data)) { $stack[count($stack)-1]['data']=$data; } } // handler ( resource parser, string target, string data ) function PIHandler($parser, $target, $data) { if ((strtolower($target)) == php) { global $parser_file; eval($data); } } function defaultHandler($parser, $data) { } function externalEntityRefHandler($parser, $openEntityNames, $base, $systemId, $publicId) { if ($systemId) { if (!list($parser, $fp) = new_xml_parser($systemId)) { printf(Could not open entity %s at %s\n, $openEntityNames, $systemId); return false; } while ($data = fread($fp, 4096)) { if (!xml_parse($parser, $data, feof($fp))) { printf(XML error: %s at line %d while parsing entity %s \n, xml_error_string(xml_get_error_code($parser)), xml_get_current_line_number($parser), $openEntityNames); xml_parser_free($parser); return false; } } xml_parser_free($parser); return true; } return false; } function new_xml_parser($file) { global $parser_file; $xml_parser = xml_parser_create(); xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 0); xml_set_processing_instruction_handler($xml_parser, PIHandler); xml_set_element_handler($xml_parser, startElement, endElement); xml_set_character_data_handler($xml_parser, characterData); xml_set_default_handler($xml_parser, defaultHandler); xml_set_external_entity_ref_handler($xml_parser, externalEntityRefHandler); if (!($fp = @fopen($file, r))) { return false; } if (!is_array($parser_file)) { settype($parser_file, array); } $parser_file[$xml_parser] = $file; return array($xml_parser, $fp); } if (!(list($xml_parser, $fp) = new_xml_parser($file))) { die(could not open XML input); } //ERROR while ($data = fread($fp, 4096)) { if (!xml_parse($xml_parser, $data, feof($fp))) { die(sprintf(XML error: %s at line %d\n, xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); } } //END xml_parser_free($xml_parser); print(pre\n); print_r($stack); print(/pre\n); ? it evaluates php code. But when I use eval(\$data = \$data\;); the strings in the $data e.g. ('sth $foo other $foo1')do not appear. I think the problem is that it thinks they are undefined. Here is the xml file ?xml version=1.0? !DOCTYPE foo [ !ENTITY testEnt test entity ] document foo ?php $foo3='555'; echo Some text; ? /foo foo hi /foo foofoo $foo3 foo /foo /document -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strange slowdowns in PHP
On Mon, Feb 27, 2006 at 05:16:01PM -0500, William Lovaton wrote: Mmmm... can you elaborate on that please? I kind of have the idea of what you mean but I don't know how to do it. What is exactly garbage collection in the context of a PHP session? I guess it is when PHP scans every session file to see if there are stale data or something like that and you can tune the probability of this process being triggered in the php.ini file. Yeah, i believe that is the GC he is talking about. By default, php will do GC 1% of the requests, the actual rate of GC an how much work it needs to do is predicted by: session.gc_divisor session.gc_probability session.gc_maxlifetime see: http://php.net/manual/en/ini.php How would you measure that? is there a way to do that? If you are trying to benchmark the script and log excessive time for a script to execute, i would probably suggest to use the auto_prepend and auto_append directives to include scripts that set begin and end times and log things, vs setting the start time in apache and waiting for php to actually finishing its shutdown process. Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions in PHP... where to start???
Well for the latter part of your question.. 'Where to start??' the first thing to start with is to NOT reply to a topic and change your subject to ask something else, instead click the icon in your email application that indicates a new message and compose your question addressed to php-general@lists.php.net Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Expiring other resources with HTTP headers
El lun, 27-02-2006 a las 12:35 -0500, tedd escribió: ps: your email address has generated a couple of bounced blog stuff thus far. Yeah, I seen that a couple of time now. What is going on? I have not anything to do with blogger.com, I don't know what is happening. What can I do to solve this? I don't want to annoy everyone in the mailing list. -William I don't know -- but if I try to send anything to: mailto:[EMAIL PROTECTED] I receive an error message stating something about failing to blog. tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] move_uploaded_file and CPU wait state (IO)
On Mon, Feb 27, 2006 at 06:39:13PM +0100, [EMAIL PROTECTED] wrote: Hi, My first mailing, if I'm in wrong group or such, let me know ;) Here comes my question. I have implemented file uploads to my server. At the end of upload, file is beeing moved from /tmp to permanent directory. However, whenever this happens, CPU goes berzerk and waits for disk to finish moving file. As allowed files may be up to 100 MB per file, having more then 3 users makes complete server freeze. Meantime, server load reaches skyhigh 40+. After file is moved, server resumes normal operation, however while moving file server is completely not responding. I'm just taking a wild guess at this moment, but usually is a sign when disk access is an issue and tends to be because it is rather full excpecially with larger files. Some questions that i that I would first look at: - how much space is on /tmp or the drive you are moving it to - is /tmp on the same drive as where ever you are moving it to. - if it is the same drive, the move should be quick - test a move directly on the filesystyem and see how long it takes Just in case you arn't familiar with disk usage do a: du -h and observe the output. Is there a work around? I am not so good with linux (yet ^^), so I do not know if there is place for improvement on OS itself. I asked this question on Debian forum, but am trying here as well. If someone has same problem and prefferably solution, or even sugestions - all is welcome! :) Although of what I mentioned really shouldn't explain your 40+ load unless you are under requests and you are very close to 100% on one of those disk partitions from 'du'. 2 x 80 GB IDE HDD Since you have 2 disks i would suggest putting all your logging information on one disk or the other and reserver the other disk for accessing pages or uploads. But then again it really doesn't explain the 40+ server load, you may have other issues at hand. Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] recompiling php
Chris wrote: Jochem Maas wrote: blackwater dev wrote: I am trying to recompile php 5 with freetds so am using this : which specific version? try another [pristine] src tarball. ./configure '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-mysql=/root/mysql-standard-4.1.9-pc-linux-gnu-i686' '--with-mssql=/usr/local/freetds' you found freetds there I take it? (I saw your previous related post) Things seem ok so I do make and at the end of make I get this error: /usr/bin/ld:ext/mssql/php_mssql.lo: file format not recognized; treating as linker script /usr/bin/ld:ext/mssql/php_mssql.lo:2: syntax error collect2: ld returned 1 exit status make: *** [libphp5.la] Error 1 I then did make install and of course got the same error: /usr/bin/ld:ext/mssql/php_mssql.lo: file format not recognized; treating as linker script /usr/bin/ld:ext/mssql/php_mssql.lo:2: syntax error collect2: ld returned 1 exit status make: *** [libphp5.la] Error 1 I then do make clean. Of course, it doesn't seem to regenerate the libphp5.so so once I restart apache, and check out phpinfo, it shows the old 'make clean' doesn't install anything. it's the 'make install' that would install the .so if the error didn't occur. no? 'make clean' undoes all of the compiling, so you have to do at least 'make' again (maybe configure too, can't remember off hand). snip make clean removes the compiled binaries from the source tree. It won't effect anything installed with 'make install' (ie in it's system locations). You don't *have* to reconfigure after a make clean, but it won't hurt (not to mention that you might want to remove config.cache if it exists). So, to the OP, 'make clean' will not touch your previous install of php. Since your 'make' failed, it didn't finish compiling the binaries and you wouldn't be able to do a 'make install' As to why your make is failing, I don't know. ;) -- By-Tor.com ...it's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] recompiling php
On Sun, Feb 26, 2006 at 04:23:22PM -0500, blackwater dev wrote: I am trying to recompile php 5 with freetds so am using this : ./configure '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-mysql=/root/mysql-standard-4.1.9-pc-linux-gnu-i686' '--with-mssql=/usr/local/freetds' Things seem ok so I do make and at the end of make I get this error: /usr/bin/ld:ext/mssql/php_mssql.lo: file format not recognized; treating as linker script /usr/bin/ld:ext/mssql/php_mssql.lo:2: syntax error collect2: ld returned 1 exit status make: *** [libphp5.la] Error 1 Since collect2 is closely related to gcc i would assume that there is a binary issue, the first thing I would check is what version of gcc (CC) you are using. I then did make install and of course got the same error: /usr/bin/ld:ext/mssql/php_mssql.lo: file format not recognized; treating as linker script /usr/bin/ld:ext/mssql/php_mssql.lo:2: syntax error collect2: ld returned 1 exit status make: *** [libphp5.la] Error 1 This will be expected since a proper 'make' needs to happen till the 'make install' occurs' Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] move_uploaded_file and CPU wait state (IO) - unsubscribe
On Tue, Feb 28, 2006 at 09:43:30AM +0800, stone.wang wrote: unsubscribe unsubscribe unsubscribe unsubscribe unsubscribe unsubscribe unsubscribe unsubscribe unsubscribe unsubscribe unsubscribe unsubscribe unsubscribe unsubscribe dont send to me Since you hijacked my thread, to spam this nonsense? i will be sure to send to you now. Look at the bottom of this message to learn how to unsubscribe. Or view your headers to see how to unsubscribe or perhaps visit: http://php.net/unsub.php And in the future, if you aren't sure how to unsubscribe to a mailing list: 1) dont subscribe to it 2) dont be stupid and send 15 lines of unsubscribe I've officially recorded this nonsense for future reference. Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] move_uploaded_file and CPU wait state (IO) - unsubscribe
On Tue, Feb 28, 2006 at 11:08:30AM +0800, stone.wang wrote: No usa to it http://php.net/unsub.php Yes fondu no be http://php.net/unsub.php i do more If english isn't your first language try to explain that you are not clear how to remove yourself from the list, otherwise try emailing: [EMAIL PROTECTED] to remove yourself. Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: URL output query
Hi Chris, if the only thing you want is to get the domain (having the whole URL) you have more than one way to solve it. Chris -it's a little akward that Chris answered to Chris- already told you about parse_url(), and since we're talking about strings, I would suggest something like $domain = preg_replace('{^([a-z]+://[^/]+).*$}X', '%1', $uri); Chris wrote: Greetings PHP folks, Which PHP function do I use if I want to achieve the following : http://www.somesite.com/gallery/pics.php is the url...how do I get it to read only http://www.somesite.com in the browser address bar without the rest of the directory and filename appearing ? -- Atentamente, J. Rafael Salazar Magaña Innox - Innovación Inteligente Tel: +52 (33) 3615 5348 ext. 205 / 01 800 2-SOFTWARE [EMAIL PROTECTED] http://www.innox.com.mx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Optional pass-by-reference parameters?
If some_func( $var = NULL ) didn't work, then you're most likely using PHP 4. If that's the case then you could try passing an argument by reference in call(real/execution)-time, e.g: function some_func( $optional = NULL ) { ··· } some_func(); some_func($my_var); Note: beware that the directive allow_call_time_pass_reference _must_ be On in your php.ini This functionality is deprecated, since PHP 5 does allow optional arguments-by-reference. TomS wrote: I would like to have an optional pass-by-reference. i.e. you can call the function w/o the variable. Basically, like how you don't need to pass $matches to the preg_match function. I've tried, function some_func($var = null) and this doesn't work. func_get_args only gets copies, does anyone have any other solutions? -- Atentamente, J. Rafael Salazar Magaña Innox - Innovación Inteligente Tel: +52 (33) 3615 5348 ext. 205 / 01 800 2-SOFTWARE http://www.innox.com.mx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: URL output query
Rafael wrote: Hi Chris, if the only thing you want is to get the domain (having the whole URL) you have more than one way to solve it. Chris -it's a little akward that Chris answered to Chris- already told you about parse_url(), and since we're talking about strings, I would suggest something like $domain = preg_replace('{^([a-z]+://[^/]+).*$}X', '%1', $uri); Chris wrote: Greetings PHP folks, Which PHP function do I use if I want to achieve the following : http://www.somesite.com/gallery/pics.php is the url...how do I get it to read only http://www.somesite.com in the browser address bar without the rest of the directory and filename appearing ? We are two different people !? Not sure how that's difficult. I don't know why you'd use a regular expression when you can use a function instead (easier to maintain, it'll be faster, you won't make a mistake)... But of course there is always more than one way to solve a problem. -- 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] Where to put my class files
Best group member, I want to run the backend of the system under HTTPS for security reasons. The pages in HTTP and HTTPS are both using the same classfiles. Right now I have the class files in httpdocs/classes/ In the httpsdocs/admin I have a variable $class_path='http://www.mydomain.com/classes/'; to describe where the class files can be found. I do this that does not generate an error: require_once($class_path.'orderadmin.class.php'); When I then do below it gives be an error. echo OrderAdmin::getNewOrderList(); Fatal error: Undefined class name 'orderadmin' in /home/httpd/vhosts/mydomain.com/httpsdocs/admin/order.php on line 46 When running on the localhost and with the admin in a subfolder in HTTP it is no problems. Where should I locate my class files so that they are visible for both HTTP and HTTPS? And how should I set my $class_path? I do not think my $class_path is good enoght, because then I would not have that problem. I have tried: $class_path='../../http/classes/'; But it does not work. Help me; I will kill myself soon... :) Best regards, Peter Lauri -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Where to put my class files
Peter Lauri wrote: Best group member, I want to run the backend of the system under HTTPS for security reasons. The pages in HTTP and HTTPS are both using the same classfiles. Right now I have the class files in httpdocs/classes/ In the httpsdocs/admin I have a variable $class_path='http://www.mydomain.com/classes/'; to describe where the class files can be found. I do this that does not generate an error: require_once($class_path.'orderadmin.class.php'); Including them this way will have already processed the php. It's like viewing the file using a browser. When I then do below it gives be an error. echo OrderAdmin::getNewOrderList(); Fatal error: Undefined class name 'orderadmin' in /home/httpd/vhosts/mydomain.com/httpsdocs/admin/order.php on line 46 When running on the localhost and with the admin in a subfolder in HTTP it is no problems. Where should I locate my class files so that they are visible for both HTTP and HTTPS? And how should I set my $class_path? I do not think my $class_path is good enoght, because then I would not have that problem. I have tried: $class_path='../../http/classes/'; You need to do something like: // this gives you /home/httpd/vhosts/mydomain.com/httpsdocs/admin $my_path = dirname(__FILE__); // go back to the other folder. $class_path = $my_path . '/../../httpdocs/classes/'; -- 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] Where to put my class files
I tried this, but now I get this error. Warning: main(): open_basedir restriction in effect. File(/home/httpd/vhosts/mydomain.com/httpsdocs/admin/../../httpdocs/classes/ orderadmin.class.php) is not within the allowed path(s): (/home/httpd/vhosts/mydomain.com/httpsdocs:/tmp) in /home/httpd/vhosts/ mydomain.com/httpsdocs/admin/index.php on line 4 Warning: main(/home/httpd/vhosts/mydomain.com/httpsdocs/admin/../../httpdocs/classes/ orderadmin.class.php): failed to open stream: Operation not permitted in /home/httpd/vhosts/mydomain.com/httpsdocs/admin/index.php on line 4 Fatal error: main(): Failed opening required '/home/httpd/vhosts/mydomain.com/httpsdocs/admin/../../httpdocs/classes/orde radmin.class.php' (include_path='.:/usr/share/pear') in /home/httpd/vhosts/mydomain.com/httpsdocs/admin/index.php on line 4 mydomain.com is just something I replaced the real domain name with. What I am doing wrong? /Peter -Original Message- From: Chris [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 28, 2006 1:45 PM To: Peter Lauri Cc: php-general@lists.php.net Subject: Re: [PHP] Where to put my class files Peter Lauri wrote: Best group member, I want to run the backend of the system under HTTPS for security reasons. The pages in HTTP and HTTPS are both using the same classfiles. Right now I have the class files in httpdocs/classes/ In the httpsdocs/admin I have a variable $class_path='http://www.mydomain.com/classes/'; to describe where the class files can be found. I do this that does not generate an error: require_once($class_path.'orderadmin.class.php'); Including them this way will have already processed the php. It's like viewing the file using a browser. When I then do below it gives be an error. echo OrderAdmin::getNewOrderList(); Fatal error: Undefined class name 'orderadmin' in /home/httpd/vhosts/mydomain.com/httpsdocs/admin/order.php on line 46 When running on the localhost and with the admin in a subfolder in HTTP it is no problems. Where should I locate my class files so that they are visible for both HTTP and HTTPS? And how should I set my $class_path? I do not think my $class_path is good enoght, because then I would not have that problem. I have tried: $class_path='../../http/classes/'; You need to do something like: // this gives you /home/httpd/vhosts/mydomain.com/httpsdocs/admin $my_path = dirname(__FILE__); // go back to the other folder. $class_path = $my_path . '/../../httpdocs/classes/'; -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Where to put my class files
Peter Lauri wrote: I tried this, but now I get this error. Warning: main(): open_basedir restriction in effect. File(/home/httpd/vhosts/mydomain.com/httpsdocs/admin/../../httpdocs/classes/ orderadmin.class.php) is not within the allowed path(s): (/home/httpd/vhosts/mydomain.com/httpsdocs:/tmp) in /home/httpd/vhosts/ mydomain.com/httpsdocs/admin/index.php on line 4 Warning: main(/home/httpd/vhosts/mydomain.com/httpsdocs/admin/../../httpdocs/classes/ orderadmin.class.php): failed to open stream: Operation not permitted in /home/httpd/vhosts/mydomain.com/httpsdocs/admin/index.php on line 4 Fatal error: main(): Failed opening required '/home/httpd/vhosts/mydomain.com/httpsdocs/admin/../../httpdocs/classes/orde radmin.class.php' (include_path='.:/usr/share/pear') in /home/httpd/vhosts/mydomain.com/httpsdocs/admin/index.php on line 4 mydomain.com is just something I replaced the real domain name with. What I am doing wrong? /Peter You're not doing anything wrong. Your host locks you into the '/home/httpd/vhosts/mydomain.com/httpsdocs/' folder so you can't include any scripts outside that directory. The only thing you can do is ask them to adjust the open_basedir restrictions and allow you to include in the '/home/httpd/vhosts/mydomain.com/httpdocs/' directory as well. They should be able to do this just by adding something to your apache config. (Search www.php.net for what open_basedir does). -Original Message- From: Chris [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 28, 2006 1:45 PM To: Peter Lauri Cc: php-general@lists.php.net Subject: Re: [PHP] Where to put my class files Peter Lauri wrote: Best group member, I want to run the backend of the system under HTTPS for security reasons. The pages in HTTP and HTTPS are both using the same classfiles. Right now I have the class files in httpdocs/classes/ In the httpsdocs/admin I have a variable $class_path='http://www.mydomain.com/classes/'; to describe where the class files can be found. I do this that does not generate an error: require_once($class_path.'orderadmin.class.php'); Including them this way will have already processed the php. It's like viewing the file using a browser. When I then do below it gives be an error. echo OrderAdmin::getNewOrderList(); Fatal error: Undefined class name 'orderadmin' in /home/httpd/vhosts/mydomain.com/httpsdocs/admin/order.php on line 46 When running on the localhost and with the admin in a subfolder in HTTP it is no problems. Where should I locate my class files so that they are visible for both HTTP and HTTPS? And how should I set my $class_path? I do not think my $class_path is good enoght, because then I would not have that problem. I have tried: $class_path='../../http/classes/'; You need to do something like: // this gives you /home/httpd/vhosts/mydomain.com/httpsdocs/admin $my_path = dirname(__FILE__); // go back to the other folder. $class_path = $my_path . '/../../httpdocs/classes/'; -- 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] Where to put my class files
Peter Lauri wrote: I tried this, but now I get this error. Warning: main(): open_basedir restriction in effect. File(/home/httpd/vhosts/mydomain.com/httpsdocs/admin/../../httpdocs/classes/ orderadmin.class.php) is not within the allowed path(s): (/home/httpd/vhosts/mydomain.com/httpsdocs:/tmp) in /home/httpd/vhosts/ mydomain.com/httpsdocs/admin/index.php on line 4 Warning: main(/home/httpd/vhosts/mydomain.com/httpsdocs/admin/../../httpdocs/classes/ orderadmin.class.php): failed to open stream: Operation not permitted in /home/httpd/vhosts/mydomain.com/httpsdocs/admin/index.php on line 4 Fatal error: main(): Failed opening required '/home/httpd/vhosts/mydomain.com/httpsdocs/admin/../../httpdocs/classes/orde radmin.class.php' (include_path='.:/usr/share/pear') in /home/httpd/vhosts/mydomain.com/httpsdocs/admin/index.php on line 4 mydomain.com is just something I replaced the real domain name with. What I am doing wrong? nothing as such - looks like you might be on a Plesk webhosting platform. you have a number of options: 1. ask the sys admin to relax the openbasedir restriction for your domains so that you can reach your httpdocs dir from your httpsdocs. 2. copy the class files into a httpsdocs [sub]dir 3. er? /Peter -Original Message- From: Chris [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 28, 2006 1:45 PM To: Peter Lauri Cc: php-general@lists.php.net Subject: Re: [PHP] Where to put my class files Peter Lauri wrote: Best group member, I want to run the backend of the system under HTTPS for security reasons. The pages in HTTP and HTTPS are both using the same classfiles. Right now I have the class files in httpdocs/classes/ In the httpsdocs/admin I have a variable $class_path='http://www.mydomain.com/classes/'; to describe where the class files can be found. I do this that does not generate an error: require_once($class_path.'orderadmin.class.php'); Including them this way will have already processed the php. It's like viewing the file using a browser. When I then do below it gives be an error. echo OrderAdmin::getNewOrderList(); Fatal error: Undefined class name 'orderadmin' in /home/httpd/vhosts/mydomain.com/httpsdocs/admin/order.php on line 46 When running on the localhost and with the admin in a subfolder in HTTP it is no problems. Where should I locate my class files so that they are visible for both HTTP and HTTPS? And how should I set my $class_path? I do not think my $class_path is good enoght, because then I would not have that problem. I have tried: $class_path='../../http/classes/'; You need to do something like: // this gives you /home/httpd/vhosts/mydomain.com/httpsdocs/admin $my_path = dirname(__FILE__); // go back to the other folder. $class_path = $my_path . '/../../httpdocs/classes/'; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] html area
I am looking for a simple html area text area type editor, similar to to what you find in the phpbbs and Joomla. I don't need a lot of features it is just to edit small snipits of html and I really want it to be very simple to implement. I have been looking for the past few hours and so far everything seems way more complex than what I need and a pain to set up. Any recommendations would be appreciated -- Chris W KE5GIX Gift Giving Made Easy Get the gifts you want give the gifts they want One stop wish list for any gift, from anywhere, for any occasion! http://thewishzone.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php