Re: [PHP] Users Online?
Paul M Foster wrote: On Sat, Jun 20, 2009 at 01:33:52PM -0700, Chris Payne wrote: Hi everyone, I have a login system that allows a user to login to my control panel, is there an easy way so that I can tell how many users / what users are logged into my system? What would I need to do to add this with the minimum of hassle? Would I just have to look at the sessions that are currently active and if so, how? I really want to add this feature as it will help with creating a messaging system. Doing this purely with sessions is impossible (well, nearly), since sessions can't see each other. Yeah - what I do, and why I mentioned database, my session database has a field for userid so that I can easily with a single query associate a userid with a session. mysql> describe php_sessions; +--+--+--+-+-+---+ | Field| Type | Null | Key | Default | Extra | +--+--+--+-+-+---+ | session_id | varchar(32) | NO | PRI | | | | session_data | longtext | YES | | NULL| | | dt_created | int(11) | NO | | 0 | | | ip_created | varchar(32) | NO | | | | | dt_modified | int(11) | NO | | 0 | | | ip_modified | varchar(32) | NO | | | | | userid | mediumint(9) | NO | | 0 | | | expires | int(11) | NO | | 0 | | | expired | tinyint(4) | NO | | 0 | | +--+--+--+-+-+---+ That's one of the advantages to using a database for sessions - you can tie all kinds of groovy information to the session_id that can then help with future forensics and stuff if needed, and instead of deleting a session when it expires, set the expired field so that you can keep expired sessions around for longer yet they aren't useable by a client. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Users Online?
Why all this mess for such a simple thing? All you need is to allocate the last activity timestamp with userid in the users table, add 'last_activity' column to the users table then update it with every page load at the administration panel. Then all you need to do in order to print out the current logged in users is to SELECT `username` FROM `users` WHERE `last_activity` > time() - 60*15 60*15 means that users which had an activity during the last 15 minutes will be shown as logged in ;) This is the way I would do that if you have no session handling system. HTH, Nitsan On Sun, Jun 21, 2009 at 10:10 AM, Michael A. Peters wrote: > Paul M Foster wrote: > >> On Sat, Jun 20, 2009 at 01:33:52PM -0700, Chris Payne wrote: >> >> Hi everyone, >>> >>> I have a login system that allows a user to login to my control panel, >>> is there an easy way so that I can tell how many users / what users >>> are logged into my system? What would I need to do to add this with >>> the minimum of hassle? Would I just have to look at the sessions that >>> are currently active and if so, how? I really want to add this >>> feature as it will help with creating a messaging system. >>> >> >> Doing this purely with sessions is impossible (well, nearly), since >> sessions can't see each other. >> > > Yeah - what I do, and why I mentioned database, my session database has a > field for userid so that I can easily with a single query associate a userid > with a session. > > mysql> describe php_sessions; > +--+--+--+-+-+---+ > | Field| Type | Null | Key | Default | Extra | > +--+--+--+-+-+---+ > | session_id | varchar(32) | NO | PRI | | | > | session_data | longtext | YES | | NULL| | > | dt_created | int(11) | NO | | 0 | | > | ip_created | varchar(32) | NO | | | | > | dt_modified | int(11) | NO | | 0 | | > | ip_modified | varchar(32) | NO | | | | > | userid | mediumint(9) | NO | | 0 | | > | expires | int(11) | NO | | 0 | | > | expired | tinyint(4) | NO | | 0 | | > +--+--+--+-+-+---+ > > That's one of the advantages to using a database for sessions - you can tie > all kinds of groovy information to the session_id that can then help with > future forensics and stuff if needed, and instead of deleting a session when > it expires, set the expired field so that you can keep expired sessions > around for longer yet they aren't useable by a client. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
[PHP] mirroring website
Hey I have the following issue! I want to develop my website on my local machine, and then upload the entire developed site to a production server. What is the best strategy to do that? I have been looking at a php mirroring script but that was about 5 years old! Is'nt there a better/newer approach? By the way... I'm using Fedora linux with LAMP (php5) best regards Lars Nielsen www.mit-web.dk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mirroring website
Create 2 different configuration files, load the appropriate one after checking whether $_ENV['dev'] is set to 1 or 0 then all you have to do is to set the environment variable 'dev' to 1 or 0 through .htaccess file. After setting this up all you have to do is to rewrite the files whenever you want to update the files in the production server or vice versa. Just my $0.02 ;) Nitsan On Sun, Jun 21, 2009 at 4:56 PM, Lars Nielsen wrote: > Hey > > I have the following issue! I want to develop my website on my local > machine, and then upload the entire developed site to a production > server. What is the best strategy to do that? > I have been looking at a php mirroring script but that was about 5 years > old! Is'nt there a better/newer approach? > > By the way... I'm using Fedora linux with LAMP (php5) > > best regards > Lars Nielsen > www.mit-web.dk > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
Re: [PHP] mirroring website
Hi, > I have the following issue! I want to develop my website on my local > machine, and then upload the entire developed site to a production > server. What is the best strategy to do that? > I have been looking at a php mirroring script but that was about 5 years > old! Is'nt there a better/newer approach? I used to use rsync (with a bunch of options) whenever I did this. With you being on Linux, it would be trivial to automate it with a script. -- Richard Heyes HTML5 graphing: RGraph (www.rgraph.net - updated 20th June) PHP mail: RMail (www.phpguru.org/rmail) PHP datagrid: RGrid (www.phpguru.org/rgrid) PHP Template: RTemplate (www.phpguru.org/rtemplate) PHP SMTP: http://www.phpguru.org/smtp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mirroring website
Thanks for the cents. I will try a combination of multiple configuration files and rsync! /Lars søn, 21 06 2009 kl. 16:39 +0100, skrev Richard Heyes: > Hi, > > > I have the following issue! I want to develop my website on my local > > machine, and then upload the entire developed site to a production > > server. What is the best strategy to do that? > > I have been looking at a php mirroring script but that was about 5 years > > old! Is'nt there a better/newer approach? > > I used to use rsync (with a bunch of options) whenever I did this. > With you being on Linux, it would be trivial to automate it with a > script. > > -- > Richard Heyes > HTML5 graphing: RGraph (www.rgraph.net - updated 20th June) > PHP mail: RMail (www.phpguru.org/rmail) > PHP datagrid: RGrid (www.phpguru.org/rgrid) > PHP Template: RTemplate (www.phpguru.org/rtemplate) > PHP SMTP: http://www.phpguru.org/smtp > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mirroring website
On Sun, 21 Jun 2009 16:39:18 +0100, Richard Heyes wrote: > >> I have the following issue! I want to develop my website on my local >> machine, and then upload the entire developed site to a production >> server. What is the best strategy to do that? >> I have been looking at a php mirroring script but that was about 5 years >> old! Is'nt there a better/newer approach? > > I used to use rsync (with a bunch of options) whenever I did this. > With you being on Linux, it would be trivial to automate it with a > script. And, if you don't have ssh access to the web server -- but rather, just ftp -- there's `ftpsync` which I use. When Googling for `ftpsync` , ignore the windo$ hits. There's a name collison there. You want the linux program. Be carefull with ".htaccess". heh heh Mine are different for the local machine -- mainly for testing and local lan purposes. Now and then I screw up and upload an .htaccess from the local web server to the World-Wide-Web server. Big snafu - that! :-) HTH Jonesy -- Marvin L Jones| jonz | W3DHJ | linux 38.24N 104.55W | @ config.com | Jonesy | OS/2 * Killfiling google & banter.com: jonz.net/ng.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] isset question
How does echoing back to the page make it vulnerable? This does not go to a DB if that makes any difference. Gary "Paul M Foster" wrote in message news:20090621032151.gb14...@quillandmouse.com... > On Sat, Jun 20, 2009 at 12:20:56PM +0100, Ashley Sheridan wrote: > >> On Sat, 2009-06-20 at 00:19 -0400, Paul M Foster wrote: >> > On Fri, Jun 19, 2009 at 07:52:40PM +0100, Ashley Sheridan wrote: >> > >> > > On Fri, 2009-06-19 at 12:36 +0100, Ford, Mike wrote: >> > > > On 18 June 2009 20:25, LAMP advised: >> > > > >> > > > > using !empty() instead isset() will work if you don't care for >> > > > > PHP >> > > > > Notice: Undefined variable... If you want to avoid PHP Notice >> > > > > you have >> > > > > to use both: >> > > > > >> > > > > $msg.= (isset($_POST['mort']) and !empty($_POST['mort'])) ? "The >> > > > > mortgage amount is $mort\n" : " "; >> > > > >> > > > Absolute rubbish -- as it says at http://php.net/empty, >> > > > "empty($var) is >> > > > the opposite of (boolean)$var, except that no warning is generated >> > > > when >> > > > the variable is not set." -- so "protecting" empty() with an >> > > > isset() is >> > > > a total waste of time, space and cpu cycles. >> > >> > >> > >> > > > >> > > To be honest, you're still opening yourself up to attack that way. >> > >> > Why and how? >> > >> > Paul >> > >> > -- >> > Paul M. Foster >> > >> I've only done a little reading on this, but you're opening yourself up >> to a XSS attack. If someone posted '//malicious code >> here' to your PHP script, you'd essentially be printing that >> right back out onto your page. > > I see. You're not talking about being vulnerable because of isset/empty, > but by echoing it back to the page. Yes, I agree there. You have to > sanitize it first. > > Paul > > -- > Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calendar
On Sat, 2009-06-20 at 10:26 -0400, tedd wrote: > At 7:58 PM +0100 6/19/09, Ashley Sheridan wrote: > >On Fri, 2009-06-19 at 15:30 +0530, Sudheer Satyanarayana wrote: > >> salmarayan wrote: > >> > Does Any body please have the code of A Java Script Calendar > >>that works with > >> > a PHP Html Form.. > >> > if yes can you please send it as i have one but does not work that > >> > Efficiently. > >> > > >> > Thanks in advance > >> > > >> This might help if you are looking for a date picker > >> > >> http://techchorus.net/add-cool-date-picker-2-lines-javascript > >> > >> > >> -- > >> > >> With warm regards, > >> Sudheer. S > >> Business: http://binaryvibes.co.in, Tech stuff: > >>http://techchorus.net, Personal: http://sudheer.net > >> > >> > >I've always used Tigra calendar, and it's been very flexible for me for > >a lot of sites. Don't know whether or not it is still maintained, as I > >keep using the same source I picked up a couple of years back! If you > >have trouble finding it, give me a shout. > > > >Thanks > >Ash > > Ash et al: > > I like to roll and maintain my own. While it's not javascript, it works. > > http://webbytedd.com//tedd-php-calendar/ <-- code is there > > And it's fairly easy to hook up to a database, such as seen here: > > http://php1.net/my-php-calendar/ > > The original code for the db version can be found in the php-calendar > (http://php-calendar.com). > > Cheers, > > tedd > > -- > --- > http://sperling.com http://ancientstones.com http://earthstones.com > Tedd, as you ought to know by now, I rolled my own of those a while back too, it's come up on these lists a few times! :p The op just asked for a calendar that was javascript based for a user to add a data into a form Thanks Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP Mail Function
On Sat, 2009-06-20 at 20:30 -0600, David Swenson wrote: > Julian, > > From my understanding of PHP's mail() function, it doesn't do anything > more than send to the address you specified. > > On that note, I'd check things like: > Email address typos > The email your sending to your domain, is it already being forwarded? > If so, do you get the email at your gmail account? > If it's not being forwarded, add $additionalheaders to your script and > CC: your gmail account when sending to your domain. See if it shows up > there. > > Anyway those are somethings you could try as you have supplied no code > to check syntax and/or given any other testing you've tried. > > Good Luck, > David > > > -Original Message- > From: Julian Muscat Doublesin [mailto:opensourc...@gmail.com] > Sent: Saturday, June 20, 2009 1:59 PM > To: php-general@lists.php.net > Subject: [PHP] PHP Mail Function > > > Hello Everyone, > > I have written an e-mail function that sends e-mail to my domain that > forwards it to a gmail account. > > When I use the gmail address directly it works fine. When I use my mail > domain i don't get anything. > > Has anyone experienced this? Can anyone give me some advice? > > Thanks in advance > > Julian > No virus found in this incoming message. > Checked by AVG - www.avg.com > Version: 8.5.364 / Virus Database: 270.12.81/2189 - Release Date: > 06/20/09 06:15:00 > > > I had this problem before, and it seems that spam filters of all descriptions were the culprit. Thanks Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] isset question
On Sun, 2009-06-21 at 13:57 -0400, Gary wrote: > How does echoing back to the page make it vulnerable? This does not go to a > DB if that makes any difference. > > Gary > > > "Paul M Foster" wrote in message > news:20090621032151.gb14...@quillandmouse.com... > > On Sat, Jun 20, 2009 at 12:20:56PM +0100, Ashley Sheridan wrote: > > > >> On Sat, 2009-06-20 at 00:19 -0400, Paul M Foster wrote: > >> > On Fri, Jun 19, 2009 at 07:52:40PM +0100, Ashley Sheridan wrote: > >> > > >> > > On Fri, 2009-06-19 at 12:36 +0100, Ford, Mike wrote: > >> > > > On 18 June 2009 20:25, LAMP advised: > >> > > > > >> > > > > using !empty() instead isset() will work if you don't care for > >> > > > > PHP > >> > > > > Notice: Undefined variable... If you want to avoid PHP Notice > >> > > > > you have > >> > > > > to use both: > >> > > > > > >> > > > > $msg.= (isset($_POST['mort']) and !empty($_POST['mort'])) ? "The > >> > > > > mortgage amount is $mort\n" : " "; > >> > > > > >> > > > Absolute rubbish -- as it says at http://php.net/empty, > >> > > > "empty($var) is > >> > > > the opposite of (boolean)$var, except that no warning is generated > >> > > > when > >> > > > the variable is not set." -- so "protecting" empty() with an > >> > > > isset() is > >> > > > a total waste of time, space and cpu cycles. > >> > > >> > > >> > > >> > > > > >> > > To be honest, you're still opening yourself up to attack that way. > >> > > >> > Why and how? > >> > > >> > Paul > >> > > >> > -- > >> > Paul M. Foster > >> > > >> I've only done a little reading on this, but you're opening yourself up > >> to a XSS attack. If someone posted '//malicious code > >> here' to your PHP script, you'd essentially be printing that > >> right back out onto your page. > > > > I see. You're not talking about being vulnerable because of isset/empty, > > but by echoing it back to the page. Yes, I agree there. You have to > > sanitize it first. > > > > Paul > > > > -- > > Paul M. Foster > > > My assumption was that because it was displaying the mortgage amount to the user, that it would at some point store it too. Thanks Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] share code between sites
Hey List Is there any good approach to share code between multiple sites? The code might be on the same server but on different domains. best regards Lars -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] share code between sites
The same document root and different Vhosts? On Sun, Jun 21, 2009 at 4:01 PM, Lars Nielsen wrote: > Hey List > > Is there any good approach to share code between multiple sites? The > code might be on the same server but on different domains. > > best regards > > Lars > > > -- > 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] share code between sites
On Sun, Jun 21, 2009 at 2:01 PM, Lars Nielsen wrote: > Hey List > > Is there any good approach to share code between multiple sites? The > code might be on the same server but on different domains. put your common code outside the web root, and use the include_path ini setting in all the various sites to get access to it. thats one way to do it. -nathan
Re: [PHP] share code between sites
Yeah maybe thats the way to do it. It certantly sounds like a working solution. søn, 21 06 2009 kl. 16:02 -0400, skrev Eddie Drapkin: > The same document root and different Vhosts? > > On Sun, Jun 21, 2009 at 4:01 PM, Lars Nielsen wrote: > > Hey List > > > > Is there any good approach to share code between multiple sites? The > > code might be on the same server but on different domains. > > > > best regards > > > > Lars > > > > > > -- > > 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] Passing Values between C App and PHP
Hi, I've recently written an eMail regarding I2C and PHP - since I haven't found a nice solution yet, I'm considering writting the I2C part (opening device, writing, reading,...) in C (that's simple) and to recieve (and returning) the values through PHP and Javascript. E.g. Website (PHP/Javascript) -> set a new motorspeed -> PHP passes the new speed to C Application -> C AP opens and writes the new speed onto the I2C Bus -> Motor executes -> returns ack -> Is this somehow, and not complicated possible? Thanks, Tobias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing Values between C App and PHP
On Sun, Jun 21, 2009 at 3:25 PM, Tobias Krieger < tobias.krie...@teamfrednet.org> wrote: > Hi, > > I've recently written an eMail regarding I2C and PHP - since I haven't > found a nice solution yet, I'm considering writting the I2C part (opening > device, writing, reading,...) in C (that's simple) and to recieve (and > returning) the values through PHP and Javascript. > > E.g. Website (PHP/Javascript) -> set a new motorspeed -> PHP passes the new > speed to C Application -> C AP opens and writes the new speed onto the I2C > Bus -> Motor executes -> returns ack -> > > Is this somehow, and not complicated possible? if the C program is written such that it can start and stop on every request rather than as a daemon, its as simple as shell_exec(). write your C app to take args over the cli and then pass them in through the call: something of that nature. -nathan
Re: [PHP] Passing Values between C App and PHP
Am 21.06.2009 um 23:31 schrieb Nathan Nobbe: On Sun, Jun 21, 2009 at 3:25 PM, Tobias Krieger > wrote: Hi, I've recently written an eMail regarding I2C and PHP - since I haven't found a nice solution yet, I'm considering writting the I2C part (opening device, writing, reading,...) in C (that's simple) and to recieve (and returning) the values through PHP and Javascript. E.g. Website (PHP/Javascript) -> set a new motorspeed -> PHP passes the new speed to C Application -> C AP opens and writes the new speed onto the I2C Bus -> Motor executes -> returns ack -> Is this somehow, and not complicated possible? if the C program is written such that it can start and stop on every request rather than as a daemon, its as simple as shell_exec(). write your C app to take args over the cli and then pass them in through the call: something of that nature. -nathan This would be a nice and fast solution, but unfortunatelly, it's like that the C programm needs to surveilance the hardware all the time (controlling values,...) hence, it would run more as a "daemon". thx, tobias
Re: [PHP] Passing Values between C App and PHP
On Sun, Jun 21, 2009 at 3:44 PM, Tobias Krieger < tobias.krie...@teamfrednet.org> wrote: > This would be a nice and fast solution, but unfortunatelly, it's like that > the C programm needs to surveilance the hardware all the time (controlling > values,...) hence, it would run more as a "daemon". > then you will have to make the C app accept socket connections; or maybe try unix signals handlers in the C app w/ shared memory betwen both processes; maybe there are easier ways to do it.. -nathan
[PHP] Problems with APC, possible cache-corruption?
(Resend from around 1 week ago, because of no responses) Hi All, Over the weekend I setup a test of APC intending to benchmark a Moodle installation with various APC settings to see how well I could get it to perform. I successfully installed Moodle 1.9 and 2.0 under Apache 2.2.3 (installed via apt on Ubuntu 9.04), and with PHP 5.2.9 compiled from source. I should note, that Ubuntu had an older version of PHP installed from apt with Suhosin hardened PHP built in. Moodle 2.0 required at least PHP 5.2.8, so I uninstalled the original PHP module before compiling and installing the 5.2.9. No issues there; PHP worked well and performance was (mostly) acceptable. Progressed onto installing APC, firstly by downloading the APC 3.1.2 source from PECL and following the usual 'phpize, configure, make, make install' process which worked as expected, stop and start Apache and APC was present in my phpinfo();. I started with the reccomended PHP config exept with error_display turned on and E_ALL | E_STRICT enabled, and also the reccomended APC config also. I copied the 'apc.php' from the source tree to my webroot and changed the password as suggested. The issue arose when I attempted to benchmark my Moodle install with 'ab' (I realise it only downloads the single page, but it's good enough for what I need for now though) and the result was no different to before I had installed APC. View the apc.php page, and the only page cached is apc.php itself.. Certainly not what I've witnessed in the past. Then what would happen was if I viewed my seperate info.php page containing simply the opening PHP tag and a single line with phpinfo(); in the file - the cache would appear to reset, and it would firstly not load the info.php into the cache, it would reset the counter on the apc.php file back to 0. Through all of this, there was no errors displayed on the screen and no errors listed in the Apache error log either. Increased the Apache log level up to Debug, and no related information was displayed. Moodle itself worked as expected with no errors, and on a seperate RHEL installation I have Moodle working with APC and it is caching all it's files as expected. At this point, I thought it may be an issue with the module I compiled myself. I backed up the module, and allowed PECL to install the module, it installed 3.0.19. Restarted Apache and verified the version was as PECL had built and installed. This had no effect, and yeilded the same behaviour. I'm stumped as to what the issue could be, however I did see this issue of APC not caching files on an installation of Red Hat Enterprise Linux in the past - however at the time we assumed it was an issue with the framework we were using and due to time constraints simply ran without APC and didn't investigate further. Has anyone seen this issue in the past and perhaps even rectified it? Any information would be appreciated. Cheers, James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with APC, possible cache-corruption?
On Sun, Jun 21, 2009 at 5:56 PM, James McLean wrote: > (Resend from around 1 week ago, because of no responses) > > Hi All, > > Over the weekend I setup a test of APC intending to benchmark a Moodle > installation with various APC settings to see how well I could get it > to perform. I successfully installed Moodle 1.9 and 2.0 under Apache > 2.2.3 (installed via apt on Ubuntu 9.04), and with PHP 5.2.9 compiled > from source. I should note, that Ubuntu had an older version of PHP > installed from apt with Suhosin hardened PHP built in. Moodle 2.0 > required at least PHP 5.2.8, so I uninstalled the original PHP module > before compiling and installing the 5.2.9. > > No issues there; PHP worked well and performance was (mostly) acceptable. > > Progressed onto installing APC, firstly by downloading the APC 3.1.2 > source from PECL and following the usual 'phpize, configure, make, > make install' process which worked as expected, stop and start Apache > and APC was present in my phpinfo();. I started with the reccomended > PHP config exept with error_display turned on and E_ALL | E_STRICT > enabled, and also the reccomended APC config also. > > I copied the 'apc.php' from the source tree to my webroot and changed > the password as suggested. > > The issue arose when I attempted to benchmark my Moodle install with > 'ab' (I realise it only downloads the single page, but it's good > enough for what I need for now though) and the result was no different > to before I had installed APC. View the apc.php page, and the only > page cached is apc.php itself.. Certainly not what I've witnessed in > the past. Then what would happen was if I viewed my seperate info.php > page containing simply the opening PHP tag and a single line with > phpinfo(); in the file - the cache would appear to reset, and it would > firstly not load the info.php into the cache, it would reset the > counter on the apc.php file back to 0. > > Through all of this, there was no errors displayed on the screen and > no errors listed in the Apache error log either. Increased the Apache > log level up to Debug, and no related information was displayed. > Moodle itself worked as expected with no errors, and on a seperate > RHEL installation I have Moodle working with APC and it is caching all > it's files as expected. > > At this point, I thought it may be an issue with the module I compiled > myself. I backed up the module, and allowed PECL to install the > module, it installed 3.0.19. Restarted Apache and verified the version > was as PECL had built and installed. > > This had no effect, and yeilded the same behaviour. > > I'm stumped as to what the issue could be, however I did see this > issue of APC not caching files on an installation of Red Hat > Enterprise Linux in the past - however at the time we assumed it was > an issue with the framework we were using and due to time constraints > simply ran without APC and didn't investigate further. > > Has anyone seen this issue in the past and perhaps even rectified it? > > Any information would be appreciated. did you take a look at the size of the cache you created ? also, arent you planning to cache php opcodes, so if you load up the page, index.html, i would expect to see a bunch of php files mentioned in the apc cache.. if apc has support for output caching, ive not yet used it so im not sure how much i could help there (sort of sounds like youre shooting for output caching the way you describe things above). maybe you could dump out your ini settings for apc and share them here? -nathan
Re: [PHP] Problems with APC, possible cache-corruption?
On Mon, Jun 22, 2009 at 9:40 AM, Nathan Nobbe wrote: > On Sun, Jun 21, 2009 at 5:56 PM, James McLean > wrote: > did you take a look at the size of the cache you created ? Yes. Tried multiple segments and single, with cache size values between 128mb and 256mb. Also tried with stat on and off. > also, arent you planning to cache php opcodes, so if you load up the page, > index.html, i > would expect to see a bunch of php files mentioned in the apc cache.. Well, index.html wouldn't be cached because it's not parsed by the PHP engine. But yes, if it were index.php for example each compiled PHP file is then cached in the opcode cache - include files and everything. This is how it works on every other APC installation i've tried :) This installation is not doing that, even though this is the default behaviour. > if apc has support for output caching, ive not yet used it so im not sure how > much i could help there (sort of sounds like youre shooting for output > caching the way you describe things above). No, i'm not looking for output caching. Apologies if my original email was poorly worded. > maybe you could dump out your ini settings for apc and share them here? No need. they're all default as reccomended by PHP and APC. Thanks, James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with APC, possible cache-corruption?
Can you do a phpinfo(); and tell us the value of the setting apc.filters (or every apc.* if you can)? Just curious, but I've seen apps set that setting to avoid APC opcode caching. Jonathan On Sun, Jun 21, 2009 at 8:56 PM, James McLean wrote: > (Resend from around 1 week ago, because of no responses) > > Hi All, > > Over the weekend I setup a test of APC intending to benchmark a Moodle > installation with various APC settings to see how well I could get it > to perform. I successfully installed Moodle 1.9 and 2.0 under Apache > 2.2.3 (installed via apt on Ubuntu 9.04), and with PHP 5.2.9 compiled > from source. I should note, that Ubuntu had an older version of PHP > installed from apt with Suhosin hardened PHP built in. Moodle 2.0 > required at least PHP 5.2.8, so I uninstalled the original PHP module > before compiling and installing the 5.2.9. > > No issues there; PHP worked well and performance was (mostly) acceptable. > > Progressed onto installing APC, firstly by downloading the APC 3.1.2 > source from PECL and following the usual 'phpize, configure, make, > make install' process which worked as expected, stop and start Apache > and APC was present in my phpinfo();. I started with the reccomended > PHP config exept with error_display turned on and E_ALL | E_STRICT > enabled, and also the reccomended APC config also. > > I copied the 'apc.php' from the source tree to my webroot and changed > the password as suggested. > > The issue arose when I attempted to benchmark my Moodle install with > 'ab' (I realise it only downloads the single page, but it's good > enough for what I need for now though) and the result was no different > to before I had installed APC. View the apc.php page, and the only > page cached is apc.php itself.. Certainly not what I've witnessed in > the past. Then what would happen was if I viewed my seperate info.php > page containing simply the opening PHP tag and a single line with > phpinfo(); in the file - the cache would appear to reset, and it would > firstly not load the info.php into the cache, it would reset the > counter on the apc.php file back to 0. > > Through all of this, there was no errors displayed on the screen and > no errors listed in the Apache error log either. Increased the Apache > log level up to Debug, and no related information was displayed. > Moodle itself worked as expected with no errors, and on a seperate > RHEL installation I have Moodle working with APC and it is caching all > it's files as expected. > > At this point, I thought it may be an issue with the module I compiled > myself. I backed up the module, and allowed PECL to install the > module, it installed 3.0.19. Restarted Apache and verified the version > was as PECL had built and installed. > > This had no effect, and yeilded the same behaviour. > > I'm stumped as to what the issue could be, however I did see this > issue of APC not caching files on an installation of Red Hat > Enterprise Linux in the past - however at the time we assumed it was > an issue with the framework we were using and due to time constraints > simply ran without APC and didn't investigate further. > > Has anyone seen this issue in the past and perhaps even rectified it? > > Any information would be appreciated. > > Cheers, > > James > > -- > 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] Problems with APC, possible cache-corruption?
On Mon, Jun 22, 2009 at 10:02 AM, Jonathan Tapicer wrote: > Can you do a phpinfo(); and tell us the value of the setting > apc.filters (or every apc.* if you can)? Just curious, but I've seen > apps set that setting to avoid APC opcode caching. Certainly, however it will have to wait until I am home and have access to that machine again. Though I'm not sure that would be the case as APC is caching all Moodle files on my development server here. That being said I'll grep the codebase anyway to see if it's setting any filters. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php