Re: [PHP] Revision control?

2010-03-09 Thread James McLean
On Wed, Mar 10, 2010 at 11:14 AM, Tom Sparks tom_a_spa...@yahoo.com.au wrote:
 --- On Wed, 10/3/10, Phpster phps...@gmail.com wrote:

 I believe pear has some stuff for subversion.

 Don't want to use subversion or any third-party app

Why re-invent the wheel? Just use SVN, existing libraries out there,
easy to use, easy to access and portable.

 I forgot to say needs to support media files (images/sounds/etc) as well as 
 text based files.
 I don't care if it flat-file based or database based

I have stored binary data in SVN many times. No issues. IIRC it simply
stores a new copy of the entire file for each instance of binary data,
rather than storing the changes as it would with a Text file.

Cheers,

James

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP Syntax Help - Check?

2010-02-24 Thread James McLean
On Thu, Feb 25, 2010 at 4:22 PM, Rick Dwyer rpdw...@earthlink.net wrote:
 OK... external function... that would explain why I could not locate it.

 Let me get right to the problem I am having with this code as someone may be
 able to help directly.

 I have a link on a page that opens a contact form.  The link is
 mypage.php?my_id=5

 So on mypage.php, I capture this value with:
 $my_id=$_GET['my_id'];

 I understand this much.  But when the end user submits this contact form
 they do so to formcheck.php and if formcheck.php sees a required field is
 blank, it throws it back to mypage.php with an alert.  BUT, I lose the value
 of the variable $my_id.  SO, I created a hidden field on mypate.php with
  value=?php echo $my_id; ? and on formcheck.php, I added $my_id =
 $_Post['my_id'];

 However, when formcheck.php returns me to mypage.php, $my_id is still blank.

Use the right varialble for the method you're using, so if you're
posting, use $_POST, if you're getting use $_GET..

Going by your example, $_GET is what you should probably be using,
this is usually the default method if no method is specified on the
form tag.

Cheers

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread James McLean
On Fri, Feb 12, 2010 at 8:27 AM, Joseph Thayne webad...@thaynefam.org wrote:

 Actually, the syntax is just fine.  I personally would prefer it the way you
 mention, but there actually is nothing wrong with the syntax.

 The ,'$date1'. is not correct syntax, change it to ,'.$date.'

My personal preference these days is to use Curly braces around
variables in strings such as this, I always find excessive string
concatenation such as is often used when building SQL queries hard to
read, and IIRC there was performance implications to it as well
(though I don't have access to concrete stats right now).

In your case, the variable would be something like this:

$query=INSERT INTO upload_history (v_id,hour,visits,date) VALUES
({$v_id}, {$hour}, {$visits}, '{$date}');

Much more readable and maintainable IMO.

No need for the trailing semicolon in SQL that uses an API like you
are using so save another char there too.
Backticks around column names are not required and IMO again they just
make the code hard to read. Just because phpMyAdmin uses them, doesn't
mean we all need to.

Cheers

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread James McLean
On Fri, Feb 12, 2010 at 9:31 AM, Jochem Maas joc...@iamjochem.com wrote:
 Op 2/11/10 10:51 PM, James McLean schreef:
 My personal preference these days is to use Curly braces around
 variables in strings such as this, I always find excessive string
 concatenation such as is often used when building SQL queries hard to
 read, and IIRC there was performance implications to it as well
 (though I don't have access to concrete stats right now).

 In your case, the variable would be something like this:

 $query=INSERT INTO upload_history (v_id,hour,visits,date) VALUES
 ({$v_id}, {$hour}, {$visits}, '{$date}');

 actually IIRC the engine compiles that to OpCodes that equate to:

 $query = 'INSERT INTO upload_history (v_id,hour,visits,date) VALUES 
 ('.$v_id.', '.$hour.', '.$visits.', '\''.{$date}.'\')';

Interesting point, but the original code is still more readable, the
opcode's aren't our problem (at least in this case) :)

Cheers

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread James McLean
On Fri, Feb 12, 2010 at 9:31 AM, Joseph Thayne webad...@thaynefam.org wrote:
 As for the backticks, they are required because of MySQL, not because of
 phpMyAdmin.  The issue was not that phpMyAdmin uses backticks, it is that
 MySQL pretty much requires them when naming a field the same as an internal
 function to my knowledge.  If someone else knows of another way to designate
 to MySQL that a field named HOUR is the name of a field rather than the name
 of the internal function, I would love to know.

Ahh I see :) Wasn't aware of that. Personally i've always been
over-descriptive when designing my tables which is possibly why I've
never run into that limitation :)

