-2

When I execute the code below in command line it runs fine:

C:\Users\Shraddha\book ticket\ex1 scrapy crawl bookmyshow

However it doesn't execute in PHP using exec():

exec("C:\Users\Shraddha\book ticket\ex1 scrapy crawl bookmyshow");
2
  • What does exec return to you? Commented Jun 7, 2016 at 18:12
  • It dosen't return any message @ Jon Stirling Commented Jun 7, 2016 at 18:21

1 Answer 1

0

You need to escape the blank characters in the path, otherwise they are interpreted as separator between multiple arguments. Also it is much safer to use the forward slash as folder separator as it is used in unixoid systems and the internet in general:

exec("C:/Users/Shraddha/book\ ticket/ex1\ scrapy\ crawl\ bookmyshow");

If you insist on MS-Windows style separators, then you have to escape them too:

exec("C:\\Users\\Shraddha\\book\ ticket\\ex1\ scrapy\ crawl\ bookmyshow");

Also you may prefer to use shell_exec() here to have a well defined and initialized environment for your command to be executed in.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.