display errors function is not showing php - linux

I have server on centos system. Has php 7.4, apache version and also laravel project on it. And when i go to my site it gives me blank page. So i think it can't to show php error codes. I need your help.

Although your question lacks adequate information, you can achieve what you desire in two ways.
Via php.ini file
open your php.ini file and look for this line:
display_errors = off and change it to display_errors = on
Via your php file
In your php file just add these lines to the top:
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

Please share some more details of what you actually want to do so i can help you out ...

Related

Why PhpStorm doesn't using htaccess file?

I have an .htaccess file for page redirecting. It works fine in wampserver, but in phpstorm, it doesn't work and phpstorm doesn't use .htaccess.
For example, this works in wampserver:
localhost/Example/Page
This doesn't work in phpstorm:
localhost:63342/Example/Page
// 404 Not Found
Any thoughts on this problem?
.htaccess is used by the Apache webserver. It's not used by the PHPStorm web-browser though. If you want to be able to use it there, you would want to setup the 'Web path for project root' and point it to the appropriate location, as set in an Apache vhost.

remove open_basedir restriction

I am running a script and i am getting the following error:
WARNING: is_readable() [function.is-readable]: open_basedir restriction in effect. File(/usr/share/php/Am/View/Helper/HeadScript.php) is not within the allowed path(s): (/home/1205915141/members-net/:/tmp:/usr/share/pear/) in line 198 of file /home/1205915141/members-net/public_html/library/Zend/Loader.php
I asked my host to remove the restriction but they said they wont because of security reasons. So resolved to do it my self by overriding the php.ini with an htaccess like this:
php_value open_basedir /usr/share/php/
but it wont work. Im not sure what is exactly the problem, whether the syntax or the path. Could you please give me a hand?
Thank you.
What PHP version do you use - maybe < PHP 5.3?
See http://php.net/manual/en/ini.core.php
For PHP < 5.3 this value was PHP_INI_SYSTEM, which means it can only be set from within php.ini or httpd.conf. Starting with PHP 5.3 its value is PHP_INI_ALL, so you can set it from within a htaccess file.

Updating PHP version in a VPS host

We want to update the PHP version for our site hosted in a virtual server, from 5.2.17 to 5.3, but haven't been able to do it.
We asked the ISP for instructions but they take some days to answer and we need to update it as soon as possible.
If anybody could at least give us a suggestion or guide to achieve it, we'll be really grateful.
You could use your own php.ini in public_html but would have to configure it and that's not a good idea.
The best thing to do is to use the ISP ini files. This should work for any ISP:
.1 Find out where the ini file for the PHP version you need is located .
The path should be something like /usr/local/phpNN/lib/php.ini where NN is 53, for example.
.2 Login to your site account using (Bash) SSH. You can download Putty to do it, in case you don't have a suitable application.
.3 Copy the corresponding php.ini to your home directory with a command like this one:
cp /usr/local/phpNN/lib/php.ini ~/php.ini
.4 Add this at the end of .htaccess file at /public_html:
AddHandler application/x-httpd-php53 .php
SuPHP_ConfigPath /home/MyAccountName
.5 Confirm the PHP version with this code:
<?php phpinfo(); ?>

upload script not working after enabling suphp

My php script that uploads files in my centos - apache server was working fine.
Today I enabled suphp in server and after that script is not uploading any files.
I was used "php_flag register_globals on" in .htaccess before. But I removed that line from ".htaccess" in order to prevent 500 server error.
Pls help
After a long search and testing, I found the solution myself.
Just created a php.ini file and added a line:
register_global = on
and removed all php flags in .htaccess.
Now its working fine.
As you figured out the parameter has to be in a php.ini file and suPHP has to be instructed to read this file. More information in this answer: php.ini not being read (Debian / ISP Config)
But; If your upload script requires register_globals to be enabled it's probably badly written or outdated. You should try to avoid using register_globals since it poses a security threat. More about that here: What are register_globals in PHP?

htaccess rewrite resulting in 500 Internal Server Error

I am trying to get pretty urls using htaccess for SLIR image resizing plugin.
I want to rewrite something like below:
Before Rewrite:
localhost/img/600x400/slider/image.jpg
After Rewrite
localhost/application/public/slir/index.php?r=slir&w=600&h=400&i=img/slider/image.jpg
But the following code is returning a 500 Internal server error...
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)/([0-9]{1,4})x([0-9]{1,4})/(.*)\.(gif|jpg|jpeg|png) application/public/slir/index.php?r=slir&w=$2&h=$3&i=$1/$4.$5 [NC,NE,QSA,L]
</IfModule>
Please help me.....
UPDATE
I thought it was a File Permissions issue...
so I checked all the related directories and files, surprisingly there were all 755/644.
Then I directly checked the /application/public/slir/index.php. It was not accessible.
I created another file named hello.php in the same slir directory and hello.php was accessible.
Then I moved the SLIR directory to the another folder named public. Here, both the index.php and hello.php were accessible.
After that, I moved SLIR directory to back to the original scripts folder. In scripts folder, hello.php is accessible but index.php is not accessible.
Now, Both files have same permissions and are in same folder.. I dont know what is happening here... :/ :/
Someone please help me......
In case anyone else is looking at this - the problem I found was these two lines in the htaccess file:
php_value auto_prepend_file none
&
php_value auto_append_file none
some servers don't allow them.
moving them to my php.ini file solved it for me:
auto-prepend-file = none
auto-append-file = none
That is probably because you are editing the .htaccess file with a Windows based editor like notepad. Notepad adds some characters to the file which you can't see, but they mess with the .htaccess. I recommend using an editor like Notepad++ and setting the mode to Unix, so it won't mess with the server..
Speaking technically that is because Linux and Windows have different type of EOL ( End Of Line ) so that notepad adds some characters to the end of every line to go to the next line, but Unix won't recognize them, because it has it's own type of EOL..
Slashes are normally forbidden in query strings, but you can enable them by setting
AllowEncodedSlashes directive.
You may also want your rewrite rule to use percent encoding for slashes (that is %2F) so after rewrite:
localhost/application/public/slir/index.php?r=slir&w=600&h=400&i=img%2Fslider%2Fimage.jpg
See also How do you configure apache php to accept slashes in query strings
Duplicate, phrased very differently:
Has anyone used Smart Image Resizer on subdomain sites?
The problem is the subdomain...

Resources