Thanks.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP Manual problems

2010-02-09 Thread James McLean
On Wed, Feb 10, 2010 at 2:26 PM,  clanc...@cybec.com.au wrote:
 On Thu, 04 Feb 2010 02:39:03 +0100, joc...@iamjochem.com (Jochem Maas) wrote:
as for using IE6 ... WTF ... you do realise this is essentially a web 
developers mailing list right?

 The interesting things in my websites go on behind-the-scenes, in the PHP, 
 and produce
 relatively straightforward HTML. I have avoided the well-known bugs in IE6, 
 and think my
 webpages display correctly on any of the modern browsers, but as Microsoft 
 delights in
 rearranging everything in every update, and making the features you need ever 
 harder to
 find, I stick to IE6 for my everyday work.

Wow. Ignoring the issue that IE6 will soon be EOL (finally), and
ignoring how bad it is at handling anything even remotely modern, your
workstation must be a haven for virii, spyware and malware... IE6 has
just about the worst security track record out there, at least on the
desktop anyway.

If you must have IE6 for whatever reason, stick it on Windows
installed on a VM and upgrade your main workstation browser to
something more recent. At least a VM can be backed up at a known-good
point and if^H^Hwhen it gets compromised it can be deleted easily and
replaced with your backup.

I'll make it easy for you: http://www.getfirefox.com :)

Cheers

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Owner or other; permissions for webpage users

2010-02-09 Thread James McLean
On Wed, Feb 10, 2010 at 2:51 PM,  clanc...@cybec.com.au wrote:
 I'm basically familiar with the UNIX permissions - 'owner', 'group', or 
 'other', but I
 have no real idea how these apply to webpage users under PHP. I know that if 
 I FTP to the
 server I am the owner, and I think that if I, or anyone else, opens one of my 
 webpages I
 am 'other'.

Almost right. It's UGO, User Group and Other.

When you view a PHP page, it's (usually) served by Apache, the process
will be owned by a user, usually 'apache'; who is also a member of a
group, usually 'apache'. On some systems these users/groups can be
'httpd', 'www-data' etc. When you or I look at a PHP file served from
Apache, there is no concept of users/groups/others outside those that
apply to the Apache process that served the data.

 However what I would like to do is assign certain users, who have logged in 
 through a
 security portal, to 'group', so that they (but not 'others') have permission 
 to write to
 data files on the site.

It's a seperate thing, because once again inside PHP there is no
concept of users/groups outside the Apache process itself. It would be
up to your PHP code to manage who has access to what, the files will
all be read from and written to disk by the Apache process.

HTH.

Cheers

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Do you use a public framework or roll your own?

2010-01-26 Thread James McLean
On Wed, Jan 27, 2010 at 10:47 AM, Daevid Vincent dae...@daevid.com wrote:

 I'm not looking to start a holy war here or re-hash the tired debate.
 I just want some hard cold numbers to look at.

 Do you use a public framework or roll your own?
 http://www.rapidpoll.net/8opnt1e

I have rolled my own in the past in the time before Zend Framework
(and others) and I was quite proud of it to be honest. It was MVC
based with PHPTal templates and I used a lot of concepts I learned
from a hardcore Java developer when building it. I tweaked and refined
it to a point where I was very very happy with its performance (I used
it for my performance benchmarking as part of my presentation on APC
at OSDC Sydney 2008) and was intending to roll it out to power a
commercial project of mine. Didn't happen as I planned, however I
still have the codebase. I wrote it when I was rather new to OOP so it
has undergone quite a bit of refactoring over time.

I may open source it now that I have no major plans for it, perhaps
someone may find the code useful in some way shape or form. Includes a
rather simple ORM that ties into APC with it's variable caching
abilities (I am aware of the limitations this provides now),
reasonably simple MVC concepts and the ability to run multiple
websites  domains from a single installation. Other basics are there
like XML reading etc etc.

In hindsight, it's a little clunky now. But I was proud of it and I
still am to a point :) Personally I believe any PHP developer who
wants to be taken seriously should have written thier own framework :)

