我有这个文件的PHP,我想在这个PHP运行文件python: 但文件php阻止,以及永远的页面加载
<?php
$result = shell_exec('1.py ');
echo "Hello world!";
?>
并且是我的代码1.py:
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
import time
driver = webdriver.Firefox()
driver.get('https://accounts.google.com/signin/v2/identifier?hl=en& continue=https%3A%2F%2Fmail.google.com%2Fmail&service=mail& flowName=GlifWebSignIn&flowEntry=AddSession')
time.sleep(1)
driver.find_element_by_id("identifierId").clear()
driver.find_element_by_id("identifierId").send_keys('mygmail@gmail.com')
driver.find_element_by_css_selector("span.RveJvd.snByac").click()
time.sleep(1)
driver.find_element_by_name("password").clear()
driver.find_element_by_name("password").send_keys('mypassword')
time.sleep(1)
driver.find_element_by_css_selector("span.RveJvd.snByac").click()
time.sleep(3)
a=driver.title
#aa= driver.page_source
if 'Inbox' in a :
print('login good')
else :
print('not login')
当我在localhost / 1.php中运行我的php文件时 在
中阻止$result = shell_exec('1.py ');
并且不要运行
echo "Hello world!";
答案 0 :(得分:0)
尝试并使用以下PHP:
<?php
Header("Content-Type: text/plain");
error_reporting(E_ALL);
print shell_exec('1.py');
?>
通过这种方式,您可以查看命令是否遇到其他问题。