• hi all

    when I run this php file:

    <?php
    
    add_shortcode( 'python', 'embed_python' );
    
    function embed_python( $attributes )
    {
        $data = shortcode_atts(
            [
                'file' => 'hellow.py'
            ],
            $attributes
        );
    
        $handle = popen( __DIR__ . '/' . $data['file'], 'r' );
        $read = '';
    
        while ( ! feof( $handle ) )
        {
            $read .= fread( $handle, 2096 );
        }
    
        pclose( $handle );
    
        return $read;
    };
    embed_python('ddd');
    }

    and I get this exception:

    Warning: popen() has been disabled for security reasons in /storage/h10/305/1244305/public_html/wp-content/plugins/myfirstplugin/MyFirstPlugin.php on line 36

    Warning: feof() expects parameter 1 to be resource, null given in /storage/h10/305/1244305/public_html/wp-content/plugins/myfirstplugin/MyFirstPlugin.php on line 39

    Warning: fread() expects parameter 1 to be resource, null given in /storage/h10/305/1244305/public_html/wp-content/plugins/myfirstplugin/MyFirstPlugin.php on line 41

    I try to run a python script. any one do it ?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘proc_open php problem’ is closed to new replies.