I am actually planning another project, however it will use Zend
Framework as a base. No need to re-invent the wheel, again, as fun as
it would be :)

Cheers

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Do you use a public framework or roll your own?

2010-01-26 Thread James McLean
On Wed, Jan 27, 2010 at 4:50 PM, Michael Kubler mdk...@gmail.com wrote:
 I read somewhere (can't find the link at the moment) that there's probably
 2.5 frameworks per PHP developer.

There would be a lot of truth to that, I hacked up a smaller  simpler
PHP4-centric framework back in the days when it was supported
alongside PHP5 - but the webhost wouldn't move to PHP5. So i've
written at least 2 myself :) Weather they are any good is a totally
different matter of course :D

Cheers

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Site Moved From PHP4 to PHP5 Server - header, location no longer working

2010-01-06 Thread James McLean
On Thu, Jan 7, 2010 at 1:35 PM, Vernon Webb ver...@comp-wiz.com wrote:
 I move a number of sites from one server to another and one the one server we 
 had php4 and now we have php5 and since then my server seems to hang every 
 time there is a header, location redirect. Anyone have any ideas on how to 
 resolve this? Is there something I can easily change in the php.ini file that 
 will resolve this issue?

Off the top of my head it sounds like something is being output before
the header, which causes an error. If you also have error display
turned off, you will likely just see a white screen with no useful
information.

Make sure none of your includes have trailing whitespace or are trying
to print out information before the header itself.

Best bet is to turn on errors and log them, then you will see where
the output started if infact that is your issue.

Cheers

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP + ODBC

2009-12-14 Thread James McLean
On Tue, Dec 15, 2009 at 10:03 AM, Philip Thompson
philthath...@gmail.com wrote:
 My head hurts from hitting it on my desk all day, so I thought I'd turn to a 
 fresher set of eyes. The issue I'm having is getting PHP to connect ODBC. I 
 can get it to work using isql from the command line. Can you verify my 
 settings:

[snipped]

 I've tried the above DSNs and many other versions of it ad nauseum. The 
 specific error I'm getting is... [unixODBC][Driver Manager]Data source name 
 not found, and no default driver specified. I really have searched high and 
 low for a solution, but to no avail. Any thoughts?

Why not just use the built in MySQL libraries or PDO?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Emergency! Performance downloading big files

2009-12-01 Thread James McLean
On Wed, Dec 2, 2009 at 9:18 AM, Brian Dunning br...@briandunning.com wrote:
 This is a holiday-crunch emergency.

Aren't they all! :)

 It's WAY TOO SLOW. I can paste the URL into a browser and download even the 
 largest files quite quickly, but the PHP method bottlenecks and cannot keep 
 up.

Are you certain you also have the bandwidth to support it as well?

The suggestion from other users of off-loading the PDF downloading to
Apache (or another webserver) is a good idea also.

Cheers

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php htaccess logins and logouts

2009-11-26 Thread James McLean
On Fri, Nov 27, 2009 at 12:12 AM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:
 Hi all,

 I've got a site set up that is using an htaccess file to provide secure
 access to a directory. That is working fine. What I wondered was, is
 there a way to log out via PHP. As I understand it, the login mechanism
 is part of Apache, so I guess what I'm really asking is, is there a way
 that I can get Apache to end the 'session' that Apache has set up, using
 PHP?

 I'm sure I've seen cPanel do it, so I was wondering how easy this would
 be to do myself.

IIRC if you unset $_SERVER['PHP_AUTH_USER'] and
$_SERVER['PHP_AUTH_PW'] it will log you out.

Cheers.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How to call a vc++ dll from a HTML form

2009-11-17 Thread James McLean
On Wed, Nov 18, 2009 at 3:21 PM, Peter pet...@egrabber.com wrote:
 Thanks to All.

 I want to call a vc++ dll from a HTML form. The dll need to be triggered on
 a button click in the HTML form.

 I want to access the dll from the client end(javascrript) without using the
 server.

 Tell me whether its possible to call dll directly or through any interface ?

 Please provide me your valuable inputs to solve this issue.

What does this have to do with PHP?

Oh, and it's a bad idea. Don't do it...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Netbeans IDE 6.5

