Php issue

Michale000

New Member
Hi
My Name is Mark, am New in linux environment ,i have one issue.

I created one php program i, it working properly in command line but in browser its showing error , its blank when i redirected url.


In this php program i passed some linux command.

can you please help me how to solve this issue
 


Michale000

New Member
Thanks for your reply.
Am running apache, os centos 7 , i set the permission also properly, in command line its working properly, suppose my program is located in /var/www/html, i run like this php /var/www/html/test.php..in command promat its working but in browser, like http://xyz.com/test.php.. its not working , its showing blank, other php webpage is working properly, in this php program i run some linux command also.


please help me how to solve this issue.

Tahnks
 

Rob

Administrator
Staff member
OK, great - you want to take a look in the error logs.. check out in /var/log/httpd/error.log

You can watch it live by doing tail -f /var/log/httpd/error.log. Also, you may have error logs in /var/www/ depending on how you have things set up.
 

Michale000

New Member
Thanks for your reply.
I got the following error

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

[sudo] password for apache: Sorry, try again.
[sudo] password for apache:
sh: /etc/postfix/sasl_passwd: Permission denied

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

[sudo] password for apache: sudo: 1 incorrect password attempt

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

[sudo] password for apache: Sorry, try again.
[sudo] password for apache:
Sorry, try again.
[sudo] password for apache:
sudo: 1 incorrect password attempt

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

[sudo] password for apache: sudo: 1 incorrect password attempt

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

[sudo] password for apache: Sorry, try again.
[sudo] password for apache:
Sorry, try again.
[sudo] password for apache:
sudo: 1 incorrect password attempt

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

[sudo] password for apache: sudo: 1 incorrect password attempt

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

[sudo] password for apache: Sorry, try again.
[sudo] password for apache:
Sorry, try again.
[sudo] password for apache:
sudo: 1 incorrect password attempt

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

[sudo] password for apache: sudo: 1 incorrect password attempt
 

Rob

Administrator
Staff member
These aren't what we're looking for.

Become root on the machine and run that tail command that I put in the previous post. The errors you posted are sudo errors when trying to become another user..
 

Rob

Administrator
Staff member
ok - we're looking for php/apache related errors..

so if you can use sudo to use systemctl, try this:
sudo tail -f /var/log/httpd/error.log

Then, hit your php script in a browser and watch the log.
 
i 've previously tried a few approaches with Linux and developing php programs. I've tried xampp in /opt installing LAMP . Now obviously when I booted up linux i was using Slackware as a user not root, so came across issues most peole probably do in that if xammp is in /opt as a normal user i didn't have chmod permissions then looked at all that tedious join the group etc. So i took a lateral thinking approach -what i do these days is develop using sqlite3 it doesn't need a sever . I So i just develop webs using for instance https://fatfreeframework.com/3.6/home using built in server. So if my development directory is say called f3 on my desktop i put php framework & sqlite in there & its just a case of :
$ cd Desktop
$ php -S http://localhost:3000 -t f3
then i open browser to url http://localhost:3000 & hey theres my web running.
The only wall i hit was when considering Laravel . Even wordpress you can use a sqlite prlugin for dev. Its not that difficult transfering the logic across to MySQl etc for production. Because everything is running on user desktop there is next to no chmod permissions. I recently zipped and uploaded live and my hosting automatically put dirs at 775 and individual files to 664
 

Staff online

Members online


Top