php-general Digest 30 Mar 2011 22:46:04 -0000 Issue 7251

Topics (messages 312138 through 312145):

Re: Path question
        312138 by: Richard Quadling

Grasping class / controllers
        312139 by: Aleksandar Skodric
        312140 by: Ashley Sheridan
        312141 by: Aleksandar Skodric

Re: Slow sessions.
        312142 by: Rob Adams
        312145 by: Bostjan Skufca

Re: Permission Denied - Help Requested - Solved
        312143 by: Ethan Rosenberg

Session Variables - Error
        312144 by: Ethan Rosenberg

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
On 29 March 2011 19:41, D. Dante Lorenso <da...@lorenso.com> wrote:
> On 3/28/11 8:18 PM, Jack wrote:
>>
>> Hello All,
>> Is there a smarter way to do includes by setting up a path or something
>> where I don't have to include /home/domain.com/includes/include_file.php
>> Apparently my path is as shown above,  but I would prefer to just put in
>> /includes/include_file.php
>
> I wrote about this a long time ago ... perhaps it might help:
>
> http://www.dantescode.com/2007/10/10/evolution-of-php-coder-naming-classes/
>
> Talks about putting your functions into classes and using the autoloader to
> avoid putting include statements in your code.
>
> Might not help if you are loading content which is not just PHP
> functions/code, but if you haven't "evolved" this far yet, the read might
> help you out.
>
> -- Dante
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

The Zend Framework documentation has some notes regarding of
autoloading of resources.

http://framework.zend.com/manual/en/learning.autoloading.resources.html

You may find some mileage there.



-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

--- End Message ---
--- Begin Message ---
Hi all,

I am using Codeigniter framework, tho' I believe my question is more PHP related in general.

Problem I am having is following.

Codeigniter (CI) uses general class CI_Controller for all functions.
I have extended this controller with: abstract class CORE_Controller extends CI_Controller {...}.

Then, I also have a RESTFul library which is:
class Cpin2_rest {}

And, last one is Ion Auth library which states:
class Ion_auth {}

In the Ion auth, there (should be) is initialization of CI_Controller with:

$this->ci =& get_instance();

However, $this->ci inherits Cpin2_rest instead of CI_Controller (or CORE_Controller).

I really have no idea where have I made a mistake and can't get around this one :(

Any help is appreciated!

Thanks!
Aleks

--- End Message ---
--- Begin Message ---
"Aleksandar Skodric" <aleksan...@skodric.com> wrote:

>Hi all,
>
>I am using Codeigniter framework, tho' I believe my question is more
>PHP
>related in general.
>
>Problem I am having is following.
>
>Codeigniter (CI) uses general class CI_Controller for all functions.
>I have extended this controller with: abstract class CORE_Controller
>extends CI_Controller {...}.
>
>Then, I also have a RESTFul library which is:
>class Cpin2_rest {}
>
>And, last one is Ion Auth library which states:
>class Ion_auth {}
>
>In the Ion auth, there (should be) is initialization of CI_Controller
>with:
>
>$this->ci =& get_instance();
>
>However, $this->ci inherits Cpin2_rest instead of CI_Controller (or
>CORE_Controller).
>
>I really have no idea where have I made a mistake and can't get around
>this one :(
>
>Any help is appreciated!
>
>Thanks!
>Aleks
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


That's completely CodeIgniter, not php. The mvc framework layout is something 
used by many languages, but questions about the framework aren't questions you 
should ask of the language but the framework.


Thanks
Ash
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

--- End Message ---
--- Begin Message ---
Hi,

Yes indeed you are correct.
Found out that framework was loading libraries from array in specific order, whereby one overrules the next one.

Anyway, problem solved by rearranging the order of the array :)

Thanks anyway :)

On 03/30/2011 04:13 PM, Ashley Sheridan wrote:
"Aleksandar Skodric"<aleksan...@skodric.com>  wrote:

Hi all,

I am using Codeigniter framework, tho' I believe my question is more
PHP
related in general.

Problem I am having is following.

Codeigniter (CI) uses general class CI_Controller for all functions.
I have extended this controller with: abstract class CORE_Controller
extends CI_Controller {...}.

Then, I also have a RESTFul library which is:
class Cpin2_rest {}

And, last one is Ion Auth library which states:
class Ion_auth {}

In the Ion auth, there (should be) is initialization of CI_Controller
with:

$this->ci =&  get_instance();

However, $this->ci inherits Cpin2_rest instead of CI_Controller (or
CORE_Controller).

I really have no idea where have I made a mistake and can't get around
this one :(

Any help is appreciated!

Thanks!
Aleks

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

That's completely CodeIgniter, not php. The mvc framework layout is something 
used by many languages, but questions about the framework aren't questions you 
should ask of the language but the framework.


Thanks
Ash

--
With kind regards,

Aleksandar Skodric
aleksan...@skodric.com
+31652612685


--- End Message ---
--- Begin Message ---
On 3/28/2011 3:40 PM, Bostjan Skufca wrote:
Great, please report back if/when you discover the cause.

After searching for some information about the error messages I was getting on the file server, I found this:

http://www.spinics.net/lists/linux-nfs/msg14679.html

I ran 'server nfslock status', and it wasn't even running (rpcbind wasn't recognized as a service). So I started the nfslock service and it immediately fixed the problem. I checked the config, and the service wasn't set to start in level 3, so I turned that on. It's been running for over 24 hours now with no problems.

Thanks again Bostjan for the help. I don't think I could have narrowed down the problem without using the strace.

  -- Rob


--- End Message ---
--- Begin Message ---
Nice of you to post the resolution of your problem. Glad to hear it is fixed
now.

Take care,
b.


