Re: euphoria-mvc - app:run()
- Posted by jmduro Jan 07, 2021
- 827 views
First error: my Apache configuration missed module rewrite. After I corrected this failure I still had an error page (HTTP 404).
The .htaccess file disables PHPMyAdmin which is needed on my LAMP server. I got the same 404 error as with the EU script. However a PHP script in the document Root works (phpinfo.php).
I removed the .htaccess file, I put your Add CGI Handler instructions in a file named /etc/apache2/conf-available/eui4.1.conf, I enabled the configuration with sudo a2enconf eui4.1 and I reloaded Apache configuration with sudo systemctl reload apache2.
PHPMyAdmin works again but the browser just shows the script source code instead of executing it.
#!/usr/local/bin/eui include mvc/app.e include mvc/server.e include mvc/template.e include mvc/logger.e include std/map.e function index( object request ) object response = map:new() map:put( response, "title", "My First App" ) map:put( response, "message", "Hello, world!" ) return render_template( "index.html", response ) end function app:route( "/", "index" ) -- "/" is the URL path, "index" is the name of the route -- route() will find the matching routine automatically set_log_output({ "!debug.log" }) -- overwrite debug.log each time set_log_level( LOG_DEBUG ) --server:start("0.0.0.0", 8080) app:run()
Here is my /var/www/html directory:
8:/var/www/html$ ls -l total 20 -rw-r--r-- 1 www-data www-data 389 janv. 5 08:53 eu.cfg -rwxr-xr-x 1 www-data www-data 634 janv. 7 08:32 index.esp -rwxr-xr-x 1 labo labo 21 janv. 5 09:55 phpinfo.php drwxr-xr-x 13 www-data www-data 4096 janv. 6 09:50 phpmyadmin
eu.cfg contains:
[all] -d E64 -eudir /usr/local/euphoria-4.1.0-Linux-x64 -i /usr/local/euphoria-4.1.0-Linux-x64/include -i /opt/vnf_test_tool/euphoria-mvc/include [translate] -arch ix86_64 -gcc -con -com /usr/local/euphoria-4.1.0-Linux-x64 -lib-pic /usr/local/euphoria-4.1.0-Linux-x64/bin/euso.a -lib /usr/local/euphoria-4.1.0-Linux-x64/bin/eu.a [bind] -eub /usr/local/euphoria-4.1.0-Linux-x64/bin/eub
Jean-Marc