Flex production server problem

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Flex production server problem

dw1970
After developed a Flex application, I made the flex 4 production release to a
production server. In the development environment, the application has been
working fine under flash builder 4.6 and WAMP. After FTP the release build
to production server (running MYSQL5, PHP5 and Apache2) and execute the app,
I am able to see the first screen of my apps which proved can find the apps
in the prod server. But when the app is going fetch data from MYSQL, no data
returned.

I followed
https://community.adobe.com/t5/flash-builder/flex-and-zend-amf-deployment-resolved-with-proper-solution/td-p/4833253
to setup the amf_config.ini and gateway.php. I tested the endpoint by
executing http://mydomain/testprodserver/gateway.php in firefox and it
downloaded the gateway.php. When I opened this gateway.php file, I can see
<p>Zend Amf Endpoint</p> Therefore, I assume the zendframework that I
uploaded to the production is setup correctly. Also, I changed the service
php so that it pointed to the right username, password, server, port,
databasename and tablename as setup in the production server DB.

Very much appreciated if you can enlighten me with any possible solution to
this problem I have for many months. Without setting up a production
environment, I am unable to deliver the apps to users.

If needed, I can supply with the HostIP, Username and password so whoever
need to access that production server. Currently this server is empty except
for the simple apps that I developed to test the production server setup.



--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: Flex production server problem

Carlos Rovira-2
Hi,

if that is working locally but not in the server, probably there's some
localhost reference in the code.
I suggest you to use a tool like Charles Proxy [1] to see the traffic and
try to identify if packages are begin sent/received.
That proxy is capable to see AMF / RemoteObect data sent and received. You
need to find the point where things are failing.

HTH

Carlos





El mar., 10 dic. 2019 a las 7:28, dw1970 (<[hidden email]>) escribió:

> After developed a Flex application, I made the flex 4 production release
> to a
> production server. In the development environment, the application has been
> working fine under flash builder 4.6 and WAMP. After FTP the release build
> to production server (running MYSQL5, PHP5 and Apache2) and execute the
> app,
> I am able to see the first screen of my apps which proved can find the apps
> in the prod server. But when the app is going fetch data from MYSQL, no
> data
> returned.
>
> I followed
>
> https://community.adobe.com/t5/flash-builder/flex-and-zend-amf-deployment-resolved-with-proper-solution/td-p/4833253
> to setup the amf_config.ini and gateway.php. I tested the endpoint by
> executing http://mydomain/testprodserver/gateway.php in firefox and it
> downloaded the gateway.php. When I opened this gateway.php file, I can see
> <p>Zend Amf Endpoint</p> Therefore, I assume the zendframework that I
> uploaded to the production is setup correctly. Also, I changed the service
> php so that it pointed to the right username, password, server, port,
> databasename and tablename as setup in the production server DB.
>
> Very much appreciated if you can enlighten me with any possible solution to
> this problem I have for many months. Without setting up a production
> environment, I am unable to deliver the apps to users.
>
> If needed, I can supply with the HostIP, Username and password so whoever
> need to access that production server. Currently this server is empty
> except
> for the simple apps that I developed to test the production server setup.
>
>
>
> --
> Sent from: http://apache-flex-users.2333346.n4.nabble.com/
>


--
Carlos Rovira
http://about.me/carlosrovira
Reply | Threaded
Open this post in threaded view
|

Re: Flex production server problem

