Re: __autoload not work in cgi?
| From: | Sorin Badea | Date: | Wed, 27 Mar 2013 14:30:43 +0000 |
| Subject: | Re: __autoload not work in cgi? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-320699@lists.php.net to get a copy of this message | ||
Did you tried with spl_autoload_register ?
http://php.net/manual/en/function.spl-autoload-register.php
Kind regards,
Sorin!
On Wed, Mar 27, 2013 at 4:28 PM, Radek Krejča <radek.krejca@starnet.cz>wrote:
> Hello,
>
> I have installed lighttp with php support. It looks like, that function
> __autoload doesnt work in cgi mode (in the manual I only see, that it
> should not work in cli mode).
>
> I have this code fragment:
>
> function __autoload($class)
> {
> if(File_Exists(PATH_EXTRAS_CLASSES.$class.".php"))
> {
> require_once(PATH_EXTRAS_CLASSES.$class.".php");
> }
> }
> $CNeplatici = New CNeplatici();
>
> And I get message:
> 2013-03-27 15:21:14: (mod_fastcgi.c.2676) FastCGI-stderr: PHP Fatal error:
> Class 'CNeplatici' not found in
> /usr/local/www/data/sys/web/templates_p/neplatici.php on line 12
> (this code is working on other project, but on apache).
>
> And if I switch to:
>
> require_once(PATH_EXTRAS_CLASSES."CNeplatici.php");
> $CNeplatici = New CNeplatici();
> It works.
>
> I have this lighttp configuration:
>
> fastcgi.server = ( ".php" =>
> ( "php-local" =>
> (
> "socket" => "/tmp/php-fastcgi-1.socket",
> "bin-path" => "/usr/local/bin/php-cgi",
> "max-procs" => 1,
> "broken-scriptfilename" => "enable",
> )
> ),
> )
>
> This is cgi configuration not cli isnt it? I thing that autoload should
> work.
>
> Thank you
> Radek
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Badea Sorin (unu.sorin)
sorin.badea91@gmail.com
unu_sorin@yahoo.com
Pagina personala:
http://badeasorin.com