Implementing index.php that serves index.htmlArch Linux: Apache just isn't interpreting the index.php...

Why are notes ordered like they are on a piano?

Field Length Validation for Desktop Application which has maximum 1000 characters

Floor tile layout process?

Stark VS Thanos

I caught several of my students plagiarizing. Could it be my fault as a teacher?

Survey Confirmation - Emphasize the question or the answer?

Transfer over $10k

Map one pandas column using two dictionaries

Historically, were women trained for obligatory wars? Or did they serve some other military function?

Does the Darkness spell dispel the Color Spray and Flaming Sphere spells?

Why is Arya visibly scared in the library in S8E3?

Junior developer struggles: how to communicate with management?

Pressure to defend the relevance of one's area of mathematics

Why is the SNP putting so much emphasis on currency plans?

Was Unix ever a single-user OS?

How to reply this mail from potential PhD professor?

Short story about people living in a different time streams

How did Arya manage to disguise herself?

CRT Oscilloscope - part of the plot is missing

How to creep the reader out with what seems like a normal person?

What was the state of the German rail system in 1944?

Why do computer-science majors learn calculus?

Meaning of "individuandum"

Packet sniffer for MacOS Mojave and above



Implementing index.php that serves index.html


Arch Linux: Apache just isn't interpreting the index.php filesnginx php-fpm index.php doesn't loadindex.html is not working in apache document rootWhy thepiratebay.se showing the content of /var/www/index.html?nginx serves info.php but doesn't serve index.phpMy index.html not in DocumentRootWhy apache2 is rendering only index.htmlConfiguring Systemd to execute extra script after httpd start/restart using ExecStartPost setting not workingRunning Bash Script in a Browser Even with Apache Permissions SetIs plain text in index.html secure?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















I want a webpage to reflect a log file. I have a bash script that converts the log to html. Currently this runs periodically via crontab, which works, but obviously executions are redundant when the webpage isn't viewed. I'd like to implement a system so the bash script runs only called when the webpage is called.



I gather an index.php script along the lines:



<?php
$message=shell_exec(". /path/script.sh");
?>


.. should generate the index.html file ok. But is there an easy way to get index.php/Apache to serve that file to the client browser?










share|improve this question




















  • 1





    Why not use [a modified version of] your bash script as a CGI instead of a PHP proxy?

    – user86969
    Apr 30 '15 at 16:25


















0















I want a webpage to reflect a log file. I have a bash script that converts the log to html. Currently this runs periodically via crontab, which works, but obviously executions are redundant when the webpage isn't viewed. I'd like to implement a system so the bash script runs only called when the webpage is called.



I gather an index.php script along the lines:



<?php
$message=shell_exec(". /path/script.sh");
?>


.. should generate the index.html file ok. But is there an easy way to get index.php/Apache to serve that file to the client browser?










share|improve this question




















  • 1





    Why not use [a modified version of] your bash script as a CGI instead of a PHP proxy?

    – user86969
    Apr 30 '15 at 16:25














0












0








0








I want a webpage to reflect a log file. I have a bash script that converts the log to html. Currently this runs periodically via crontab, which works, but obviously executions are redundant when the webpage isn't viewed. I'd like to implement a system so the bash script runs only called when the webpage is called.



I gather an index.php script along the lines:



<?php
$message=shell_exec(". /path/script.sh");
?>


.. should generate the index.html file ok. But is there an easy way to get index.php/Apache to serve that file to the client browser?










share|improve this question
















I want a webpage to reflect a log file. I have a bash script that converts the log to html. Currently this runs periodically via crontab, which works, but obviously executions are redundant when the webpage isn't viewed. I'd like to implement a system so the bash script runs only called when the webpage is called.



I gather an index.php script along the lines:



<?php
$message=shell_exec(". /path/script.sh");
?>


.. should generate the index.html file ok. But is there an easy way to get index.php/Apache to serve that file to the client browser?







apache-httpd php






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 1 hour ago









Rui F Ribeiro

42.5k1485146




42.5k1485146










