WebFaction
Community site: login faq

I have Selenium working with Phantomjs on WebFaction, BUT...only on the SSH/CLI. What I really want to do is run a Python script from PHP and get the resultant output.

When I use SSH command 'python myscript.py' it works properly.

When I run the PHP (which calls the python file using the exec method)in SSH 'php myphpfile.php' it also works properly.

However, when I try to run the php file in a browser (using the exec method) it quickly returns a blank page.

I have another php file using the exec method to call a python file on WebFaction which works seamlessly. The difference is that this one does not use selenium (it uses Mechanize and BeautifulSoup). I have tried for hours to resolve this. Obviously there is some kind of problem between apache/and selenium but not apache and Mechanize et al.

I guess more simply its that python is ok, but js is not since the browser access through php exec is fine when using python scripts.

I did read that via the web apache launches a process that has PHP in it. via command line there is no apache process. That's why I am traveling down that line....???

Still does not explain why I have success with php exec when there is no selenium/phantomjs involved. Any ideas/suggestions/fixes?

I do not have root access on SSH with my account

asked 26 Apr '16, 02:24

maries
113
accept rate: 0%

edited 26 Apr '16, 02:27


I did read that via the web apache launches a process that has PHP in it. via command line there is no apache process.

On our system, PHP is served via php-cgi - so, you'll see a process like "php55.cgi" while the request is being processed, but it won't persist beyond that.

Still does not explain why I have success with php exec when there is no selenium/phantomjs involved. Any ideas/suggestions/fixes?

Check the PHP error logs for your site for clues, You can find the log at ~/logs/frontend/error_sitename_php.log.

Hope that helps!

permanent link

answered 26 Apr '16, 17:40

seanf
12.2k31836
accept rate: 37%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×262
×223
×4
×1

question asked: 26 Apr '16, 02:24

question was seen: 1,862 times

last updated: 26 Apr '16, 17:40

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM