exemplo feito em Delphi for PHP, quando publico não conecta com dados

03/05/2010

Boa tarde, 

seguem informações com respeito ao teste que estou fazendo.


Fiz este teste para que possa iniciar o curso "Crie uma loja virtual com o Delphi for PHP".
Se tiver alguma alternativa para sanar o problema acima, agradeço.

Atenciosamente,

Maurício.




As mensagens abaixo aparecem quando tento acessa o site de teste que estou desenvolvendo. Este site tenta acessar uma tabela no banco de dados. Warning: require_once(vcl/db.inc.php) [function.require-once]: failed to open stream: No such file or directory in /home/mcerquei/public_html/vcl/vcl.inc.php on line 145

Fatal error: require_once() [function.require]: Failed opening required 'vcl/db.inc.php' (include_path='home/mcerquei/public_html/vcl/') in /home/mcerquei/public_html/vcl/vcl.inc.php on line 145

 


Ao fim do texto, estão os códigos fontes de unit1.php e unit2.php. Unit1.php tem acesso a dados e não funciona, mostrando as mensagens acima.   Unit2.php não tem acesso a dados e é executada normalmente.   para acessá-las já publicadas, seguem links:   www.mcerqueira.pro.br/unit1.php   www.mcerqueira.pro.br/unit2.php     ----   A seguir, a tabela que a pagina tenta  conectar   segue script da tabela de cliente que a unit1.php tenta acessar.   CREATE TABLE `tblcliente` ( `cli_codigo` int(11) NOT NULL default '0', `cli_nome` varchar(50) default NULL, `cli_unidade` varchar(50) default NULL, `cli_endereco` varchar(50) default NULL, `cli_cidade` varchar(50) default NULL, `cli_bairro` varchar(30) default NULL, `cli_uf` char(2) default NULL, `cli_cep` char(1) default NULL, `cli_perfil` varchar(200) default NULL, `cli_missao` varchar(200) default NULL, `cli_historico` varchar(200) default NULL, `cli_reg_codigo` int(11) default NULL, `cli_datacadastro` datetime default NULL, `cli_datacancela` datetime default NULL, `cli_ativo` tinyint(4) default NULL, `cli_mantenedora` varchar(100) default NULL, PRIMARY KEY (`cli_codigo`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1;   ------     código fonte de unit1.php   <?php
require_once("vcl.inc.php");
set_include_path('home/') ;
       set_include_path('home/mcerquei/') ;
       set_include_path('home/mcerquei/public_html/') ;
       set_include_path('home/mcerquei/public_html/vcl/') ;
//require_once("home/mcerquei/public_html/vcl/vcl.inc.php");
//Inclusões
use_unit("db.inc.php");
use_unit("dbtables.inc.php");
use_unit("mysql.inc.php");
use_unit("forms.inc.php");
use_unit("extctrls.inc.php");
use_unit("stdctrls.inc.php"); //Definição de classe
class Unit1 extends Page
{
       public $Button4 = null;
       public $Button3 = null;
       public $Button1 = null;
       public $edtuser = null;
       public $edtuserpassword = null;
       public $edthost = null;
       public $edtdatabase = null;
       public $Datasource1 = null;
       public $MySQLTable1 = null;
       public $Button2 = null;
       public $MySQLDatabase1 = null;
       public $Edit1 = null;
       function Unit1Show($sender, $params)
       {
        set_include_path('home/') ;
       set_include_path('home/mcerquei/') ;
       set_include_path('home/mcerquei/public_html/') ;
       set_include_path('home/mcerquei/public_html/vcl/') ;
       //set_include_path('home/mcerquei/public_html/vcl/') ;
      // set_include_path('home/mcerquei/public_html/vcl/') ;        echo 'se nao apareceu erro entao procedeu-se o set_include_path';
       }        function Unit1Create($sender, $params)
       {        set_include_path('home/') ;
       set_include_path('home/mcerquei/') ;
       set_include_path('home/mcerquei/public_html/') ;
       set_include_path('home/mcerquei/public_html/vcl/') ;
       //set_include_path('home/mcerquei/public_html/vcl/') ;
      // set_include_path('home/mcerquei/public_html/vcl/') ;          }        function Button4Click($sender, $params)
       {
       set_include_path('c:/teste/') ;
       }        function Button3Click($sender, $params)
       {
               //Defines the PATH where the VCL resides
        $fs_path=relativePath(realpath(dirname(__FILE__)),dirname(realpath($scriptfilename)));
        $http_path=$fs_path;         //If the vcl folder is not a subfolder of the VCL, then it uses vcl-bin as an alias to find the assets
        if (substr($fs_path,0,2)=='..')
        {
            if (!array_key_exists('FOR_PREVIEW',$_SERVER)) $http_path='/vcl-bin';
        }         /**
         * Filesystem path to the VCL
         *
         */
        define('VCL_FS_PATH',$fs_path);         echo 'variavel __file__ -> '.__FILE__;
        echo '<br>';
        echo 'variavel $fs_path  -> '.$fs_path;
        echo '<br>';
        echo 'VCL_FS_PATH';
        echo '<br>';
        echo relativePath($fs_path,$fs_path,'/');
       }        function Button2Click($sender, $params)
       {
       $this->MySQLDatabase1->Connected = false;
       $this->MySQLDatabase1->UserPassword = '';        $this->MySQLDatabase1->Host = $this->edthost->Text;
       $this->MySQLDatabase1->DatabaseName = $this->edtdatabase->Text;
       $this->MySQLDatabase1->UserName = $this->edtuser->Text;
       $this->MySQLDatabase1->UserPassword = $this->edtuserpassword->Text;        $this->MySQLDatabase1->Connected = true;        if ($this->MySQLDatabase1->Connected = true) {
       echo 'conectou sem senha';        $this->MySQLTable1->Active = false;
       $this->MySQLTable1->TableName = 'tblcliente';
       $this->MySQLTable1->Active = true;
       $this->MySQLTable1->first();        echo 'atualizar o edit com o primeiro cliente';        $this->Edit1->DataSource = $this->Datasource1;
       $this->Edit1->DataField = 'cli_nome';
       }
       else
       {
       echo 'nao conectou sem senha';
       }        }        function Button1Click($sender, $params)
       {
       $this->Database1->Connected = false;
       $this->Database1->UserPassword = '';
       $this->Database1->Connected = true;        if ($this->MySQLDatabase1->Connected) {
       echo 'conectou sem senha';
       }
       else
       {
      echo 'nao conectou sem senha';        echo 'agora vamos para com senha';        $this->Database1->Connected = false;
       $this->Database1->UserPassword = $this->edtuserpassword->Text;
       $this->Database1->Connected = true;        if ($this->Database1->Connected = true) {
       echo 'conectou com senha';          }
       else
       {
       echo 'nao conectou com senha';
       }
       }  
       } } global $application; global $Unit1; //Cria o formulário
$Unit1=new Unit1($application); //Ler do arquivo de recursos
$Unit1->loadResource(__FILE__); //Mostrar o formulário
$Unit1->show(); ?>     ----   código fonte de unit2.php   <?php
require_once("vcl.inc.php");
//Inclusões
use_unit("forms.inc.php");
use_unit("extctrls.inc.php");
use_unit("stdctrls.inc.php"); //Definição de classe
class Unit2 extends Page
{
       public $Label1 = null;
       public $Button4 = null;
       public $Button3 = null;
       function Unit2Create($sender, $params)
       {
       set_include_path('home/mcerquei/public_html/vcl/') ;
       set_include_path('/vcl/') ;        }        function Button4Click($sender, $params)
       {        //Defines the PATH where the VCL resides
        $fs_path=relativePath(realpath(dirname(__FILE__)),dirname(realpath($scriptfilename)));
        echo '<br>';
        echo 'pasta atual : '.$fs_path;
        $http_path=$fs_path;
        echo '<br>';
        echo 'pasta atual : '.$http_path;         //If the vcl folder is not a subfolder of the VCL, then it uses vcl-bin as an alias to find the assets
        if (substr($fs_path,0,2)=='..')
        {
            if (!array_key_exists('FOR_PREVIEW',$_SERVER)) $http_path='/vcl-bin';
        }         /**
         * Filesystem path to the VCL
         *
         */
        define('VCL_FS_PATH',$fs_path);
        /**
         * Webserver path to the VCL
         *
         */
        define('VCL_HTTP_PATH',$http_path);        }        function Button3Click($sender, $params)
       {
                     //Defines the PATH where the VCL resides
        $fs_path=relativePath(realpath(dirname(__FILE__)),dirname(realpath($scriptfilename)));
        $http_path=$fs_path;         //If the vcl folder is not a subfolder of the VCL, then it uses vcl-bin as an alias to find the assets
        if (substr($fs_path,0,2)=='..')
        {
            if (!array_key_exists('FOR_PREVIEW',$_SERVER)) $http_path='/vcl-bin';
        }         /**
         * Filesystem path to the VCL
         *
         */
        define('VCL_FS_PATH',$fs_path);         echo 'variavel __file__ : arquivo em uso no momento : -> '.__FILE__;
        echo '<br>';
        echo 'variavel $fs_path : pasta do arquivo em uso no momento : -> '.$fs_path;
        echo '<br>';
        echo 'diretorio onde se encontra a vcl : '.VCL_FS_PATH;
        echo '<br>';
        echo relativePath($fs_path,$fs_path,'/');
       } } global $application; global $Unit2; //Cria o formulário
$Unit2=new Unit2($application); //Ler do arquivo de recursos
$Unit2->loadResource(__FILE__); //Mostrar o formulário
$Unit2->show(); ?>
Mauricio Cerqueira

Mauricio Cerqueira

Curtidas 0

Respostas

Rodrigo Mourão

Rodrigo Mourão

03/05/2010

Olá Amigo,

Isso ocorre normalmente quando os arquivos necessários não foram completamente enviados para o FTP do seu site.

Se você utilizou o Deploymet Wizard então provavelmente seja isso, ele nem sempre pega tudo o que você precisa então meu conselho é subir toda a pasta VCL com exceção da pasta Samples.  Isso você fará apenas um unica vez.

Até porque hoje vc esta usando alguns arquivos no seu projeto so de adicionar mais um componente já terá necessidade de rodar o deploy novamente. Enviando todo o conteudo da VCL nao tera este problema.

Att,
GOSTEI 0
Rodrigo Mourão

Rodrigo Mourão

03/05/2010

Olá Amigo,

Podemos ajuda em algo mais ???

Att,

GOSTEI 0
Rodrigo Mourão

Rodrigo Mourão

03/05/2010

Olá amigo,

Estaremos colocando o chamado como concluido.
Caso tenha mais alguma dúvida poderá reabrí-lo que voltaremos a atendê-lo.

Att,

GOSTEI 0
POSTAR