2009-10-29 Thread James McLean
On Thu, Oct 29, 2009 at 8:13 PM, John Black
s...@network-technologies.org wrote:
 James McLean wrote:

 I myself and I'm sure many others will agree that sticking to 'around'
 80 chars is best-practice, it's handy for those times when you need to
 fix code in an emergency in an 80 col terminal, among other reasons.
 Personally the 80 col marker (I set it to 78 cols actually) is one of
 the first things I enable in Eclipse PDT..

 I only use a character limit for email but I have a wide screen so write
 code to the edge of the screen.
 Updating code via a terminal connection is no problem either because vim
 will wrap long lines.
 So 80chars may have been a good idea a long time ago but I think that the
 rule is a bit outdated.

Personally I find wrapped vi/vim lines very annoying, hence why I
stick to short lines where possible :)

Cheers

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Netbeans IDE 6.5

2009-10-28 Thread James McLean
On Thu, Oct 29, 2009 at 4:05 AM, Skip Evans s...@bigskypenguin.com wrote:
 Now, if I can just get rid of that red line at the 80 column mark. I haven't
 bothered with 80 columns since I wrote assembly on a terminal connected to a
 PDP-11 in college.

I myself and I'm sure many others will agree that sticking to 'around'
80 chars is best-practice, it's handy for those times when you need to
fix code in an emergency in an 80 col terminal, among other reasons.
Personally the 80 col marker (I set it to 78 cols actually) is one of
the first things I enable in Eclipse PDT..

Zend would (mostly) agree:
http://framework.zend.com/manual/en/coding-standard.php-file-formatting.html

Cheers,

James

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] What would stop header(Location...) from working?

2009-10-27 Thread James McLean
On Wed, Oct 28, 2009 at 10:01 AM, tedd t...@sperling.com wrote:
 I just had a script stop following this statement:

   header(Location:users.php);

 It *was* working, but now instead of running users.php, it defaults to the
 parent script.

 When I place exit() after it, such as:

   header(Location:users.php);
   exit();

 The script simply exits. It does not continue to users.php -- BUT -- it did.

 What would stop this statement from working?

Any text output before the header() statement would stop it, this
includes spaces after closing ? in any included files before the
header() as well, not just text from echos or prints.

If you have errors hidden or disabled, then you would not see the
warning from header(), try it with all errors enabled.

Cheers,

James

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Converting tables into forms

2009-10-27 Thread James McLean
On Wed, Oct 28, 2009 at 2:37 PM, ben...@gmail.com ben...@gmail.com wrote:
 I am trying to take MySQL tables and use the table structure to create
 HTML/PHP forms in as few steps as possible for further development. I
 have a project that has hundreds of tables and requires hundreds of
 forms to be created and don't want to do so field by field by hand.

With a little coding, Zend_Form should do what you need.

http://framework.zend.com/manual/en/zend.form.html

Cheers,

James

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] security/deployment issue

2009-10-11 Thread James McLean
On Mon, Oct 12, 2009 at 4:06 PM, Augusto Flavio afla...@gmail.com wrote:
 i have a doubt about my security and deployment methods. Today i manage
 several projects and these projects are versioned with subversion. My
 environment is something like this:

 1. The developer make some update in the source code of a project. (from
 your IDE, generally netbeans)
 2. The developer commit the modifications to the subversion server after
 test it(sure).
 3. The project manager sync the files from the dev server to the prod
 server(using rsync).

Sounds mostly fine. I assume you have other testing going on before
deployment to production, though.

 Well, my questions are 2. All about the rsync:

 1. For each project we have a ssh user that is used to sync the files(source
 code) to the prod server. The problem that i see here is that for each
 project i need to have a ssh account to sync these files. This is not so
 cool because i need to have severals actived ssh accounts in my prod server.
 I'm thinking about the root account to do this work. Is this a good
 practice?

The root account is not a very good idea for this. You could create a
'service' account that is used exclusively for transferring the files
to the server. To allow this user access to the various source
directories you can use something like ACL's or perhaps even regular
UNIX file permissions may work if your needs aren't very complex.

 2. Does have some another way, more better than the rsync for this
 deployment issue?

