21 Replies Latest reply: Mar 30, 2013 3:39 PM by Abody Alkateb RSS

    Web Root Flash Builder 4.5 mobile + PHP

    dontripi

      hello everyone, i just want to know how to add the address of the web root when i do a flex mobile project, when i work locally in my server i put C:\xampp\htdocs, but when when i work remotelly how can i put this address.

       

      for example if mi server is 200.100.1.12, and my root URL is http://200.100.1.12, how can i write de web root for this server, please help me, i dont know if i have to configure something else in the server or what i need to do, pleas any answer will be welcome.

       


      Thanks

        • 1. Re: Web Root Flash Builder 4.5 mobile + PHP
          Log Home Community Member

          I've been searching everywhere for the answer to this myself.  I'm hosted on Register.com, with awesome PHP / MYSQL hosting that I pay for, and I can't access it through Flash Builder CS 4.5.  Someone help us confused developers?

          • 2. Re: Web Root Flash Builder 4.5 mobile + PHP
            Chriszzzzzzzzzzzz Community Member

            This problem has been going on for years, with hundereds of threads and still no one has come up with a solution. HEEEEEEELLLLLLLLLPPPPPPP!!!!!

             

            I have done everything asked of me ands still 'The selected web root folder does not exist.'

            • 3. Re: Web Root Flash Builder 4.5 mobile + PHP
              kokorito Community Member

              yeah, its not the easiest thing to work out. Took me a while

               

              when you connect to a service FB generates 2 classes, the service and a super class. You need to override the class, not the super (the super class gets regenerated so any changes will be lost)

              for instance I have a service called HypService, so in services.hypservices.HypService.as I repoint the endpoint, like this

               

              protected override function preInitializeService():void
                  {
                      super.preInitializeService();
                      // Initialization customization goes here
                      this._serviceControl.endpoint = "http://www.hyperiums.co.uk/services/gateway.php";
                  }

               

               

               

              next you will have to change the amf_config.ini file that FB generates, set the web root and amf.directories (and maybe the path to zend framework depending where it is)

               

               

              hope that helps

              • 4. Re: Web Root Flash Builder 4.5 mobile + PHP
                Chriszzzzzzzzzzzz Community Member

                Thanks for the reply. I have updated my Service.as like the example. The  amf_config.ini is fully updated and the Service.php but still no luck, it wont recognise the web root.

                Any other suggestions would be welcome

                • 5. Re: Web Root Flash Builder 4.5 mobile + PHP
                  kokorito Community Member

                  try pointing the browser at your gateway.php file

                   

                  if its configured properly then you should get <p>Zend Amf Endpoint</p>

                   

                   

                  the web root isnt just the url, you will need to get what the root actually is from the server provider or should show you on cpanel

                  • 6. Re: Web Root Flash Builder 4.5 mobile + PHP
                    kokorito Community Member

                    here is my ini file

                     

                    [zend]
                    webroot =/home/hyp/public_html


                    [zendamf]
                    amf.production = false
                    amf.directories[]=services

                     

                     

                     

                    note there is also a path to the zendframework, but I dont need it as its in the web root anyway

                    zend_path =/home/hyp/public_html/ZendFramework/library

                     

                    it depends on where you have installed your framework if you need to set it

                    • 7. Re: Web Root Flash Builder 4.5 mobile + PHP
                      Chriszzzzzzzzzzzz Community Member

                      Yes i get Zend Amf Endpoint from gateway.php in browser.

                      I am using the full web root from the service provider.

                       

                      so it looks like ths

                       

                      Web root: ...fullwebroot.../apps/

                       

                      Root URL: http://....co.uk/

                       

                      reply - The selected web root folder does not exist.

                      • 8. Re: Web Root Flash Builder 4.5 mobile + PHP
                        kokorito Community Member

                        thats a bit cryptic

                         

                        what do you mean by fullwebroot? Its NOT the url, its the path that the server directs the url to

                         

                        and why do you have /apps at the end, thats not the root

                         

                        if apps is where you have your classes then you set that in the amf.directories[] = apps

                        • 9. Re: Web Root Flash Builder 4.5 mobile + PHP
                          Chriszzzzzzzzzzzz Community Member

                          Yes im not using the url but the path i recieved from service provider. I have removed /apps (was subdirectory for project)

                           

                          [zendamf]

                          amf.production = false

                          amf.directories[] = apps/services

                           

                          which contains only the service.php file

                           

                          [zend]

                          webroot ="full path  (webroot) not url"

                           

                          still no luck

                          • 10. Re: Web Root Flash Builder 4.5 mobile + PHP
                            Log Home Community Member

                            I really can't connect to PHP / MYSQL in FB 4.5.

                             

                            Everything works perfect in Dreamweaver for years now.

                             

                            I think Adobe would much rather you buy a ColdFusion license.  CF gave me lots of problems too, especially with the new CF Builder, where plugins didn't work for me, like CFC Generator, on Mac OS X.  Generally disappointed in FB and CF Builder because none of the fun stuff that's supposed to make it easy works for me. 

                            • 11. Re: Web Root Flash Builder 4.5 mobile + PHP
                              kokorito Community Member

                              FB works fine with php

                              in fact Adobe funded Zend in including amf in the framework

                               

                              you just need to know how your server is configured, and you can hardly blame Adobe for that

                              • 12. Re: Web Root Flash Builder 4.5 mobile + PHP
                                Chriszzzzzzzzzzzz Community Member

                                Finally got it working on my test device. Follow all the steps above listed by kokorito. I left the web root as the development server and changed the root url to the hosted server, then it let me press ok without validating. It now runs on my test device. Still having problems loading images even though i changed the image urls, but its a step in the right direction. Thanks again kokorito

                                • 13. Re: Web Root Flash Builder 4.5 mobile + PHP
                                  davidflex Community Member

                                  Even though I spent a lot time, still my flex app on a mobile device cannot access to db on the remote server.

                                  I made changes on the following files. Can you point out what was wrong? Thanks

                                   

                                  .flexProperties file:

                                  serverRoot="/var/www/vhosts/mydomain.com/httpdocs/public" serverRootURL="http://mydomain.com"

                                   

                                  Web host's document root is /var/www/vhosts/mydomain.com/httpdocs/public

                                   

                                  MyService.as file:

                                      protected override function preInitializeService():void

                                      {

                                          super.preInitializeService();

                                          // Initialization customization goes here

                                            this._serviceControl.endpoint = "http://mydomain.com/gateway.php";

                                      }

                                  MyService.php
                                  class MyService
                                  {
                                      public $username = "root";
                                      public $password = "pwd_2";
                                      public $server = "xx.xx.xxx.xx";
                                      public $port = "3306";
                                      public $databasename = "testdrive_db";
                                      public $tablename = "mydb";
                                  ...
                                  }
                                  amf_config.ini
                                  webroot = "/var/www/vhosts/mobilemenu.info/httpdocs/public"
                                  ...
                                  zend_path ="/usr/local/php/ZendFramework-1.11.4-minimal/library"
                                  library ="/var/www/vhosts/mydomain.com/httpdocs/library"
                                  services ="/var/www/vhosts/mydomain.com/httpdocs/services"
                                  [zendamf]
                                  amf.directories[]=services
                                  gateway.php
                                  <?php
                                  ini_set("display_errors", 1);
                                  $dir = dirname(__FILE__);
                                  $webroot = $_SERVER['DOCUMENT_ROOT'];
                                  //Web Hosting Document Root: /var/www/vhosts/mydomain.com/httpdocs/public
                                  ...
                                  $zenddir = '/usr/local/php/ZendFramework-1.11.4-minimal/library';

                                  • 14. Re: Web Root Flash Builder 4.5 mobile + PHP
                                    kokorito Community Member

                                    you only need to change the amf_config.ini file

                                    just set the web root and the zend path


                                    the amf.directories[] is the folder that contains MyService.php, relative to the root

                                     

                                     

                                    I dont think you need services or library roots in the ini file. Just path to the zend library, path to the root, and then path from the root to the service class the gateway connects to.(amf.directories)

                                    You shouldnt need to mess with the generated gateway.php and I dont know what the .flexProperties file is,

                                     

                                    well thats what works for me. But I use FB standard and a seperate install of Eclipse for PHP. Maybe FB with PHP genaerates slightly different files

                                    /me shrugs

                                    • 15. Re: Web Root Flash Builder 4.5 mobile + PHP
                                      Chriszzzzzzzzzzzz Community Member

                                      Try pointing the webroot to your local harddrive in server settings;

                                       

                                      For example in project properties / flex server.

                                       

                                      Web root: C:\Users\Chris\Adobe Flash Builder 4.5

                                       

                                      Root URL: http://mydomain.co.uk/

                                       

                                      Myservice.php public server should point to sql

                                       

                                        public $server = "mydomain.co.uk.mysql";

                                       

                                      amf_config.ini

                                       

                                      Zend path should point to the ZendFramework/library directory on the remote server. if you leave ZendFramework/library at the root you wont have to put anything to do with zend.

                                       

                                      leave webroot as


                                      webroot = "/var/www/vhosts/mobilemenu.info/httpdocs/public"
                                      • 16. Re: Web Root Flash Builder 4.5 mobile + PHP
                                        davidflex Community Member

                                        Finally, I made it working. Thank you kokorito, Chriszzzzzzzzzzzz for your help.

                                         

                                        As Kokorito suggested, I don't have to/ shouldn't modify the gateway.php.

                                         

                                        In amf_config.ini,

                                        for webroot, I used the document root (or server root) provided by my web hosting company.

                                        ;webroot = "C:/Program Files/Zend/Apache2/htdocs"

                                        webroot = "/var/www/vhosts/mydomain.com/httpdocs/public"

                                         

                                        For zend path, I specified the path of zend library located in my web hosting server:

                                        zend_path ="/usr/local/php/ZendFramework-1.11.4-minimal/library"

                                         

                                        Gateway.php reads amf_config.ini and use zend_path, library and services defined here to make new paths:

                                        library ="/var/www/vhosts/mydomain.com/httpdocs/library"

                                        services ="/var/www/vhosts/mydomain.com/httpdocs/services"

                                         

                                        For amf directories, I used a full path such as:

                                        amf.directories[]=/var/www/vhosts/mydomain.com/httpdocs/services

                                         

                                        Finally, for the mysql server, I used localhost which my web hosting server points to, since gateway.php is runing on the server.

                                        public $server = "localhost";

                                        A different web hosting may use a different address.

                                         

                                        .flexProperties is a config file in Flash Builder 4.5 for PHP. I set such as

                                        serverRoot="/var/www/vhosts/mydomain.com/httpdocs/public" serverRootURL="http://mydomain.com"

                                        • 17. Re: Web Root Flash Builder 4.5 mobile + PHP
                                          roestigraben

                                          Happy to see that everybody has resolved their problems.

                                           

                                          Myself being still in front of this wall, I have a question with respect to the database itself.

                                           

                                          When I have created my database access in FB the first time with tye help of the Data Service wizards, I was of course on a localhost on my machine.

                                           

                                          The moment I want to run off a remote server, I did create the database there with the help of exported SQL files.

                                          Now, I still have to tell the application that my database has changed, possible user/passwords are different.

                                           

                                          When you guys were discussing your problems, it always turned around the gataway.php. amf.ini and the service class/Superclass files.

                                          But I think I need to customise my xxxService.as with mySQL database details of the production server.

                                           

                                          Is this correct?

                                           

                                          Or, can somebody explain me better the workflow of an application build on FlexBuilder, where I suppose to develop first the local version and then export it to the production server thru export release Build and some file tweaking as above

                                           

                                          many thanks

                                          Peter

                                          • 18. Re: Web Root Flash Builder 4.5 mobile + PHP
                                            kokorito Community Member

                                            I'm afraid I've never used the wizards so dont know how or what they do

                                             

                                            but you will have to duplicate the local server on the remote server including the database.

                                            The username/password will be different on the remote server, you'll need to change that. Presumably you have them in order to import the sql files.

                                            Easiest way I find to do that is have a php file or class containing database connection details. Import (require) this file in your scripts. You can set the local password for testing locally and the remote password on the remote server. That way the script imports the correct details depending on where its run from.

                                             

                                             

                                            wont help with the database password but I made a video that might explain the original question

                                             

                                            http://www.youtube.com/watch?v=P333JuiX-V8

                                            • 19. Re: Web Root Flash Builder 4.5 mobile + PHP
                                              Chriszzzzzzzzzzzz Community Member

                                              once you have changed server settings, amf_config.ini and other files as described above, your new database settings should be modified in the Service.php file in your services folder on remote server.

                                               

                                              it should read something like

                                               

                                              class MyService {
                                                var $username = "mydomain_co";
                                                var $password = "8hjg56hjsoi???...";
                                                var $server = "mydomain.co.uk.mysql";
                                                var $port = "3306";
                                                var $databasename = "mydomain_co"; 
                                               
                                                var $connection;
                                                public function __construct() {
                                                  $this->connection = mysqli_connect(
                                                                     $this->server, 
                                                                     $this->username, 
                                                                     $this->password,
                                                                     $this->databasename,
                                                                     $this->port
                                                                     );
                                                 
                                                  $this->throwExceptionOnError($this->connection);
                                                }

                                              • 20. Re: Web Root Flash Builder 4.5 mobile + PHP
                                                Abody Alkateb

                                                Hi
                                                I need your help ..I followed your steps but still have errors.

                                                when I try to connect the app by flash builder i get this message :
                                                java.io.IOException: Server returned HTTP response code: 500 for URL: http://rjcsm.com/TestMySQL/gateway.php

                                                 

                                                my app folder is under " TestMySQL" so i set the amf.directories[]=TestMySQL

                                                and the ZendFramework is installed as well on the server and i didn't change anything in gataway.php file

                                                so what's the problem ?

                                                 

                                                 

                                                My amf_config.ini file is like this :


                                                [zend]

                                                ;set the absolute location path of webroot directory, example:

                                                ;Windows: C:\apache\www

                                                ;MAC/UNIX: /user/apache/www

                                                webroot =/public_html

                                                 

                                                ;set the absolute location path of zend installation directory, example:

                                                ;Windows: C:\apache\PHPFrameworks\ZendFramework\library

                                                MAC/UNIX: /user/apache/PHPFrameworks/ZendFramework/library

                                                zend_path =public_html/ZendFramework/library

                                                 

                                                [zendamf]

                                                amf.production = false

                                                amf.directories[]=TestMySQL

                                                • 21. Re: Web Root Flash Builder 4.5 mobile + PHP
                                                  Abody Alkateb Community Member

                                                  Hi
                                                  I need your help ..I followed your steps but still have errors.

                                                  when I try to connect the app by flash builder i get this message :
                                                  java.io.IOException: Server returned HTTP response code: 500 for URL: http://rjcsm.com/TestMySQL/gateway.php

                                                   

                                                  my app folder is under " TestMySQL" so i set the amf.directories[]=TestMySQL

                                                  and the ZendFramework is installed as well on the server and i didn't change anything in gataway.php file

                                                  so what's the problem ?

                                                   

                                                   

                                                  My amf_config.ini file is like this :


                                                  [zend]

                                                  ;set the absolute location path of webroot directory, example:

                                                  ;Windows: C:\apache\www

                                                  ;MAC/UNIX: /user/apache/www

                                                  webroot =/public_html

                                                   

                                                  ;set the absolute location path of zend installation directory, example:

                                                  ;Windows: C:\apache\PHPFrameworks\ZendFramework\library

                                                  MAC/UNIX: /user/apache/PHPFrameworks/ZendFramework/library

                                                  zend_path =public_html/ZendFramework/library

                                                   

                                                  [zendamf]

                                                  amf.production = false

                                                  amf.directories[]=TestMySQL