May I ask can MTALAB code be run under Apache Server ?? If it can, can an example be shown for this ?

4 views (last 30 days)
May I ask can MTALAB code be run at the backend of Apache Server ?? If it can, can an example showing the step of setup be shown for this ??
  3 Comments
Tik Ho HUI
Tik Ho HUI on 3 Oct 2024
And should be the MATLAB .m program be placed under Apache Directory (C:\xampp\htdocs) or MATLAB directory ?
Umar
Umar on 3 Oct 2024

Hi @Tik Ho HUI ,

You asked a very good question. When you configure the MATLAB Web Server with Apache, the placement of your MATLAB .m files is crucial for successful execution and accessibility. Hope, you reviewed the documentation provided in the link. The best practice is to place your MATLAB .m files within the wsdemos directory located in your MATLAB installation path (e.g., $MATLAB/toolbox/webserver/wsdemos) because this makes sure that they are part of the web server's document root and can be accessed directly through HTTP requests. The Apache server's DocumentRoot should point to this wsdemos directory as well. According to setup instructions provided in the link, you will edit the httpd.conf file to set:

     DocumentRoot "D:/Applications/matlabr12/toolbox/webserver/wsdemos"

This configuration will allow Apache to serve files from this directory when accessed via a web browser.

So, now the question is , “Why Not XAMPP's htdocs?”

Placing your .m files in the XAMPP htdocs directory (e.g., C:\xampp\htdocs) is not recommended because:

*It may lead to confusion regarding file locations.

*The Apache configuration set up for MATLAB might not correctly point to this directory unless specifically adjusted. You would need to manage separate configurations for both environments, which complicates maintenance.

After ensuring that your .m files are in the correct location, you can access them via a web browser by navigating to http://localhost/<your_script_name> where your_script_name corresponds to your .m file name without the extension.

After setting up, it's crucial to test if everything works correctly by accessing one of the demos through your browser. If there are issues, check both Apache and MATLAB Web Server logs for error messages that could guide troubleshooting. Ensure that your web server is secured properly, especially if it’s exposed to external networks. Consider using firewalls and access controls.

Hope this helps.

Please let us know if you have any further questions.

Sign in to comment.

Answers (1)

Udit06
Udit06 on 3 Oct 2024

Products


Release

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!