dw1970
Have used Charles 4.5.5 as advised. Recorded "Failed to parse data
(com.xk72.amf.AMFException: Unsupported AMF3 packet type 60 at 1)" as in
this image
<http://apache-flex-users.2333346.n4.nabble.com/file/t1290/2019-12-11_Charles01.png>
also, recorded "<br />
*Warning*:  is_readable(): open_basedir restriction in effect.
File(/opt/plesk/php/5.6/share/pear/http://www.bbrchk.com/Services/BookClub/LevelService.php)
is not within the allowed path(s): (/var/www/vhosts/bbrchk.com/:/tmp/) in
*/var/www/vhosts/bbrchk.com/httpdocs/testprodserver/ZendFramework/library/Zend/Loader.php*
on line *198*<br />" as in this image
<http://apache-flex-users.2333346.n4.nabble.com/file/t1290/2019-12-11_Charles02.png>

I don't have a clue how to fix it. The folder structure is built as in this
image.
<http://apache-flex-users.2333346.n4.nabble.com/file/t1290/2019-12-11_FileZilla01.png>

Can anyone help?



--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: Flex production server problem

Carlos Rovira-2
Hi,

If I understand correctly, you're having success to communicate with the
server. But something is wrong in the data exchanged.
I use Java/BlazeDS on server not PHP (last time for PHP was around 10 years
ago). So my advice is:

1.- try to reduce first use case to the simplest one. Start by sending just
a String and try to receive a response in the client
2.- if nobody here has PHP/AMF experience with Zend AMF try to search on
internet on some forum, or try to search for the error you got (Failed to
parse data....)

Maybe one problem could be something related to encoding or PHP versions,
don't know if Zend is currently maintained or the PHP version you're
running is not compatible with Zend AMF version.

You need to check and try from a simplest case until you find where could
be the problem. Is what I use to do in this kind of cases.

HTH

Carlos





El mié., 11 dic. 2019 a las 10:12, dw1970 (<[hidden email]>) escribió:

> Have used Charles 4.5.5 as advised. Recorded "Failed to parse data
> (com.xk72.amf.AMFException: Unsupported AMF3 packet type 60 at 1)" as in
> this image
> <
> http://apache-flex-users.2333346.n4.nabble.com/file/t1290/2019-12-11_Charles01.png>
>
> also, recorded "<br />
> *Warning*:  is_readable(): open_basedir restriction in effect.
> File(/opt/plesk/php/5.6/share/pear/
> http://www.bbrchk.com/Services/BookClub/LevelService.php)
> is not within the allowed path(s): (/var/www/vhosts/bbrchk.com/:/tmp/) in
> */var/www/vhosts/
> bbrchk.com/httpdocs/testprodserver/ZendFramework/library/Zend/Loader.php*
> on line *198*<br />" as in this image
> <
> http://apache-flex-users.2333346.n4.nabble.com/file/t1290/2019-12-11_Charles02.png>
>
>
> I don't have a clue how to fix it. The folder structure is built as in this
> image.
> <
> http://apache-flex-users.2333346.n4.nabble.com/file/t1290/2019-12-11_FileZilla01.png>
>
>
> Can anyone help?
>
>
>
> --
> Sent from: http://apache-flex-users.2333346.n4.nabble.com/
>


--
Carlos Rovira
http://about.me/carlosrovira
Reply | Threaded
Open this post in threaded view
|

Re: Flex production server problem

Javier Guerrero García
Hi:

Absolutely no idea of your setup, but according to your post:

File(/opt/plesk/php/5.6/share/pear/ ----> http://www.bbrchk.com <---- /
> Services/BookClub/LevelService.php
> <http://www.bbrchk.com/Services/BookClub/LevelService.php>)
>

Should that read as
"/opt/plesk/php/5.6/share/pear/Services/BookClub/LevelService.php", or at
least "/opt/plesk/php/5.6/share/pear/
bbrchk.com/Services/BookClub/LevelService.php"?

It looks like you are requesting the whole URI instead of the service
endpoint (or at least Loader.php is treating it as such for some reason)

On Wed, Dec 11, 2019 at 11:01 AM Carlos Rovira <[hidden email]>
wrote:

> Hi,
>
> If I understand correctly, you're having success to communicate with the
> server. But something is wrong in the data exchanged.
> I use Java/BlazeDS on server not PHP (last time for PHP was around 10 years
> ago). So my advice is:
>
> 1.- try to reduce first use case to the simplest one. Start by sending just
> a String and try to receive a response in the client
> 2.- if nobody here has PHP/AMF experience with Zend AMF try to search on
> internet on some forum, or try to search for the error you got (Failed to
> parse data....)
>
> Maybe one problem could be something related to encoding or PHP versions,
> don't know if Zend is currently maintained or the PHP version you're
> running is not compatible with Zend AMF version.
>
> You need to check and try from a simplest case until you find where could
> be the problem. Is what I use to do in this kind of cases.
>
> HTH
>
> Carlos
>
>
>
>
>
> El mié., 11 dic. 2019 a las 10:12, dw1970 (<[hidden email]>) escribió:
>
> > Have used Charles 4.5.5 as advised. Recorded "Failed to parse data
> > (com.xk72.amf.AMFException: Unsupported AMF3 packet type 60 at 1)" as in
> > this image
> > <
> >
> http://apache-flex-users.2333346.n4.nabble.com/file/t1290/2019-12-11_Charles01.png
> >
> >
> > also, recorded "<br />
> > *Warning*:  is_readable(): open_basedir restriction in effect.
> > File(/opt/plesk/php/5.6/share/pear/
> > http://www.bbrchk.com/Services/BookClub/LevelService.php)
> > is not within the allowed path(s): (/var/www/vhosts/bbrchk.com/:/tmp/)
> in
> > */var/www/vhosts/
> >
> bbrchk.com/httpdocs/testprodserver/ZendFramework/library/Zend/Loader.php*
> > on line *198*<br />" as in this image
> > <
> >
> http://apache-flex-users.2333346.n4.nabble.com/file/t1290/2019-12-11_Charles02.png
> >
> >
> >
> > I don't have a clue how to fix it. The folder structure is built as in
> this
> > image.
> > <
> >
> http://apache-flex-users.2333346.n4.nabble.com/file/t1290/2019-12-11_FileZilla01.png
> >
> >
> >
> > Can anyone help?
> >
> >
> >
> > --
> > Sent from: http://apache-flex-users.2333346.n4.nabble.com/
> >
>
>
> --
> Carlos Rovira
> http://about.me/carlosrovira
>
Reply | Threaded
Open this post in threaded view
|

Re: Flex production server problem

dw1970
Hi, Javier,

Good point, I have made changes in the amf_config.ini so that the webroot is
now
webroot =/var/www/vhosts/bbrchk.com/httpdocs

After the change and recorded it with Charles 4.5.5, I got a different
warning (seems like closer to fixing)
mysqli_connect(): (HY000/1045): Access denied for user 'dwu'@'localhost'
(using password: YES) in
*/var/www/vhosts/bbrchk.com/httpdocs/Services/BookClub/LevelService.php* on
line *44*<br />

<http://apache-flex-users.2333346.n4.nabble.com/file/t1290/2019-12-11_Charles03.png>

After checking cPanel of the database, I have a user dwu and a password of
say, Password88!
So, in the LevelService.php, I put in

class LevelService {

        var $username = "dwu";
        var $password = "Password88!";
        var $server = "localhost";
        var $port = "3306";
        var $databasename = "bookclub";
        var $tablename = "level";

        var $connection;

        /**
         * The constructor initializes the connection to database. Everytime a
request is
         * received by Zend AMF, an instance of the service class is created and
then the
         * requested method is invoked.
         */
        public function __construct() {
          $this->connection = mysqli_connect(
          $this->server,  
          $this->username,  
          $this->password,
          $this->databasename,
          $this->port
          );

So, when I run http://www.bbrchk.com/testprodserver/TestProdServer.html I
got this warning
mysqli_connect(): (HY000/1045): Access denied for user 'dwu'@'localhost'
(using password: YES) in
*/var/www/vhosts/bbrchk.com/httpdocs/Services/BookClub/LevelService.php* on
line *44*<br />

I have search the internet and somebody said the password must be clear of
special characters to make this work. So I changed the password to
Password88 (get rid of the !), but cpanel will accept password without
special characters. I am stuck again with the problem.

Please help




--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: Flex production server problem

Javier Guerrero García
Hi!

Lucky guess, but still I have absolutely no idea of your setup or intents
;-)

Anyway, you have granted permissions to 'dwu'@'localhost' (meaning "dwu
accessing from localhost"), but IIRC you are trying to access it from
anywhere, right? Try granting permissions to 'dwu'@'%' (meaning "dwu
accesing from anywhere") to see if it changes anything.

https://stackoverflow.com/questions/11634084/are-users-user-and-userlocalhost-not-the-same

P.S. Dude, that's 101 on db permissions, are you sure you want to develop
this? ;-)

P.P.S. And another security concern: never, Never, EVER, post a password
again on a forum (another 101, just in case ;-)


On Wed, Dec 11, 2019 at 3:36 PM dw1970 <[hidden email]> wrote:

> Hi, Javier,
>
> Good point, I have made changes in the amf_config.ini so that the webroot
> is
> now
> webroot =/var/www/vhosts/bbrchk.com/httpdocs
>
> After the change and recorded it with Charles 4.5.5, I got a different
> warning (seems like closer to fixing)
> mysqli_connect(): (HY000/1045): Access denied for user 'dwu'@'localhost'
> (using password: YES) in
> */var/www/vhosts/bbrchk.com/httpdocs/Services/BookClub/LevelService.php*
> on
> line *44*<br />
>
> <
> http://apache-flex-users.2333346.n4.nabble.com/file/t1290/2019-12-11_Charles03.png>
>
>
> After checking cPanel of the database, I have a user dwu and a password of
> say, Password88!
> So, in the LevelService.php, I put in
>
> class LevelService {
>
>         var $username = "dwu";
>         var $password = "Password88!";
>         var $server = "localhost";
>         var $port = "3306";
>         var $databasename = "bookclub";
>         var $tablename = "level";
>
>         var $connection;
>
>         /**
>          * The constructor initializes the connection to database.
> Everytime a
> request is
>          * received by Zend AMF, an instance of the service class is
> created and
> then the
>          * requested method is invoked.
>          */
>         public function __construct() {
>                 $this->connection = mysqli_connect(
>
> $this->server,
>
> $this->username,
>
> $this->password,
>
> $this->databasename,
>                                                                 $this->port
>                                                         );
>
> So, when I run http://www.bbrchk.com/testprodserver/TestProdServer.html I
> got this warning
> mysqli_connect(): (HY000/1045): Access denied for user 'dwu'@'localhost'
> (using password: YES) in
> */var/www/vhosts/bbrchk.com/httpdocs/Services/BookClub/LevelService.php*
> on
> line *44*<br />
>
> I have search the internet and somebody said the password must be clear of
> special characters to make this work. So I changed the password to
> Password88 (get rid of the !), but cpanel will accept password without
> special characters. I am stuck again with the problem.
>
> Please help
>
>
>
>
> --
> Sent from: http://apache-flex-users.2333346.n4.nabble.com/
>
Reply | Threaded
Open this post in threaded view
|

Re: Flex production server problem

dw1970
Hi, Javier,
Let me give a briefly describe what I want to achieve. I developed a simple
app called testprodserver using Flex builder 4.6, WAMP. The purpose of
developing this is to make sure the production server is setup probably with
ZendFramework, a DB called bookclub with only one table called level, a
services called LevelService.php. The app will retrieve the data and and
display them into a datagrid. Once I can see the datagrid filled with all
rows stored in table level, then I know the production server is setup OK.
The last step is to launch my real app developed for my users.

The app testprodserver has been tested OK in stand alone PC environment with
a WAMP installed. Therefore, I uploaded all the needed files to the
production server and they are stored in this file structure (see below)

httpdocs
   Services
         BookClub
               LevelService.php
   testprodserver
         ZendFramework (a folder)
         amf_config.ini
         gateway.php
         TestProdServer.html
         AND SOME OTHER FILES

In order to run the app probably, changes made to these files:
1. amf_config.ini
        webroot =/var/www/vhosts/bbrchk.com/httpdocs
        zend_path =./ZendFramework/library
        amf.production = true
        amf.directories[] = Services/BookClub
2. LevelService.php (stored under folder Services/BookClub)
        var $username = "dwu";
        var $password = "NotDiscloseHere";
        var $server = "localhost";
        var $port = "3306";
        var $databasename = "bookclub";
        var $tablename = "level";

After executing http://www.bbrchk.com/testprodserver/TestProdServer.html in
Chrome, I expect to see the datagrid filled with rows of data retrieved from
DB bookclub Table level (I have built 3 rows in table level in which they
can be viewed in the production server phpMyAdmin), but nothing came out
(see image).

<http://apache-flex-users.2333346.n4.nabble.com/file/t1290/2019-12-12_img01.png>

After tracking with Charles 4.5.5, got this warning
mysqli_connect(): (HY000/1045): Access denied for user 'dwu'@'localhost'
(using password: YES) in
*/var/www/vhosts/bbrchk.com/httpdocs/Services/BookClub/LevelService.php* on
line *44*<br /> (as posted in the last threaded message)

Next step, I will try to grant permission to 'dwu'@'%' and see what happen.

Thanks for suggesting this.

PS. the password I posted in the last message is not a real one. I would not
post real password. Thanks for bringing this up.



--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: Flex production server problem

dw1970
Instead of using localhost, use the exact IP address in LevelService.php,
everything works now.



--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: Flex production server problem

Olaf Krueger
In reply to this post by dw1970
Just another side note:

PHP 5.6 reached its end of live at Dec2018 [1].
Not sure if ZendAMF works with PHP7, but even if it works, it also has not
been supported for a long time.
So, you might ran into security issues...

Just to ensure that you aware of this ;-)

Olaf



[1] https://www.php.net/supported-versions.php



--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/