asked Apr 30 '15 at 16:03









geotheorygeotheory

167111




167111








  • 1





    Why not use [a modified version of] your bash script as a CGI instead of a PHP proxy?

    – user86969
    Apr 30 '15 at 16:25














  • 1





    Why not use [a modified version of] your bash script as a CGI instead of a PHP proxy?

    – user86969
    Apr 30 '15 at 16:25








1




1





Why not use [a modified version of] your bash script as a CGI instead of a PHP proxy?

– user86969
Apr 30 '15 at 16:25





Why not use [a modified version of] your bash script as a CGI instead of a PHP proxy?

– user86969
Apr 30 '15 at 16:25










3 Answers
3






active

oldest

votes


















1














I suppose you could use readfile to dump the file you've just created towards the browser. Alternatively, you could issue a 302 temporary redirect to index.html.






share|improve this answer































    0














    I gather the best solution is to end the php with:



    header('Location: index.html');
    exit;





    share|improve this answer































      0














      Another option:



      Create an .htaccess file in your web server root with the following:



      AddType application/x-httpd-php .htm .html


      Now apache will process .htm and .html files as php documents and any <?php ... ?> tags located in that file will be interpreted as php.






      share|improve this answer


























        Your Answer








        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "106"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: false,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: null,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f199669%2fimplementing-index-php-that-serves-index-html%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        1














        I suppose you could use readfile to dump the file you've just created towards the browser. Alternatively, you could issue a 302 temporary redirect to index.html.






        share|improve this answer




























          1














          I suppose you could use readfile to dump the file you've just created towards the browser. Alternatively, you could issue a 302 temporary redirect to index.html.






          share|improve this answer


























            1












            1








            1







            I suppose you could use readfile to dump the file you've just created towards the browser. Alternatively, you could issue a 302 temporary redirect to index.html.






            share|improve this answer













            I suppose you could use readfile to dump the file you've just created towards the browser. Alternatively, you could issue a 302 temporary redirect to index.html.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Apr 30 '15 at 16:22









            Ulrich SchwarzUlrich Schwarz

            10.2k13249




            10.2k13249

























                0














                I gather the best solution is to end the php with:



                header('Location: index.html');
                exit;





                share|improve this answer




























                  0














                  I gather the best solution is to end the php with:



                  header('Location: index.html');
                  exit;





                  share|improve this answer


























                    0












                    0








                    0







                    I gather the best solution is to end the php with:



                    header('Location: index.html');
                    exit;





                    share|improve this answer













                    I gather the best solution is to end the php with:



                    header('Location: index.html');
                    exit;






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered May 1 '15 at 11:50









                    geotheorygeotheory

                    167111




                    167111























                        0














                        Another option:



                        Create an .htaccess file in your web server root with the following:



                        AddType application/x-httpd-php .htm .html


                        Now apache will process .htm and .html files as php documents and any <?php ... ?> tags located in that file will be interpreted as php.






                        share|improve this answer






























                          0














                          Another option:



                          Create an .htaccess file in your web server root with the following:



                          AddType application/x-httpd-php .htm .html


                          Now apache will process .htm and .html files as php documents and any <?php ... ?> tags located in that file will be interpreted as php.






                          share|improve this answer




























                            0












                            0








                            0







                            Another option:



                            Create an .htaccess file in your web server root with the following:



                            AddType application/x-httpd-php .htm .html


                            Now apache will process .htm and .html files as php documents and any <?php ... ?> tags located in that file will be interpreted as php.






                            share|improve this answer















                            Another option:



                            Create an .htaccess file in your web server root with the following:



                            AddType application/x-httpd-php .htm .html


                            Now apache will process .htm and .html files as php documents and any <?php ... ?> tags located in that file will be interpreted as php.







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited May 1 '15 at 12:48

























                            answered May 1 '15 at 12:32









                            datUserdatUser

                            2,7491236




                            2,7491236






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Unix & Linux Stack Exchange!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f199669%2fimplementing-index-php-that-serves-index-html%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

                                Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

                                Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...