Rsync should work fine, but personally I like to see exactly which
changes are being deployed especially when deploying to production.
While I realise this recommendation is not Open Source software, I
have found it to be an excellent piece of software for this task. I
use Beyond Compare which has the ability to connect over SFTP or SCP
as well as regular FTP. It allows you to 'diff' the files as you go
and view exact changes and you can transfer only the changes you want
or whole files if you choose to. I would not be surprised if an Open
Source equivalent exists.

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?

2009-06-22 Thread James McLean
On Tue, Jun 23, 2009 at 6:17 AM, Nathan Nobbequickshif...@gmail.com wrote:
 hmm, 2 other thoughts i have..

 . long shot, but do you have apc.php installed on a diff domain than the
 moodle app (not sure but i suspect apc.php only shows cached values for the
 domain in which its currently running (i know this is something eaccelerator
 does).

No. Same domain.

 . as a test, perhaps setup a simple test site, w/ 2 files, apc.php and one
 index.php file on this rhel box.  if things are working (index.php cached w/
 apc.php), it would seem something goofy is going on indside the moodle app.

The RHEL box works flawlessly, as has almost every other APC install
i've ever done. I simply used it as an example that Moodle likely
wasn't at fault, and I have since further proved this by grepping the
source - it isn't setting any of it's own apc filters as suggested
before.

On the APC install that is not working correctly, when I switch
between my info.php and apc.php files - the counter on the cached file
(apc.php) resets, and info.php is not cached. That was all outlined in
the original email.

I guess this is not a common issue, no one seems to have experienced it before..

Cheers

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Problems with APC, possible cache-corruption?

2009-06-21 Thread James McLean
(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?

2009-06-21 Thread James McLean
On Mon, Jun 22, 2009 at 9:40 AM, Nathan Nobbequickshif...@gmail.com wrote:
 On Sun, Jun 21, 2009 at 5:56 PM, James McLean james.mcl...@gmail.com
 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?

2009-06-21 Thread James McLean
On Mon, Jun 22, 2009 at 10:02 AM, Jonathan Tapicertapi...@gmail.com 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



[PHP] Re: Issues with APC, cache corruption?

2009-06-16 Thread James McLean
On Mon, Jun 15, 2009 at 9:42 AM, James McLeanjames.mcl...@gmail.com wrote:
 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.

As I have not had a response to my question yet, is there anyone who
may be able to shed some light on the issue?

Last night I also tried some different configure options when building
APC but with the same result..

Has anyone seen this behaviour before?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] counting code lines

2007-06-14 Thread James McLean

On 6/15/07, Toni Torello [EMAIL PROTECTED] wrote:

hi guys,
just supposing...

which is the right way to to count the number of code lines in a php
application?

do you think that the raw:
$ find . -name '*.php' -exec cat {} \; | wc -l
can be a good estimate?


I recently desired to know a similar estimate of the project I was
working on and came up with essentially the same thing, but automated
it slightly further to encompass other file types also, this is the
(perl) script I came up with for your interest:

#!/usr/bin/perl -w

my @types = qw(php css xml xhtml html js sql);

foreach my $type (@types) {
   print Lines in files of type: \t . $type . : ;
   my $command = find . -name *.$type -type f -exec cat {} + | wc -l;
   print `$command`;
}

Not perfect but it's not bad. Keep in mind it wont see what is a
comment and what isnt for example..

Cheers

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Printer funtions

2002-01-21 Thread James Mclean


All,

I have been reading through the php.net printer function pages, but from what I 
can see it does not look like the docs are that good. 

basically, I want to run through to see if any one has any pointers before 
using the PHP printers funtions. IE does printer_open() open a connection to 
the default printer specified on the client machine? The docs doent eben 
specify this...

The site mentions listing the printer in php.ini, but this is not possible in 
this instance, having to cater for printers that will be unknown to me.

any pointers helpful! TIA.

Regards,

James Mclean
Adam Internet Web Design Team

Windows didn't get as bad as it is overnight -- it took over ten years of 
careful development.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] IF Statements

2002-01-13 Thread James Mclean


Hi,


 My problem is working out how to evaluate this new part. I have normal
 If
 statements for the listing, adding, etc. But how can I get it to check
 if
 clientcode is present. If clientcode is not present I want it to load
 the
 list page as normal. But if the clientcode is present then it is to
 load
 something else.
 
 How do I structure my IF statement?

If i understand correctly, you need something like this...

