I have a cron job that runs a php file. Within the php file it requires another file. For other php files run by cron and I do the same require file, it works just file. I've changed permissions on all files involved to 777 (for testing) and the problem still occurs. When I execute the file from the command line, it runs just fine.
Why is the file not allowed permission for this 1 php file?
Here is the error I receive from the cron:
[Fri Mar 29 00:05:01 2013] [warn-phpd] mmap cache can't open /home/rpn/public_html/admin/admin_functions.php - Permission denied (pid 29776)
PHP Warning: require(/home/rpn/public_html/admin/admin_functions.php): failed to open stream: Permission denied in /home/rp/public_html/cron/cron-boxscores.php on line 6
Warning: require(/home/rpn/public_html/admin/admin_functions.php): failed to open stream: Permission denied in /home/rp/public_html/cron/cron-boxscores.php on line 6
PHP Fatal error: require(): Failed opening required '/home/rpn/public_html/admin/admin_functions.php' (include_path='.:/usr/lib/php:/usr/local/lib/php:/home/rp/php') in /home/rp/public_html/cron/cron-scrape-boxscores.php on line 6
Fatal error: require(): Failed opening required '/home/rpn/public_html/admin/admin_functions.php' (include_path='.:/usr/lib/php:/usr/local/lib/php:/home/rp/php') in /home/rp/public_html/cron/cron-boxscores.php on line 6
Here is line 6:
require('/home/rpn/public_html/admin/admin_functions.php');
Here is the directory showing the file and permissions settings:
root#host [/home/rpn/public_html/admin]# ls -l admin*
-rw-r--r-- 1 nobody nobody 19022 Mar 8 14:18 admin_functions.php
nobody:nobody is what Apache is set to run under.
Related
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
When I try to run my project, I am getting this error in terminal.
[Fri Mar 30 14:36:23 2018] PHP Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
[Fri Mar 30 14:36:23 2018] PHP Fatal error: Unknown: Failed opening required '/var/www/html/imporeexcel/public/server.php' (include_path='.:/usr/share/php') in Unknown on line 0
I confirmed the issue, it seems a bug in laravel 5.6.12 installer. It deletes the server.php upon the first artisan serve.
A temporary solution will be to create another project then copy that newly created server.php this will solve it.
EDIT:
If your anti-virus is avast, you need to add exception there, I have a response in GitHub that avast considers it as a threat.
Warning: require(/home/*******/public_html/wp-includes/load.php): failed to open stream: No such file or directory in /home/******/public_html/wp-settings.php on line 21
Fatal error: require(): Failed opening required '/home/****/public_html/wp-includes/load.php' (include_path='.:/opt/alt/php55/usr/share/pear:/opt/alt/php55/usr/share/php') in /home/******/public_html/wp-settings.php on line 21
Can't see anything of my site and can't login to wordpress panel
but i can access cpanel
last thing i was do edit RTL.css and i undo my edits
Try uploading "load.php" in binary transfer mode.
It could be also a permission problem:
All directories should be 755 or 750.
All files should be 644 or 640. Exception: wp-config.php
should be 440 or 400 to prevent other users on the server from
reading it.
I'm updating a symfony2 website, afeter each update in controller or twig file I run "php app/console cache:clear", the website stop working for 5 minutes then it works again. After un very little update, I cleared the cache and the site don't want to run anymore, I have 500 Internal Server Error, there are no entry in symfony's log file, but here what I found in php log :
[Thu Sep 24 08:10:05 2015] [error] [client 1.2.3.4] FastCGI: server "/run/fcgi-bin/www.mysite.com:80.fcgi" stderr: PHP message: PHP Warning: require_once(/var/www/mysite.com/app/cache/prod/jms_diextra/doctrine/EntityManager_5602df03afff5.php): failed to open stream: No such file or directory in /var/www/mysite.com/app/cache/prod/appProdProjectContainer.php on line 279
[Thu Sep 24 08:10:05 2015] [error] [client 1.2.3.4] FastCGI: server "/run/fcgi-bin/www.mysite.com:80.fcgi" stderr: PHP message: PHP Fatal error: require_once(): Failed opening required '/var/www/mysite.com/app/cache/prod/jms_diextra/doctrine/EntityManager_5602df03afff5.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/mysite.com/app/cache/prod/appProdProjectContainer.php on line 279
It seems to be entity issue, but I'm sure I have no entity updates. I even tried to roll back by uploading all original files but no way !
I don't understand :
why do I have to wait 5 minutes after each cache:clear ?
what does the log errors means ?
Thanks very much :)
It looks like a file permission problem on your cache directory (and/or your logs directory).
Try chmod -R 777 app/cache app/logs and tell us if you still have problems.
You can also check the umask trick in http://symfony.com/doc/current/book/installation.html#checking-symfony-application-configuration-and-setup that may help in your case.
I followed the instructions in URL posted by tchap.
I don't know why cache:clear throws the bug, but I tested this and it works :
manually delele the /app/cache/prod/ folder
run :
app/console cache:warmup
I have been working on a project that uses codeigninter. I worked on it in Windows 7 and it was fine but after I moved this project on Ubuntu to work on it there, It gives me this error in every page/controller/method that I try to access:
Warning: require_once(/opt/lampp/htdocs/TS_Project/system/core/CodeIgniter.php): failed to open stream: Permission denied in /opt/lampp/htdocs/TS_Project/index.php on line 202
Fatal error: require_once(): Failed opening required '/opt/lampp/htdocs/TS_Project/system/core/CodeIgniter.php' (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/TS_Project/index.php on line 202
The CodeIgniter.php file does exist, the path to it is correct and I am able to read and write in it ( I can open it in a text editor and modify it freely). I tried changing the file permission to it using the chmod command but nothing happens. Why is permission denied to the CodeIgniter.php file?
You need to change the permission of your TS_Project folder to 755.
You can do that by:
sudo chmod -R 755 /opt/lampp/htdocs/TS_Project