Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
My php program is working in linux environment but in browser not working ..its shows blank..i mean i make a php one program in /var/www/html folder. i run this program in command prompt its working properly eg.php /var/www/html/test.php but in browser its showing blank.
Hi
My php program is working in linux environment but in browser not working ..its shows blank..i mean i make a php one program in /var/www/html folder. i run this program in command prompt its working properly eg.php /var/www/html/test.php but in browser its showing blank.
pleas suggest me how can i solve this issue
Since you don't tell us ANYTHING (version/distro of Linux, show us your PHP code, tell us version of PHP, etc.), we have no idea. Short answer: you have a bug in your code.
Longer answer: look at your PHP logs and your Apache error logs. There is SOME error in your code, preventing a browser from displaying things.
What are the group and owner permissions of the script ?
If you are planning to use it with apache , you might have to change those too , unless I am horribly wrong.
The original permissions are correct. Apache uses a module to "run" php code and therefore all files in the document root folder should be world read only (644).
As stated you need to check the Apache log files for errors where depends on what distribution you are running ( could be /var/log/httpd).
You need to post your PHP script. It is possible the script will work from the command line but not from Apache.
I set the permission 777 , and owner and group is Apache
Is there a reason you're not answering any other questions? You were asked about the PHP log files, Apache log files, and to show us the script. Since you're invoking this with "php /var/www/html/test.php" and it's working, it's most probably *NOT* anything with permissions, and setting it to anything but 644 isn't a good idea.
What is the actual LINK you're putting in the web browser to get this to come up??
this is my php script, in command line its working properly.
Right; so again, you have ignored most of the questions asked:
Version/distro of Linux?
Version of PHP?
Have you checked the PHP and Apache error log files? What do they say?
And your entire script **DOES NOT** put anything on the screen...you've got nothing to actually display something in a web browser, so your code is doing exactly what it should. PHP works the same on any platform, so being new to Linux doesn't matter in this case. Are you also new to PHP??
In order for your script to work through your browser, you'll have to add the Apache user (wwwrun, apache, etc...can't tell you, since you won't tell us what version/distro of Linux you're using), to sudoers or to the wheel group. Which is an **INCREDIBLY BAD IDEA**, since you're going to be allowing a web-facing user root access to your system. Don't do that.
It would be far better to have an external shell-script that takes two command-line arguments, and in that shell script have the sudo command assume an elevated permission status. Set ONE USER up in sudoers to have access to ONLY that shell script, to mitigate any potential damage. Call it like:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.