Calling php with python subprocess.call generates php permissions errors - php

Trying to run php tests with python script.
Using codeception framework, which is successfully works when i'm executing it manually in terminal. But it generates permission issues when i'm trying to call it with subprocess.call like that
subprocess.call(['vendor/bin/codecept', 'run'])
Errors like
PHP Warning: require_once(/root/opt/testing/vendor/bin/autoload.php): failed to open stream: Permission denied in /root/opt/testing/vendor/bin/codecept on line 7
PHP Fatal error: require_once(): Failed opening required '/root/opt/testing/vendor/bin/autoload.php' (include_path='.:/usr/share/php') in /root/opt/testing/vendor/bin/codecept on line 7
Can't find the reason why. Changed all permissions to chmod a+x but still no results.
Looks like it definitely something with python.

Related

Cron Could not open input file when runs

I don't know about cron jobs and I am trying to set them in my cPanel, so I have 2 php files I am trying to run:
covid-19_data.php
And utilities.php
on cPanel I run:
/usr/local/bin/php -q -f /public_html/wp-content/themes/siteName/scripts/data/shared/utilities.php
And
/usr/local/bin/php /home/siteName/public_html/wp-content/themes/siteName/scripts/covid-19_data.php
But i keep receiving:
Could not open input file: /public_html/wp-content/themes/siteName/scripts/data/shared/utilities.php
And
Warning: include_once(../shared/utilities.php): failed to open stream: No such file or directory in /home1/siteName/public_html/wp-content/themes/siteName/scripts/covid-19_data.php on line 3
Warning: include_once(): Failed opening '../shared/utilities.php' for inclusion (include_path='.:/opt/php56/lib/php') in /home1/siteName/public_html/wp-content/themes/siteName/scripts/covid-19_data.php on line 3
Warning: chdir(): No such file or directory (errno 2) in /home1/siteName/public_html/wp-content/themes/siteName/scripts/covid-19_data.php on line 12
Fatal error: Call to undefined function downloadFile() in /home1/siteName/public_html/wp-content/themes/siteName/scripts/covid-19_data.php on line 16
I tried running utilities.php every minute and covid-19_data.php every two minutes but doesn't work.
When I need to make it work, I only manually run via the browser wwww... covid-19_data.php and works fine, I don't need to run utilities.php I only made it run to try if that was the issue.
It sounds like your host runs cron jobs as nobody, or some other user that does not have access to the files in your account. Try changing the permissions of covid-19_data.php to allow "other" to read/execute it:
chmod o+rx /home/siteName/public_html/wp-content/themes/siteName/scripts/covid-19_data.php

I can't execute php artisan serve on linux

Whenever i try to execute php artisan serve command i get this error
PHP Warning: require(/home/mehdi/laravelOrig/vendor/autoload.php):
failed to open stream: No such file or directory in
/home/mehdi/laravelOrig/artisan on line 18
PHP Fatal error: require(): Failed opening required
'/home/mehdi/laravelOrig/vendor/autoload.php'
(include_path='.:/usr/share/php') in /home/mehdi/laravelOrig/artisan
on line 18
I did try some answers i found on google and here but it still wont work , am I missing something ?
Thank you!
First of all install composer on your system and type following command.
1) goto your project directory from command line
2) composer update
3) php artisan serve.

Running PHPUnit on command line errors out

I run this on the command line: phpunit --version
I get the following errors:
PHP Warning: require_once(File/Iterator/Autoload.php): failed to open stream: No such file or directory in /usr/lib/php/pear/PHPUnit/Autoload.php on line 45
PHP Fatal error: require_once(): Failed opening required 'File/Iterator/Autoload.php' (include_path='.:/Users/dennismonsewicz/pear/share/pear:/usr/local/share/pear:/usr/lib/php/pear/PHPUnit') in /usr/lib/php/pear/PHPUnit/Autoload.php on line 45
Anyone else run into these issues? It is also causing me issues when I try to run my tests via the command line.
Ended being an issue with my include_path
This is my updated include path
include_path = ".:/php/includes:/usr/lib/php/pear"

PHP difference between terminal and browser

There is Neo4J installed on my Ubuntu and I'm running a test code. It's perfectly working when the code runs on terminal such as:
root#ekin-Inspiron-1090:/var/www# php neo.php
home: demolished
name: Arthur Dent
But when it comes to run on browser like localhost/neo.php, it gives fatal error and stops working.
Warning: require(phar://neo4jphp.phar): failed to open stream: operation failed in /var/www/neo.php on line 4 Fatal error: require(): Failed opening required 'phar://neo4jphp.phar' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/neo.php on line 4
I don't think it's really something with Neo4J or its PHP driver. What should be the reason?
edit: by the way, there are two php.ini files; i think one for apache and one for command line. I checked both of them and phar extension paths are the same. Also there are no include_path settings in both of them.
It's an authorization error. Apache runs under its own user, so you need to give apache user to access www folder.

Run Kohana framework+php script in linux command prompt

We have a ubuntu server where we dump our Kohana framework+php code & want to run it through cron job. But when we try it in command line it shows the following error:
root#andola-dev:~# php /var/www/realradius/index.php /var/www/realradius/system/core/Bootstrap.php
Warning: require(/root/system/core/Bootstrap.php): failed to open stream: No such file or directory in /var/www/realradius/index.php on line 139
Fatal error: require(): Failed opening required '/root/system/core/Bootstrap.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/realradius/index.php on line 139
Linux filesystems are case sensitive, windows ones are not. Bootstrap.php is usually lowercase. Try fixing that.

Categories