$sql = select clientcode from table where clientcode='$var';
$qu = mysql_query($sql) or die(mysql_error());

if(mysql_num_rows($qu)=='0') {
//does not exist
} else {
//exists
//loop through records here.
}

hmmz might be wrong... just came back from a few weeks of holidays.

Regards,

James Mclean
Adam Internet Web Design Team

» [EMAIL PROTECTED] | www.adam.com.au «
» 199 Sturt St. | P: 8231 0303«
» Adelaide 5000 | F: 8231 0223«

Windows didn't get as bad as it is overnight -- it took over ten years of 
careful development.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] PHP Cron jobs

2001-01-26 Thread James Mclean


List,
i do not have access to the cron system on my server, but would like to
write a script that does some general housekeeping on my database, and various
other things like removing old users, sending some newsletters etc...
What would be the best way of getting the script to run on a timed basis,
ideally the times and frequency of the script running defined in either the
script its self, or another script.
The Sysadmin for the server is absolutly useless, so getting him to submit a
cron job is no good.
any ideas??

TIA

jamesmc


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Ultimate Editor

2001-01-18 Thread James Mclean

yes, but i preferr vim myself. bluefish has an excellent range of php functions
available though, it is fast as well and crashes not often


 Has anyone tried Bluefish for Linux?



  -Original Message-
  From: Michael A. Peters [mailto:[EMAIL PROTECTED]]
  Sent: January 18, 2001 7:02 PM
  To: Chris Aitken
  Cc: [EMAIL PROTECTED]
  Subject: Re: [PHP] Ultimate Editor
 
 
  look into nedit.
 
  It does very well on linux, and I hear there's a Windows port.
  I have a screenshot of nedit at http://24.5.29.77/nedit.jpeg
 
  nedit website is http://www.nedit.org/
 
  It doesn't have a publish directly to the web function, nor does
  it have a built in server- but I just use thttpd compiled with
  php support for that- and enable directory listings so I can
  browse my working directory and select the file i want to view in action.
 
  Publishing directly to the web is nice- and I may look into
  adding it to nedit (I'm planning to add some features- though I
  am NOT the maintainer) but i personally never liked all in one
  products. Maybe a button to interface with the scp already on the
  users system...
 
  On Thursday, January 18, 2001, at 04:10 PM, Chris Aitken wrote:
 
   At 06:47 PM 18/01/2001, you wrote:
  
   What I'd like an editor to do for me is help out with how the
  page looks.
   One I set up a page that looks half-way decent - even if I use stock
   templates or style sheets - I can always plop the code in
  later by hand and
   that's no biggie. It's just that initial setting up of tables
  and stuff that
   is kind of tedious and I want to get away from that so I can
  concentrate on
   the code.
  
  
   Personally, I would love to find an editor which had colour coded code
   ability, a nice windows cut/paste/undo/redo feature, much akin to say
   Homesite, but the most important thing would be that it can simulate a
   telnet connection (or any connection for that matter) to the
  web server im
   working on and use it just like the current editors
  view/use/display the
   local hard drive. When you save a file, it instantly saves it on the
   server. Ive seen some editors which have a supposed publish
  option but they
   are either very lame, or made by microsoft (nuff said).
  
   I like the ability to have a simple keystroke(s) to instantly
  update the
   file so I can reload it direct off the webserver and test it
  out. Infact, I
   didnt mind how nedit worked when I was running my FreeBSD box
  at home, but
   it too couldnt allow me to work on remote files live.
  
  
  
   Chris
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   To contact the list administrators, e-mail:
  [EMAIL PROTECTED]
  
  
 
  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  Michael A. Peters
  Abriasoft Senior Developer
 
  (510)  623-9726x357
  Fax: (510) 249-9125
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] mysql and php possibly causing problem

2001-01-09 Thread James Mclean


list,
ok her is the problem. i have a page taht works fine in one dir, but in a sub
dir, it doesnt even show up. here is my dir structure.
public_html/|
|website/|
||index.php
||admin/|
||  |admin.php
||  |

now what happens, is if the file admin.php is in the admin dir, all i get in
the browser is the tags htmlhead/head/html, but if i put the file
admin.php into the website dir, it works fine. please help!!

using php4.0b3, mysql 3.22.32 apache latest debian 2.2
please help!!

thanks
james mclean


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]