On 30 March 2011 17:46, Rob Adams <rad...@circlepix.com> wrote:

> On 3/28/2011 3:40 PM, Bostjan Skufca wrote:
>
>> Great, please report back if/when you discover the cause.
>>
>
> After searching for some information about the error messages I was getting
> on the file server, I found this:
>
> http://www.spinics.net/lists/linux-nfs/msg14679.html
>
> I ran 'server nfslock status', and it wasn't even running (rpcbind wasn't
> recognized as a service).  So I started the nfslock service and it
> immediately fixed the problem.  I checked the config, and the service wasn't
> set to start in level 3, so I turned that on.  It's been running for over 24
> hours now with no problems.
>
> Thanks again Bostjan for the help.  I don't think I could have narrowed
> down the problem without using the strace.
>
>  -- Rob
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
At 12:07 AM 3/30/2011, Adam Richardson wrote:
On Tue, Mar 29, 2011 at 8:21 PM, Ethan Rosenberg <eth...@earthlink.net>wrote:

> At 05:33 PM 3/29/2011, Adam Richardson wrote:
>
>> >
>> > Thanks.
>> >
>> > What do you see if you run this?   "Can't open or create file!"
>> >
>> > Ethan
>>
>>
>> OK,
>>
>> If you're running PHP as an Apache module, by default it won't have
>> permissions to write to the directory (this is by design to avoid security
>> issues.) You can do something like the following:
>>
>>
>>   1. Create a directory for writing files outside of your public directory
>>
>>   (let's call it "uploads".)
>>   2. Change the group associated with the directory to Apache:
>>
>>   sudo chgrp -R www-data /home/username/path/to/uploads
>>   3. Change the permissions on the directory so the group has write
>>
>>   permissions:
>>   sudo chmod -R 2775 /home/username/path/to/uploads
>>   4. Then try the script again.
>>
>>
>> See if that works.
>>
>> Adam
>>
>> --
>> Nephtali:  A simple, flexible, fast, and security-focused PHP framework
>> http://nephtaliproject.com
>>
> ++++++++++++
>
> Thanks -
>
> The directory is output_files, which is a subdirectory of /var/www
> I'm getting a message "invalid owner" on the command "chown Apache
> output_files".  Also with the -R option, and with apache as the owner, also
> with the chgrp.  All these commands are run as root..
>
>
> Help and advice please.
>
> Ethan
>
>
Hi Ethan,

I might be missing something.

Did you set up the user Apache? On a standard install for Debian (using
apt-get), apache is usually set up as the user/group www-data:
http://wiki.debian.org/Apache

<http://wiki.debian.org/Apache>The root user typically owns the /var/www
directory. I usually set up virtual hosts within one of the other accounts
and then change the group on a directory outside of the public directory
specifically set aside for uploads and run the commands I sent.

However, in the case of your example, I believe you can just run the 2
commands I sent on the /var/www/output_files directory and you should be
able to write the files.

sudo chgrp -R www-data /var/www/output_files
sudo chmod -R 2775 /var/www/output_files

Hope this helps, and sorry if I misunderstood something in your
configuration or troubleshooting.

Adam

--
Nephtali:  A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com

++++++++++++++++++++++++
Adam -

Thanks.

Works beautifully.

Ethan


--- End Message ---
--- Begin Message ---
Dear List -

Thanks for your help.

Here is another one.....

I cannot get my session variables to work. The program will print out a chess board and show the positions of the pieces after the move

Here are code snippets: The program is chess2.php


<?php  session_start();
error_reporting(1);
if (!isset($_SESSION['results'])){ //this always returns as not set.
print_r($_SESSION);
echo "starting";
$results = array(array("Br", "Bn", "Bb", "Bq", "Bk", "Bb", "Bn", "Br"),array("Bp", "Bp", "Bp", "Bp", "Bp", "Bp", "Bp", "Bp"), array("", "", "", "", "", "", "", ""),array("", "", "", "", "", "", "", ""),array("", "", "", "", "", "", "", ""), array("", "", "", "", "", "", "", ""),array("Wp", "Wp", "Wp", "Wp", "Wp", "Wp", "Wp", "Wp"), array("Wr", "Wn", "Wb", "Wq", "Wk", "Wb", "Wn", "Wr"));

$_SESSION['results'] = $results;
print_r($_SESSION);
}
else
{
         $results = $_SESSION['results'];
         echo "<br />starting values<br />";
         print_r($results);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
<body>
.
.
.
.
.
                <form method="post" action="chess2.php">
Move From<input type="text" name="move_from"></input><br /><br /> Move To <input type="text" name="move_to"></input><br /><br />
                <input type="submit" value="Enter Move"></input>
                </form>


<?php
print_r($_POST);

$from_before = '$'. $_POST[move_from];
echo"<br />";
echo "from_before = "; print_r($from_before);
echo"<br />";
$to = '$'. $_POST[move_to];
echo "to = $to";
//$to = $from;
$from = '' ;
echo"<br />";
echo "from after = $from";
echo"<br />";
echo "to after = $to";

$board = array //Correlation of input array [chessboard] with internal array [results]
(
                a8 => $results[0][0],
                b8 => $results[0][1],
                c8 => $results[0][2],
                d8 => $results[0][3],
                e8 => $results[0][4],
                f8 => $results[0][5],
                .
                .
                .
                .
                f1 => $results[7][5],
                g1 => $results[7][6],
                h1 => $results[7][7],
        );
                for($i = 0; $i <8; $i++) //  I get the correct results here
                {
for ($j = 0; $j < 8; $j++)
                        printf("%s ", $results[$i][$j]);
                        printf("<br />");
                }
                $_SESSION['results'] = $results;

</body></html>

Ethan


--- End Message ---

Reply via email to