Starquest321
asked on
PHP Script
On a CENT OS box 7:
I have a script that when I run from the SSH works perfects...but running from a browser or cron does not work. I get the following error:
When i run my php page in Browser getting the following error ::
Warning: fopen(property.csv): failed to open stream: Permission denied in /var/www/html/*****/downlo ad.php on line 44
Unable to create property.csv ..
I run the same page in SSH :: Using Following command
php /var/www/html/*****/downlo ad.php
It run perfectly .. and created csv file.. But not working when i run this page in browser or cron
I have a script that when I run from the SSH works perfects...but running from a browser or cron does not work. I get the following error:
When i run my php page in Browser getting the following error ::
Warning: fopen(property.csv): failed to open stream: Permission denied in /var/www/html/*****/downlo
Unable to create property.csv ..
I run the same page in SSH :: Using Following command
php /var/www/html/*****/downlo
It run perfectly .. and created csv file.. But not working when i run this page in browser or cron
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
if all permissions are desired enter chmod filename/folder -R 777
where chmod is command to set permissions
filename/folder is desired object to set permissions on
-R sets permissions recursively (on all child objects / sub folders and files)
777 = permissions full read, write, and execute for current user, all users, and admin users
where chmod is command to set permissions
filename/folder is desired object to set permissions on
-R sets permissions recursively (on all child objects / sub folders and files)
777 = permissions full read, write, and execute for current user, all users, and admin users
ASKER
Radek Baranowski: I ran the user and this is the result I get:
ps -ef | grep httpd
root 1073 1 0 Sep13 ? 00:00:12 /usr/sbin/httpd -DFOREGROUND
apache 11236 1073 0 03:22 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 11256 1073 0 03:22 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 11257 1073 0 03:22 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 11258 1073 0 03:22 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 11259 1073 0 03:22 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 11272 1073 0 03:27 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 11274 1073 0 03:27 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 11275 1073 0 03:27 ? 00:00:01 /usr/sbin/httpd -DFOREGROUND
apache 11276 1073 0 03:27 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 11464 1073 0 03:58 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 11465 1073 0 03:58 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
root 12813 12782 0 12:11 pts/0 00:00:00 grep --color=auto httpd
In the folder. . . this is the permissions:
folder:
drwxrwxrwx. 2 root root 4096 Sep 15 03:58 rets
In the file:
-rwxrwxrwx. 1 root root 3412 Sep 15 04:33 download.php
ps -ef | grep httpd
root 1073 1 0 Sep13 ? 00:00:12 /usr/sbin/httpd -DFOREGROUND
apache 11236 1073 0 03:22 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 11256 1073 0 03:22 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 11257 1073 0 03:22 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 11258 1073 0 03:22 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 11259 1073 0 03:22 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 11272 1073 0 03:27 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 11274 1073 0 03:27 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 11275 1073 0 03:27 ? 00:00:01 /usr/sbin/httpd -DFOREGROUND
apache 11276 1073 0 03:27 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 11464 1073 0 03:58 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 11465 1073 0 03:58 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
root 12813 12782 0 12:11 pts/0 00:00:00 grep --color=auto httpd
In the folder. . . this is the permissions:
folder:
drwxrwxrwx. 2 root root 4096 Sep 15 03:58 rets
In the file:
-rwxrwxrwx. 1 root root 3412 Sep 15 04:33 download.php
ASKER
The simply issue: When I run the page in putty its runnign perfect. But in browser giving this error:
Warning: fopen(property_res.csv): failed to open stream: Permission denied in /var/www/html/application/ download.p hp on line 44
I have given all permissions to folder rets .. still no luck...
Warning: fopen(property_res.csv): failed to open stream: Permission denied in /var/www/html/application/
I have given all permissions to folder rets .. still no luck...
ASKER
09 * * * * root /var/www/html/applicationr ets/downlo ad.php
Tried a full path as well.
Tried a full path as well.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes . .using W+.
It will be an empty file and we will start writing to that file. If the file does not exist it will create.
It will be an empty file and we will start writing to that file. If the file does not exist it will create.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
even if I give user:: group as root I still have the same issue. Coult it be that first issue with htaccess?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The only logical question I have: Why would it work from SSH? That does not make sense. If the script is broken . . how will it allow itself to run from anywhere. . .
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I also don't believe the script is broken. It works fine. Right now I can make the owner :: group - root or apache....just stuck here. What to do?
Script works perfect when logged in as root and using SSH
Script works perfect when logged in as root and using SSH
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The trouble area:
echo "+ {$resource}:{$class}<br>\n ";
$file_name = strtolower("{$resource}_{$ class}.csv ");
$fh = fopen($file_name, "w+");
$maxrows = true;
$offset = 1;
$limit = 50;
$fields_order = array();
$i=1;
echo "+ {$resource}:{$class}<br>\n
$file_name = strtolower("{$resource}_{$
$fh = fopen($file_name, "w+");
$maxrows = true;
$offset = 1;
$limit = 50;
$fields_order = array();
$i=1;
ASKER
Warning: fopen(property.csv): failed to open stream: Permission denied in /var/www/html/application/ rets/downl oad.php on line 44
Array
Array
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Are these settings under php.ini?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
(1) What command steps in detail can I take to check for option 1.
(2) I have given the folder and file ALL permissions. So how is that possible?