[PHP] Help please!!
Having a very frustrating problem and I can't seem to figure out why it's happening. 1. As of last week, all of our applications have started to work intermittingly. The codebase has not changed. 2. Sometimes the application will display, sometimes it won't. The browsers loading progress bar will move for about 25% then just stop. No timeout or 401 errors occur. 3. There are no errors message in any of the logs files. To test if it's our application we have done the following in our main php file which runs the rest of the application ?php echo Step 0 br; --Segment of our code is here-- echo Step 1 br; --Segment of our code is here-- echo Step 2 br; ? Sometimes it doesn't even get to the first line of php code which is the first echo statement, sometimes it gets to step 0 and step 1 and sometimes it gets to all steps. The code between each of these steps is nothing major, nothing calls mysql or anything like that. It's mainly just variable initialization. Again, the entire application runs fine every couple of refreshes. Then sometimes it'll just stop completely. I have turned on all sorts of debugging and nothing. I have reinstalled apache, mysql, and php 2 times. We have also optimize both apache and mysql for for than enough client connections as well are using persistant db connections. But like I said, the application works sometimes, sometimes it doesn't. And the data is pretty static. I am running RHEL 3 U3 with RH php version php-4.3.2-19.ent, RH mysql server version mysql-server-3.23.58-2.3, and RH apache version httpd-2.0.46-44.ent Thanks guys for any help troubleshooting this. -Brent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php editor
On Thu, 13 Jan 2005 22:11:05 +, Justin [EMAIL PROTECTED] wrote: Is there a Debugger for PHP? php -l filename.php for basic syntax check. If you need more than that you can turn of full error reporting and view the errors directly on the screen: error_reporting( E_ALL ); ini_set( 'display_errors', 1 ); But later when you go to a production environment I'd go with: error_reporting( E_ERROR | E_WARNING | E_PARSE ); ini_set( 'display_errors', 0 ); ini_set( 'log_errors', 1 ); -- Greg Donald Zend Certified Engineer http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: 404 custom handler on a cgi-wrap PHP - No input specified error
* Luke Barker [EMAIL PROTECTED]: This maybe a PHP problem, but is associated with Apache too - so my apologies if it is slightly off topic. My web hosts use a CGI wrap version of PHP 4.3.10 I have made a 404 custom error handler, using .htaccess in a directory - it is usppoed to route all unfound pages to error.php, and works as expected for .htm and .html pages as well as gifs etc. But ofr .php scripts, e.g /path/to/wrongurl.php it doesnt show my page - instead it shows No Input file specified.. After some Googling I have only found people witht eh similar problem without solutions. Can any one help me on this? I should say that in IE it just gets the default 404 ( I think this is windows own one responding to the particular http response header) - in firefox you get the 'No input ' error Can you post the error.php page here, or a link to somewhere where we can view the source? -- Matthew Weier O'Phinney | mailto:[EMAIL PROTECTED] Webmaster and IT Specialist | http://www.garden.org National Gardening Association| http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sendmail crash
Hi Is the above the ACTUAL email you are sending? Haha. That would be a funny email. No, this is just sample text. The actual email is 8KB and contains no images/attachments. (I just tried googling the problem but the only thing that seemed related that I came up with were Michiel posts :-S ) Yeah I tried that too... I feel so alone.. Anyway, some new information: I found a workaround. I am using the Smarty template engine. When I delete all smarty variables from the template I do get a page, instead of the 404. So, it must mean that Smarty trips over something that either sendmail or the PEAR code does. When I take out the sendmail line everything also works fine, so it's a combination of things. The only remaining problem is this pain in the back of my head in the 'Mental Frustration' lobe. Any new insights are welcome. I'll post the problem to the Smarty list. Michiel -- * Michiel van der Blonk CaribMedia Marketing Consultancy N.V. Oranjestad, Aruba Tel: (297) 583-4144 Fax: (297) 582-6102 http://www.caribmedia.com Website Design, Web Application Development, Web Hosting, Internet Marketing Operators of: Visit Aruba - http://www.VisitAruba.com Aruba Links - http://www.ArubaLinks.com Aruba Business Directory - http://www.visitaruba.com/business/ Aruba Real Estate Locator - http://www.arubarealestate.com Aruba Bulletin Board - http://bb.visitaruba.com/ Aruba Trip Reports - http://tripreports.visitaruba.com Aruba Chat - http://chat.visitaruba.com The VisitAruba Plus SAVINGS CARD - http://www.visitaruba.com/plus/ Contents of this communication are confidential and legally privileged. This document is intended solely for use of the individual(s) or entity/entities to whom it is addr Jochem Maas [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Richard Lynch wrote: Michiel van der Blonk wrote: ... Is the above the ACTUAL email you are sending? Or merely a demonstrative sample? Cuz, like, if the email you are REALLY sending is *HUGE* then I'd not be surprised by the messages above... Richard, what do you consider huge. I mean people (read: some of my idiot co-worker) happily send 10Meg attachments via sendmail all day long (okay so its not via PHP, but I sometimes use the phpMailer script to send emails using PHP/sendmail and I have successfully done so with 10+ Megs of files attached). is it possible he is hitting a PHP memory limit? (I just tried googling the problem but the only thing that seemed related that I came up with were Michiel posts :-S ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] 404 custom handler on a cgi-wrap PHP - No input specified error
Hi, This maybe a PHP problem, but is associated with Apache too - so my apologies if it is slightly off topic. My web hosts use a CGI wrap version of PHP 4.3.10 I have made a 404 custom error handler, using .htaccess in a directory - it is usppoed to route all unfound pages to error.php, and works as expected for .htm and .html pages as well as gifs etc. But ofr .php scripts, e.g /path/to/wrongurl.php it doesnt show my page - instead it shows No Input file specified.. After some Googling I have only found people witht eh similar problem without solutions. Can any one help me on this? I should say that in IE it just gets the default 404 ( I think this is windows own one responding to the particular http response header) - in firefox you get the 'No input ' error thanks for any advice Luke -- [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] calling php functions as library or cmd line
On Thu, 2005-01-13 at 09:46, Cere Davis wrote: Does anyone know how to write php libraries in a modular way so that you can both test the libraries/functions on the command line with arguments and/or use the php library as a part of your web code with 'require_once()' syntax? Sort of like how Python or Ruby works? Yes. Cheers, Rob. -- .. | 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] Help please!!
[snip] Thanks guys for any help troubleshooting this. [/snip] Is the drive full? Enough memory? An unusual number of connections? Any other applications added to the system? what do you see when you run top? Have you looked at a MySQL process list? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php editor
I used PHPedit 0.6, PHPDesigner 2005, PHPed and Zend on windows. and vi, eclipse and zend on linux. Here's what i prefer : if u'r looking for a free editor try eclipse/linux or PHPDesigner 2005/windows and if u can afford the licence try the Zend, am using it by now and it's magic ! plus it runs on windows/linux ! On Thu, 13 Jan 2005 18:29:30 -0500, GH [EMAIL PROTECTED] wrote: On linux I use thee KDE IDE program... On Thu, 13 Jan 2005 14:02:17 -0600, Greg Donald [EMAIL PROTECTED] wrote: On Thu, 13 Jan 2005 18:02:12 +0200, William Stokes [EMAIL PROTECTED] wrote: I'm quite new with writing php code. I was considering of using some kind of php editor program to help with the syntax. Know any goog ones? vim.org editplus.com Both support PHP syntax highlighting. -- Greg Donald Zend Certified Engineer http://destiney.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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php editor
http://www.maguma.com/ zerof -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php editor
http://www.maguma.com/ zerof -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php5 threadsafe / apache2 mpm=worker
Hello, Just wondering if anyone is using the apache worker module with php? I've complied php5 with zend threadsafe support, and apache2 with the MPM worker module on a Linux box. Everything seems sweet. mysqli_thread_safe() reports true... anyone know if this configuration may include modules that aren't threadsafe? with-apxs2=/usr/local/apache2/bin/apxs with-gd enable-gd-native-ttf with-pspell with-zlib with-freetype-dir with-curlwrappers with-mime-magic with-curl enable-shmop with-jpeg-dir with-mcrypt=/usr/lib with-mysqli enable-magic-quotes with-enable-sockets enable-roxen-zts Thanks, -J -- Jason Morehouse Vendorama - Create your own online store http://www.vendorama.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Need help with array/foreach
Hi, Long time reader, first time poster. I've been using Dreamweaver to generate my PHP (I know - but I'm a designer... most of this makes absolutely zero sense to me), but I've run into something that I know could be done better. If you look here: http://pastebin.com/228804 you can see that I have several MySQL queries. Now I know that surely these can be concatenated into an array or something, but I have no idea how to do that - I've googled until I'm blue in the face, read tutorials about arrays and foreach loops but I just can't make sense of it. Any help anybody could give me would be greatly appreciated. Thanks, Collin Davis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php editor
1. Does anybody know an editor that supports Smarty tags natively or via some sort of custom extension/configuration? 2. Does anybody use Scite (for Un*x) or SciteFlash (for Windows)? I prefer it's clean and lightweight interface (once properly configured)... Regards, Bostjan On Thursday 13 January 2005 17:02, William Stokes wrote: Hello, I'm quite new with writing php code. I was considering of using some kind of php editor program to help with the syntax. Know any goog ones? Thanks -Will -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex help
On Thu, 13 Jan 2005 16:06:32 -0500, Jason Morehouse [EMAIL PROTECTED] wrote: Hello, I normally can take a bit of regex fun, but not this time. Simple enough, in theory... I need to match (count) all of the bold tags in a string, including ones with embedded styles (or whatever else can go in there). b and b style=color:red. My attempts keep matching br as well. Put in a \b to match a wordbreak after the 'b'. Something like this maybe: /b\b[^]*/i . -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Simple question: $_POST
When using $_POST vars is it required that a form is used ? In other words I can create an href link and echo variable and pick them up using $_GET in the following page. No so with $_POST ? Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Preventing execution without inclusion
Adam Hubscher wrote: From within the application, I use one page to include classes/variables and so on. Is there a way (I may have been missing it in the documentation for PHP, however I didnt see anything related) to prevent a user from directly accessing/executing *.php by the file making sure taht it was only included by index.php? there are any number of ways to do this I can think of three of hand: 1. use a suitably configured .htaccess to deny access to the dir where you 'include' files are. 2. place the include directory outside of the webroot. 3. add something like the following to all your include files: if (!defined('OK_TO_INCLUDE')) { die('go away nosey parker!'); } and make sure to define the constant before you include any of your 'include' files. e.g. define('OK_TO_INCLUDE', true); --- hope that gives you an idea. oh and turning off the server also works ;-) For example: config.php defines: function __autoload($class_name) { $class_name = strtolower($class_name); include_once('class.'.$class_name.'.php'); } as per PHP5 example 1 (the preferred way): user accesses http://www.example.org/index.php?function=Join, this loads the class NewUser and begins its implementation. Because of the __autoload, it includes class.join.php, in order to utilize the class. 2 (the wrong way): user accesses http://www.example.org/includes/class.join.php without going through index.php. I am trying to prevent 2 from even occuring, utilizing a piece of code that would check if index.php had included it, or not. This code would be in the beginning of all the class files, at the top, before any other code was to be executed. As of yet, it has eluded me... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] regex help
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -Original Message- From: Jason Morehouse Sent: 13/01/05 21:06 I normally can take a bit of regex fun, but not this time. Simple enough, in theory... I need to match (count) all of the bold tags in a string, including ones with embedded styles (or whatever else can go in there). b and b style=color:red. My attempts keep matching br as well. Just off the top of my head (and untested!), I'd try something like /b(\s+[^]*)?/ Cheers! Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql improved extensions affected_rows
Richard Lynch wrote: Tom wrote: I've just started playing with the php5 improved mysqli extensions. I have the following code:- ?php $mysqlim = new mysqli(localhost, myUser, myPassword,myDB); $updateQuery = UPDATE client SET status = 'INACTIVE' WHERE clientName = 'Tom'; if ($mysqli-query($updateQuery)) { $updateCount = $mysqli-affected_rows; echo brupdateCount = $updateCount; } else { excpetionHandler(updateFailed: .$updateQuery); } ? This returns updateCount = 1 However, when I check the underlying table, there are actually 4 rows updated (and yes, before anyone asks, I have repeated this several times, correctly resetting the data before each run) Is this a known bug, or am I doing something stupid? (php 5.0.2, apache 2.0.49) How many rows actually had 'Tom' for their clientName?... I mean, is the '1' wrong because it should be 4, or is it changing records it shouldn't? It correctly updates 4 rows, but returns 1 as the count. I think that this may actually be a mysql issue - I've put the same php/apache configs onto another similar box, the only difference being that the second box is mysql 5.0.1, whereas the problem is reported against 5.0.0 (both alpha's!). The correct value is returned from the second box. Thanks Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strange in MySQL Query.
adwin wijaya wrote: Hi... Adwin, (btw: php-db@lists.php.net would be a better place for this question) do you realise that GROUP is an SQL keyword (as in the GROUP BY clause) and as such you will need to escape it using backticks (in the case of MySQL). Also I have a sneaking suspicion that TYPE might be a reserved word too - you may want to put that in backticks too. I have an query for mysql that looks like: SELECT group as type FROM mytable WHERE id =101010 UNION SELECT individual as type FROM myothertable WHERE id=101010 The strange result if only one result displayed from myothertable, so the type will become indiv instead of individual. that sounds to me like the result is being grouped! But when I tried to switch the query become : SELECT individual as type FROM myothertable WHERE id=101010 UNION SELECT group as type FROM mytable WHERE id =101010 it could displaye the result correctly. I dont know why .. is this mysql bug ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Preventing execution without inclusion
- Original Message - From: Adam Hubscher [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Friday, January 14, 2005 1:25 AM Subject: [PHP] Preventing execution without inclusion From within the application, I use one page to include classes/variables and so on. Is there a way (I may have been missing it in the documentation for PHP, however I didnt see anything related) to prevent a user from directly accessing/executing *.php by the file making sure taht it was only included by index.php? For example: config.php defines: function __autoload($class_name) { $class_name = strtolower($class_name); include_once('class.'.$class_name.'.php'); } as per PHP5 example 1 (the preferred way): user accesses http://www.example.org/index.php?function=Join, this loads the class NewUser and begins its implementation. Because of the __autoload, it includes class.join.php, in order to utilize the class. 2 (the wrong way): user accesses http://www.example.org/includes/class.join.php without going through index.php. I am trying to prevent 2 from even occuring, utilizing a piece of code that would check if index.php had included it, or not. This code would be in the beginning of all the class files, at the top, before any other code was to be executed. A common way to do it: # in your index.php just before any inclusion define( '__INDEX__', true ); # in other files if( !defined( '__INDEX__' ) ) die( 'You cannot execute this script' ); Sorry if I didn't get u the right way, I'm too tired.. WBR Stan F As of yet, it has eluded me... -- 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] Preventing execution without inclusion
How about setting a variable before calling the include (eg $fromIndex=true)? In class.join.php you could include, for example, at the top of the file ?php if (!isset($fromIndex)) { die(ERROR MESSAGE); } ? Adam Hubscher wrote: From within the application, I use one page to include classes/variables and so on. Is there a way (I may have been missing it in the documentation for PHP, however I didnt see anything related) to prevent a user from directly accessing/executing *.php by the file making sure taht it was only included by index.php? For example: config.php defines: function __autoload($class_name) { $class_name = strtolower($class_name); include_once('class.'.$class_name.'.php'); } as per PHP5 example 1 (the preferred way): user accesses http://www.example.org/index.php?function=Join, this loads the class NewUser and begins its implementation. Because of the __autoload, it includes class.join.php, in order to utilize the class. 2 (the wrong way): user accesses http://www.example.org/includes/class.join.php without going through index.php. I am trying to prevent 2 from even occuring, utilizing a piece of code that would check if index.php had included it, or not. This code would be in the beginning of all the class files, at the top, before any other code was to be executed. As of yet, it has eluded me... -- -- David Green Information Centre, Central Science Laboratory Sand Hutton, York, YO41 1LZ Phone: +44 (0)1904 462388 (GTN: 5129 2388) Fax:+44 (0)1904 462111 E-Mail: [EMAIL PROTECTED] -- CSL email disclaimer: http://www.csl.gov.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: [suspicious - maybe spam] [PHP] [suspicious - maybe spam] strange in MySQL Query.
[snip] I have an query for mysql that looks like: SELECT group as type FROM mytable WHERE id =101010 UNION SELECT individual as type FROM myothertable WHERE id=101010 The strange result if only one result displayed from myothertable, so the type will become indiv instead of individual. But when I tried to switch the query become : SELECT individual as type FROM myothertable WHERE id=101010 UNION SELECT group as type FROM mytable WHERE id =101010 it could displaye the result correctly. I dont know why .. is this mysql bug ? [/snip] This should probably be asked on the MySQL list. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Data Enryption
Jochem Maas wrote: John Nichel wrote: Jochem Maas wrote: snip (no disrespect to Zend, but ZCE _sounds_ a lot like MSCE and everyone knows what thats worth ;-) - just a but of humour guys!) snip Oh yeah, I can hear all the Zend people laughing from here. good cos that means they have a better sense of humour that most Softies. my dig was at MCSE actually, which is just as unfounded as likening it to ZCE, and nobody seems to be complaining about me ripping into MCSE - double standards guys! I'm sorry I can't take this too seriously (IT that is) - half the people on the planet don't even have running water. and with regard to IT, the target is moving so fast that any form of certification is bound to go out of date faster than a can of milk in the sahara. Another thing about certification and exams - if you take them and pass it tells the world exactly one thing - your good at cramming info and passing exams. And as far as commercial certification goes my own, jaded, opinion is that these setups are there to make money not because of some altruistic desire to increase general competance. But just to be absolutely clear: Zend people, ZCEs, anyone else remotely offended; I was only joking, I didn't mean any offence and I apologize if I caused any. My view on Zend is that overall its a great company, the guys that run it and work there deserve the success they are getting and I commend them for the way they are integrating a commercial business with Open Source. How's the view from on top of your soap box? -- 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] regex help
Do you have the example regex so far? I'd suggest maybe b[^r] might just do what you want -Original Message- From: Jason Morehouse [mailto:[EMAIL PROTECTED] Sent: 13 January 2005 21:07 To: php-general@lists.php.net Subject: [PHP] regex help Hello, I normally can take a bit of regex fun, but not this time. Simple enough, in theory... I need to match (count) all of the bold tags in a string, including ones with embedded styles (or whatever else can go in there). b and b style=color:red. My attempts keep matching br as well. Thanks! -- Jason Morehouse Vendorama - Create your own online store http://www.vendorama.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This message has been checked for all known viruses by the CitC Virus Scanning Service powered by SkyLabs. For further information visit http://www.citc.it ___ This message has been checked for all known viruses by the CitC Virus Scanning Service powered by SkyLabs. For further information visit http://www.citc.it ___ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex help
On Friday 14 January 2005 05:06, Jason Morehouse wrote: Simple enough, in theory... I need to match (count) all of the bold tags in a string, including ones with embedded styles (or whatever else can go in there). b and b style=color:red. My attempts keep matching br as well. Quick-n-dirty: preg_match_all('/(b|b\s+.*)/iU', $doo, $match); Feel free to extend to check for closing tags :) -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- New Year Resolution: Ignore top posted posts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] writing binary data to file
hi, I must change some bytes in array filled from a msssql text field; now I do: function adjust ($ar_in) { $ar_in{0}='Ð'; $ar_in{1}='Ï'; $ar_in{3}='à'; $ar_in{4}='¡'; $ar_in{5}='±'; $ar_in{7}='á'; } I've copied/pasted values from an hex editor and this works ok. Question is: does exists a more elegant way to do this, using directly hex values in the script? I tried $ar_in{0}=0xFF for example, but when I write on file I got hex 32 (ascii '2'). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [suspicious - maybe spam] [PHP] [suspicious - maybe spam] strange in MySQL Query.
Why not ask a MySQL mailing list? [snip] .. is this mysql bug ? [/snip] -- -- David Green Information Centre, Central Science Laboratory Sand Hutton, York, YO41 1LZ Phone: +44 (0)1904 462388 (GTN: 5129 2388) Fax:+44 (0)1904 462111 E-Mail: [EMAIL PROTECTED] -- CSL email disclaimer: http://www.csl.gov.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sending attachment by email - can't find a bug?
I have a form and once the form is submitted, php code build csv file with entered information and store it on server in temp file. Then send this file as an attachment to me. Code to send an attachment is included in main code. The code to store csv file works fine. I'm getting the attachment in email but can't open the file: Alert: Unable to read the file. Then I tried to create txt file and got the same result. Actually, I was able to open attached file but the file was empty?!? Then accidentally, I changed the code back to create csv file but didn't change in code to send an attachment. after submitting the csv file was created but got by email earlier created txt file - and it works fine. I was able to open it?!? My conclusion: I can't send just created file, but later, as a second process - it works just fine. And that means, code to send an attachment works as well. Any ideas? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [suspicious - maybe spam] [PHP] [suspicious - maybe spam] strange in MySQL Query.
adwin wijaya wrote: Hi... I have an query for mysql that looks like: SELECT group as type FROM mytable WHERE id =101010 UNION SELECT individual as type FROM myothertable WHERE id=101010 The strange result if only one result displayed from myothertable, so the type will become indiv instead of individual. But when I tried to switch the query become : SELECT individual as type FROM myothertable WHERE id=101010 UNION SELECT group as type FROM mytable WHERE id =101010 it could displaye the result correctly. I dont know why .. is this mysql bug ? http://dev.mysql.com/doc/mysql/en/UNION.html The types and lengths of the columns in the result set of a UNION take into account the values retrieved by all the SELECT statements. Before MySQL 4.1.1, a limitation of UNION is that only the values from the first SELECT are used to determine result column types and lengths. This could result in value truncation if, for example, the first SELECT retrieves shorter values than the second SELECT: mysql SELECT REPEAT('a',1) UNION SELECT REPEAT('b',10); +---+ | REPEAT('a',1) | +---+ | a | | b | +---+ That limitation has been removed as of MySQL 4.1.1: mysql SELECT REPEAT('a',1) UNION SELECT REPEAT('b',10); +---+ | REPEAT('a',1) | +---+ | a | | bb| +---+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php editor
On Thu, 13 Jan 2005 16:37:24 -0800 (PST), welly limston [EMAIL PROTECTED] wrote: i'm usually use Dreamweaver to edit php code and debug in it it's very help ones us why don't u try Why don't you mail me $399 and I will. :) -- Greg Donald Zend Certified Engineer http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Preventing execution without inclusion
Adam Hubscher wrote: From within the application, I use one page to include classes/variables and so on. Is there a way (I may have been missing it in the documentation for PHP, however I didnt see anything related) to prevent a user from directly accessing/executing *.php by the file making sure taht it was only included by index.php? For example: config.php defines: function __autoload($class_name) { $class_name = strtolower($class_name); include_once('class.'.$class_name.'.php'); } as per PHP5 example 1 (the preferred way): user accesses http://www.example.org/index.php?function=Join, this loads the class NewUser and begins its implementation. Because of the __autoload, it includes class.join.php, in order to utilize the class. 2 (the wrong way): user accesses http://www.example.org/includes/class.join.php without going through index.php. I am trying to prevent 2 from even occuring, utilizing a piece of code that would check if index.php had included it, or not. This code would be in the beginning of all the class files, at the top, before any other code was to be executed. As of yet, it has eluded me... If includes/class.join.php only defines the class (as it should) direct access is completely harmless. Anyway, you can: 1. put includes/ directory outside of the web root 2. use .htaccess to forbid access to all files in includes/ directory 3. use this code at the beginning of every direct access forbidden file: if(basename($_SERVER['REQUEST_URI']) == __FILE__) { die('Direct access forbidden!'); } (does not work if you give included files the same name as the main files) 4. You can test for a defined constant. Let's say all main files include includes/config.php that defines constant DB_HOSTNAME, then you can: if(!defined('DB_HOSTNAME')) { die('Direct access forbidden!'); } HTH -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Preventing execution without inclusion
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -Original Message- From: Adam Hubscher Sent: 13/01/05 22:25 From within the application, I use one page to include classes/variables and so on. Is there a way (I may have been missing it in the documentation for PHP, however I didnt see anything related) to prevent a user from directly accessing/executing *.php by the file making sure taht it was only included by index.php? All include files should be placed in a separate directory which is outside the Web server's document root. This makes them completely inaccessible from the client browser, but they are still available to scripts running on the server. Cheers! Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql improved extensions affected_rows
Tom wrote: Richard Lynch wrote: Tom wrote: I've just started playing with the php5 improved mysqli extensions. I have the following code:- ?php $mysqlim = new mysqli(localhost, myUser, myPassword,myDB); $updateQuery = UPDATE client SET status = 'INACTIVE' WHERE clientName = 'Tom'; if ($mysqli-query($updateQuery)) { $updateCount = $mysqli-affected_rows; echo brupdateCount = $updateCount; } else { excpetionHandler(updateFailed: .$updateQuery); } ? This returns updateCount = 1 However, when I check the underlying table, there are actually 4 rows updated (and yes, before anyone asks, I have repeated this several times, correctly resetting the data before each run) Is this a known bug, or am I doing something stupid? (php 5.0.2, apache 2.0.49) How many rows actually had 'Tom' for their clientName?... I mean, is the '1' wrong because it should be 4, or is it changing records it shouldn't? It correctly updates 4 rows, but returns 1 as the count. I think that this may actually be a mysql issue - I've put the same php/apache configs onto another similar box, the only difference being that the second box is mysql 5.0.1, whereas the problem is reported against 5.0.0 (both alpha's!). The correct value is returned from the second box. Were the other three all ACTIVE before the update on both boxes? Cuz http://php.net/mysql_affected_rows sez: Note: When using UPDATE, MySQL will not update columns where the new value is the same as the old value. This creates the possibility that mysql_affected_rows() may not actually equal the number of rows matched, only the number of rows that were literally affected by the query. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex help
Jason Morehouse wrote: Simple enough, in theory... I need to match (count) all of the bold tags in a string, including ones with embedded styles (or whatever else can go in there). b and b style=color:red. My attempts keep matching br as well. I think something not unlike: '/b( .*|)/' The point being that you either have JUST '' OR you have a SPACE and whatever and '' I leave the capitalization and 'greedy' settings up to you. The previous solution using 'b[^r]' will work only until the goofball browser wars give us some other bX tag where X is a single character in the alphabet. There's a pretty cool Windows/Linux product a colleague swears by that's called RegexCoach (?) which will not only let you try out expressions/values and tell you which ones pass/fail, but you can highlight sub-sections of the expression/values and see what it matches piece by piece. It's donationware -- try it out and donate the $20 (oooh, hurt me) if you like it. http://www.weitz.de/regex-coach/ -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with encryption
Hi, Friday, January 14, 2005, 7:53:30 AM, you wrote: BD Howdy all - BD I have RTFM and STFW and I still can't get encryption to work. What I BD finally ended up with from the PHP documentation is long, unwieldy, BD confusing, and doesn't work. I give up. I threw my big mess away and BD would like to start from scratch. BD Could anyone point me to a web page or other documentation that shows a BD SIMPLE example of encryption? I need two-way encryption decryption, BD not a one-way hash. I'll be using this to obfuscate get parameters. BD Any pointers appreciated. Thanks all, BD - Brian Here is a class that uses mcrypt that might be helpful: class encrypt_class{ var $secret; function encrypt_class(){ $this-secret = 'put pass string here'; } Function encode($id){ $eid = $iv = 0; $len = strlen($id); $id = $len.'-'.$id; //encode the string length for trimming later $td = mcrypt_module_open(MCRYPT_TripleDES, , MCRYPT_MODE_ECB, ); $key = substr($this-secret, 0, mcrypt_enc_get_key_size ($td)); $iv = pack(a.mcrypt_enc_get_iv_size($td),$iv); mcrypt_generic_init ($td, $key, $iv); $eid = base64_encode(mcrypt_generic ($td, $id)); mcrypt_generic_deinit($td); return $eid; } Function decode($eid){ $id = $iv = 0; $td = mcrypt_module_open (MCRYPT_TripleDES, , MCRYPT_MODE_ECB, ); $key = substr($this-secret, 0, mcrypt_enc_get_key_size ($td)); $iv = pack(a.mcrypt_enc_get_iv_size($td),$iv); mcrypt_generic_init ($td, $key, $iv); $id = mdecrypt_generic ($td, base64_decode($eid)); $len = strtok($id,'-'); $id = substr($id,(strlen($len)+1),$len); mcrypt_generic_deinit($td); return $id; } } //useage $str = Hello World; $enc = new encrypt_class(); $estr = $enc-encode($str); echo $estrbr; $dstr = $enc-decode($estr); echo $dstrbr; -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with encryption
Brian Dunning wrote: Howdy all - I have RTFM and STFW and I still can't get encryption to work. What I good man! (for trying that is) bummer its not working yet... finally ended up with from the PHP documentation is long, unwieldy, confusing, and doesn't work. I give up. I threw my big mess away and you could have lived with the 'long, unwieldy, confusing' part no doubt! would like to start from scratch. does that mean you tried using the mcrypt extension? I guess it must do. Could anyone point me to a web page or other documentation that shows a SIMPLE example of encryption? I need two-way encryption decryption, this tutorial (2 parts) at webmonkey does quite a good job of taking you thru it step by step: http://webmonkey.wired.com/webmonkey/programming/php/tutorials/tutorial1.html also there has just been a thread on this list which might help you (in case you hadn't seen/read it) subject: Data Encryption started by: [EMAIL PROTECTED] started on: 12-Jan-2005 AFAIKT though proper encryption and SIMPLE just don't go hand in hand. on the other hand encryption and ''brainfreeze' were made for each other :-) if you ask me. not a one-way hash. I'll be using this to obfuscate get parameters. do you just want to obfuscate or is it important that content is actually secure? I can imagine that the issue is compounded in your case by the fact that the GET params are pushed over the wire (which may garbble the encrypted strings - can anyone confirm/deny that hypothesis?) in which case use of url_encode()/url_decode() may need to be used to protect the integrity of the strings. --- If the parameters are taken from a fixed list of values - e.g. columnnames for instance then maybe one-way encryption will work for you. for instance say you have a sortby GET param, you could take the columnnames of your table and hash them with md5sum() or sha1() and stick them into the relevant urls - then if/when a url comes back to the server the hash in the GET param could be checked against the hashes of the columnnames until you find a match - if you find a match you know which column was requested. The example is contrived but hopefully you understand what I mean and you can determine whether this is a possibility for you. --- Lastly you may have to ask yourself if it's necessary/feasable to do GET param encryption (in bang for buck kind of way). Unfortunately I can imagine that such a decision may have been made for you by some non-tehnical manager (it wouldn't be the first time!) in which case arm yourself with a good argument and go batter him with it ;-) Any pointers appreciated. Thanks all, - Brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex help
On Thu, 2005-01-13 at 15:06, Jason Morehouse wrote: Hello, I normally can take a bit of regex fun, but not this time. Simple enough, in theory... I need to match (count) all of the bold tags in a string, including ones with embedded styles (or whatever else can go in there). b and b style=color:red. My attempts keep matching br as well. interesting. I usually try to specifically describe in english what I am looking for. in your case, I would say a string that begins with followed by zero or more spaces followed by a b or a B followed by zero or more spaces followed by zero or more anything followed by /\s*[bB]\s*.*/ or perhaps it is enough to say match a followed by 0 or more spaces followed by a b or a B and not followed by a r or a R and followed by zero or more anything followed by /\s*[bB][^rR].*/ These are untested but should be close and can be used in preg* functions. the greedy matching might grab too much stuff and I always forget how to do that when I hit it. try them, let us see the results and we can get there Bret -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Preventing execution without inclusion
Thomas Goyne wrote: On Thu, 13 Jan 2005 16:25:30 -0600, Adam Hubscher [EMAIL PROTECTED] wrote: 1 (the preferred way): user accesses http://www.example.org/index.php?function=Join, this loads the class NewUser and begins its implementation. Because of the __autoload, it includes class.join.php, in order to utilize the class. 2 (the wrong way): user accesses http://www.example.org/includes/class.join.php without going through index.php. I am trying to prevent 2 from even occuring, utilizing a piece of code that would check if index.php had included it, or not. This code would be in the beginning of all the class files, at the top, before any othercode was to be executed. Ideally, you'd put all of the files users aren't supposed to access outside of the document root, so there just isn't a uri that points to the file. If (as your question makes it sound) the includes do nothing but define a class, and don't actually run any code, then it really doesn't matter if users directly access an include, as nothing will happen. Ok, thats what I expected to be the case - I was just being cautious. Unfortunately with what the application is providing for (a game server), there is a large userbase of people that would potentially do anything in their power... or learning ability, to inflict harm upon the users and the database of the site/game server which I am running. Security has been my primary lack-of-sleep for the last few days, and this was one of the last things eluding me. Thank you very much Thomas! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with encryption
On Thu, 13 Jan 2005 13:53:30 -0800, Brian Dunning [EMAIL PROTECTED] wrote: Could anyone point me to a web page or other documentation that shows a SIMPLE example of encryption? I know absolutely nothing about encryption. There are like 6 people in the entire world who know something about it, but sadly.. I'm not one of them. Good luck in your quest. -- Greg Donald Zend Certified Engineer http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php editor
Since I do Java, Python etc. on OSX/windows/Linux, I'm using Eclipse with the PHPEclipse (PHPEclipse.de), I'm just starting PHP, but I'm pretty happy with it so far. One thing I am wondering about is the situation which Debugging in PHP4 / PHP5. Is there a Debugger for PHP? http://dd.cron.ru/dbg/downloads.php eoghan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Preventing execution without inclusion
Adam Hubscher wrote: I am trying to prevent 2 from even occuring, utilizing a piece of code that would check if index.php had included it, or not. This code would be in the beginning of all the class files, at the top, before any other code was to be executed. use the 2 constants/variables available in PHP scripts to check if the class file has been included by another php script: __FILE__ // the name of the file the current codeline is a part of $_SERVER[SCRIPT_FILENAME] // the name of the primary php file, that has included the current file so it may be enough for you to do something like this in you class files: ?php if ( basename(__FILE__) != 'index.php' ) { // redirection to index.php ... } class Join {} ? As of yet, it has eluded me... hth, bye. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] 404 custom handler on a cgi-wrap PHP - No input specified error
Hi, This maybe a PHP problem, but is associated with Apache too - so my apologies if it is slightly off topic. My web hosts use a CGI wrap version of PHP 4.3.10 I have made a 404 custom error handler, using .htaccess in a directory - it is usppoed to route all unfound pages to error.php, and works as expected for .htm and .html pages as well as gifs etc. But ofr .php scripts, e.g /path/to/wrongurl.php it doesnt show my page - instead it shows No Input file specified.. After some Googling I have only found people witht eh similar problem without solutions. Can any one help me on this? I should say that in IE it just gets the default 404 ( I think this is windows own one responding to the particular http response header) - in firefox you get the 'No input ' error thanks for any advice Luke -- [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Preventing execution without inclusion
as per PHP5 example 1 (the preferred way): user accesses http://www.example.org/index.php?function=Join, this loads the class NewUser and begins its implementation. Because of the __autoload, it includes class.join.php, in order to utilize the class. 2 (the wrong way): user accesses http://www.example.org/includes/class.join.php without going through index.php. I am trying to prevent 2 from even occuring, utilizing a piece of code that would check if index.php had included it, or not. This code would be in the beginning of all the class files, at the top, before any other code was to be executed. As of yet, it has eluded me... Put the include file outside the web directory tree. /jw -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Preventing execution without inclusion
On Thu, 13 Jan 2005 16:25:30 -0600, Adam Hubscher [EMAIL PROTECTED] wrote: 1 (the preferred way): user accesses http://www.example.org/index.php?function=Join, this loads the class NewUser and begins its implementation. Because of the __autoload, it includes class.join.php, in order to utilize the class. 2 (the wrong way): user accesses http://www.example.org/includes/class.join.php without going through index.php. I am trying to prevent 2 from even occuring, utilizing a piece of code that would check if index.php had included it, or not. This code would be in the beginning of all the class files, at the top, before any other code was to be executed. Ideally, you'd put all of the files users aren't supposed to access outside of the document root, so there just isn't a uri that points to the file. If (as your question makes it sound) the includes do nothing but define a class, and don't actually run any code, then it really doesn't matter if users directly access an include, as nothing will happen. -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ http://www.smempire.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help please!!
I would check what hitting the machine from the network. At the most basic level, just try netstat 1 on the command line. Also try iostat 1 to see what load the machine has. It may not be PHP or Apache but something else, maybe a denial of service attack. On Jan 13, 2005, at 10:02 PM, Brent Clements wrote: Having a very frustrating problem and I can't seem to figure out why it's happening. 1. As of last week, all of our applications have started to work intermittingly. The codebase has not changed. 2. Sometimes the application will display, sometimes it won't. The browsers loading progress bar will move for about 25% then just stop. No timeout or 401 errors occur. 3. There are no errors message in any of the logs files. To test if it's our application we have done the following in our main php file which runs the rest of the application ?php echo Step 0 br; --Segment of our code is here-- echo Step 1 br; --Segment of our code is here-- echo Step 2 br; ? Sometimes it doesn't even get to the first line of php code which is the first echo statement, sometimes it gets to step 0 and step 1 and sometimes it gets to all steps. The code between each of these steps is nothing major, nothing calls mysql or anything like that. It's mainly just variable initialization. Again, the entire application runs fine every couple of refreshes. Then sometimes it'll just stop completely. I have turned on all sorts of debugging and nothing. I have reinstalled apache, mysql, and php 2 times. We have also optimize both apache and mysql for for than enough client connections as well are using persistant db connections. But like I said, the application works sometimes, sometimes it doesn't. And the data is pretty static. I am running RHEL 3 U3 with RH php version php-4.3.2-19.ent, RH mysql server version mysql-server-3.23.58-2.3, and RH apache version httpd-2.0.46-44.ent Thanks guys for any help troubleshooting this. -Brent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brent Baisley Systems Architect Landover Associates, Inc. Search Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [suspicious - maybe spam] [PHP] [suspicious - maybe spam] strange in MySQL Query.
adwin wijaya wrote: SELECT group as type FROM mytable WHERE id =101010 UNION SELECT individual as type FROM myothertable WHERE id=101010 The strange result if only one result displayed from myothertable, so the type will become indiv instead of individual. But when I tried to switch the query become : SELECT individual as type FROM myothertable WHERE id=101010 UNION SELECT group as type FROM mytable WHERE id =101010 it could displaye the result correctly. I dont know why .. is this mysql bug ? Where's the PHP part? The data type of your return columns MUST MATCH in a UNION. The data type of group would be... char(5) since it has no inherent data type. So when you put group first, MySQL uses char(5) When you put individual first, MySQL uses char(10) You can play with this some more with longer/short strings to verify. If you force the type of 'group' to be, say, varchar(255) the discrepency will disappear. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Preventing execution without inclusion
Adam Hubscher wrote: From within the application, I use one page to include classes/variables and so on. Is there a way (I may have been missing it in the documentation for PHP, however I didnt see anything related) to prevent a user from directly accessing/executing *.php by the file making sure taht it was only included by index.php? For example: config.php defines: function __autoload($class_name) { $class_name = strtolower($class_name); include_once('class.'.$class_name.'.php'); } as per PHP5 example 1 (the preferred way): user accesses http://www.example.org/index.php?function=Join, this loads the class NewUser and begins its implementation. Because of the __autoload, it includes class.join.php, in order to utilize the class. 2 (the wrong way): user accesses http://www.example.org/includes/class.join.php without going through index.php. I am trying to prevent 2 from even occuring, utilizing a piece of code that would check if index.php had included it, or not. This code would be in the beginning of all the class files, at the top, before any other code was to be executed. As of yet, it has eluded me... Just *MOVE* your include files to a directory that is not in the web tree. It would then be very difficult for people to surf to them, no? You can set *ANY* directory you want in include_path in php.ini, .htaccess, or using ini_set to get that directory to be searched by PHP for include files. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Begining CVS
On Fri, 14 Jan 2005 01:30:39 +0100, Jochem Maas [EMAIL PROTECTED] wrote: do you use a visual client for subversion? No. I use svn from command line. the reason I ask is that I found cvs a nightmare until someone pointed me to tortoiseCVS - which is just too easy to use! And I just noticed tortoiseSVN exists which seems to be the subversion counterpart...(can't tell if the projects/devs are related or whether the name is merely a little mark of respect towards its cvs counterpart) Also did you step over to subversion out of need for extra functionality or was it originally down to curiosity I began to use it because I was contracting work from a company who used it. I saw all the things in it that were improved compared to cvs. So I switched at home too. Some things are worse though. Like in cvs it's pretty simple to hide a file: echo 'config.php' .cvsignore versus the more complicated syntax for hiding one with subversion: svn propset svn:ignore -F 'config.php' . personally I'm still struggling with the concepts of branches and tag too much to dive in and learn even more powerful functionality. Subversion shines here. When you create the initial tree you make the trunk, branches, and tags directories from the start. -- Greg Donald Zend Certified Engineer http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] custom superglobals?
Hi, Is it possible to define my own superglobal variable or array? Rather than doing `global $cfg;` in all of my functions, I'd like to just set $cfg as a superglobal in one place and forget about it. Yes, I'm aware I could use $GLOBALS['cfg'], but I'd much prefer it worked like $_GET etc. --- Justin French, Indent.com.au [EMAIL PROTECTED] Web Application Development Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php editor
I've been using Dreamweaver (currently MX) since I started writing PHP and I would defintiely recommend it if you can get hold of it. You can download a trial from http://www.macromedia.com/cfusion/tdrc/index.cfm?product=dreamweaver William Stokes wrote: Hello, I'm quite new with writing php code. I was considering of using some kind of php editor program to help with the syntax. Know any goog ones? Thanks -Will -- -- David Green Information Centre, Central Science Laboratory Sand Hutton, York, YO41 1LZ Phone: +44 (0)1904 462388 (GTN: 5129 2388) Fax:+44 (0)1904 462111 E-Mail: [EMAIL PROTECTED] -- CSL email disclaimer: http://www.csl.gov.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Persistent PHP web application?
George Schlossnagle addresses exactly your requirement in his book Advanced PHP Programming. Josh Whiting wrote: Dear list, My web application (an online classifieds server) requires a set of fairly large global arrays which contain vital information that most all the page scripts rely upon for information such as the category list, which fields belong to each category, and so on. Additionally, there are a large number of function definitions (more than 13,000 lines of code in all just for these global definitions). These global arrays and functions never change between requests. However, the PHP engine destroys and recreates them every time. After having spent some serious time doing benchmarking (using Apache Bench), I have found that this code takes at least 7ms to parse per request on my dual Xeon 2.4ghz server (Zend Accelerator in use*). This seriously cuts into my server's peak capacity, reducing it by more than half. My question is: is there a way to define a global set of variables and functions ONCE per Apache process, allowing each incoming hit to run a handler function that runs within a persistent namespace? OR, is it possible to create some form of shared variable and function namespace that each script can tap? AFAIK, mod_python, mod_perl, Java, etc. all allow you to create a persistent, long-running application with hooks/handlers for individual Apache requests. I'm surprised I haven't found a similar solution for PHP. In fact, according to my work in the past few days, if an application has a large set of global functions and variable definitions, mod_python FAR exceeds the performance of mod_php, even though Python code runs significantly slower than PHP code (because in mod_python you can put all these definitions in a module that is loaded only once per Apache process). The most promising prospect I've come across is FastCGI, which for Perl and other languages, allows you to run a while loop that sits and receives incoming requests (e.g. while(FCGI::accept() = 0) {..}). However, the PHP/FastCGI modality seems to basically compare to mod_php: every request still creates and destroys the entire application (although the PHP interpreter itself does persist). Essentially I want to go beyond a persistent PHP *interpreter* (mod_php, PHP/FastCGI) and create a persistent PHP *application*... any suggestions? Thanks in advance for any help! Regards, J. Whiting * - Please note that I am using the Zend Accelerator (on Redhat Enterprise with Apache 1.3) to cache the intermediate compiled PHP code. My benchmarks (7ms+) are after the dramatic speedup provided by the accelerator. I wouldn't even bother benchmarking this without the compiler cache, but it is clear that a compiler cache does not prevent PHP from still having to run the (ableit precompiled) array and function definition code itself. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: calling php functions as library or cmd line
Geeze, That was obnoxious. Luckily google helped me out eventually: if (basename($argv[0]) == basename(__FILE__)) { Robert Cummings wrote: On Thu, 2005-01-13 at 09:46, Cere Davis wrote: Does anyone know how to write php libraries in a modular way so that you can both test the libraries/functions on the command line with arguments and/or use the php library as a part of your web code with 'require_once()' syntax? Sort of like how Python or Ruby works? Yes. Cheers, Rob. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php editor
On Fri, 14 Jan 2005 18:47:14 +0100, Jochem Maas [EMAIL PROTECTED] wrote: in addition there is the xdebug extension by Derick Rethans its at version 2 but I might suggest starting with 1.3 as its alot simpler to use than 2 (then again if you have experience of things like valgrind/dbg on linux you should have little problems). I just don't see the need. PHP explodes right on the screen for me. I can usually find and fix an error in a few seconds of seeing it in my browser or in my terminal. Lines numbers always accompany the error messages, and you can even go the extra mile and link the error messages back into the PHP manual for faster lookups when required. Granted if you have a long running PHP app that's acting funky then you might want to analyze it in more depth.. but at that point you gotta ask yourself should you even be using PHP for the task at hand? Could this task or even part of the task be better handled better with another language? -- Greg Donald Zend Certified Engineer http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php editor
Greg Donald wrote: On Thu, 13 Jan 2005 22:11:05 +, Justin [EMAIL PROTECTED] wrote: Is there a Debugger for PHP? php -l filename.php for basic syntax check. If you need more than that you can turn of full error reporting and view the errors directly on the screen: error_reporting( E_ALL ); ini_set( 'display_errors', 1 ); But later when you go to a production environment I'd go with: error_reporting( E_ERROR | E_WARNING | E_PARSE ); ini_set( 'display_errors', 0 ); ini_set( 'log_errors', 1 ); in addition there is the xdebug extension by Derick Rethans its at version 2 but I might suggest starting with 1.3 as its alot simpler to use than 2 (then again if you have experience of things like valgrind/dbg on linux you should have little problems). obviously you need to be able to compile the extension on/for you server (or have someone do it for you) which may not be possible for you (e.g. because its sharedhosting) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php