I have configured Amazon EC2 Server and install PHP and MySQL. I have uploaded my website on it. it is in smarty.
Problem is when I update any .tpl file, then the server return white page as output in Firefox and Chrome return 500 Internal Server Error. I have surfed everywhere on internet but got nothing.
When I update any .php file then the code work nicely. problem is only with .tpl file.
I'm willing to bet that your templates_c directory is not writable by Apache (identified as apache or httpd, and you can check in your httpd.conf file), or it hasn't been configured correctly during Smarty initialization.
You can try temporarily setting your templates_c directory to 777 permissions to test this hypothesis.
If this ends up being the case, then you'll want to assign group ownership of templates_c to apache, and set the folder permissions to 775. (They explain this in their documentation.)
An HTTP status of 500, with no page content (Chrome is just being nice and rendering a default error message for you) means that PHP encountered a Fatal Error.
You will need to find out where PHP is configured to log to (usually a file called php_errors.log) and see what the error was.
Alternatively, you could temporarily allow PHP to output errors to screen, using the error_reporting setting.
Related
I'm having an issue where Xampp isn't logging my errors. The file path doesn't exist when I search for it. I read some stuff about this that said I need to enable php_error_log from the php.ini file but i don't know what values to change.
It should be a permissions issue (depending where you installed XAMPP). The XAMPP panel is sometimes unable to create the logs folder. Just create this directory:
...\xampp\php\logs
and the next time PHP error occurs it will create the php_error_log file inside and the logging will start.
I'm copying a file from $source to $destination.
If I execute copy($source, $destination) from PowerShell, it works.
If I call this copy($source, $destination) from Apache, it complains copy(...): failed to open stream: Permission Denied.
I am able to open up explorer and copy and paste file manually. I am using PHP 7.1, Apache 2.4 on Windows Server 2012R2.
Why is this happening? Could someone provide an insight?
If run under Windows Apache already has all the permissions it needs, as it runs under the LocalSystem account, which has extensive read/write access to local paths. This is inherited by PHP and the scripts it runs.
If there is a problem then –
The additional file permissions that have been set up afterwards are at fault (check Windows Event viewer).
The configuration has been incorrectly edited, such as the: WP upload path settings, php.ini temp folder location + upload settings, etc.
The Apache Service ‘Log On’ account has been changed from “LocalSystem” to something else (check Service’s Properties).
Possibly PHP’s open_basedir setting has been enabled in VirtualHost or .htaccess and is restricting the paths PHP can access.
Or there are internal PHP errors (check the website’s HTTP and PHP error logs).
EDIT
Since it is sugggested i add this solution possibility if you are stuck at point 3:
Create a user with extensive file permissions and change Apaches service to run under that user. I strongly suggest not to use the system admin user (or any admin user) profile for this.
Hosted a new website. But when ever I open my website in the browser it is throwing the below error. Tried changing the .htaccess ReWriteRule but could not resolve it.
You don't have permission to access / on this server. Server unable to
read htaccess file, denying access to be safe Additionally, a 403
Forbidden error was encountered while trying to use an ErrorDocument
to handle the request.
This most likely means that apache doesn't have permission to read the directory where your .htaccess is located. Check the permissions on the folder where the file is located.
Ok, so I was facing this issue as well. Now keep in mind, the location of my application was a folder being shared with the Guest OS. Now what I had forgotten to do is to check, and make sure all permissions were enabled on said file on the HostOS.
So what I recommend is that you check the file permissions on the HostOS. Might be nothing you did, just something you forgot to do. Here is a screen shot of what I'm talking about.
Correct file permissions on left, zend skeleton displaying on right
I was unable to restart apache using my ID. So I restarted it using root user and hence this error. Later I changed access permission of httpd folder to 755 and restarted using my ID. The issue was resolved.
hello I think you have some problem with permission like it's was mentioned on your hosting you will find some number near your file like 755 those are the privilege of your file if there wasn't on that number 7 maybe 5 or 4 change it to 7 and like that your application could get the access and lunch your application
My site frequently displays 500 Internal Server Error. Restarting apache, brings the site back to normal state. Other sites running on the same server does not have this issue. Apache error log have no information related to this. The apache loglevel of this site is set as "warn".
What may be the reason for this ?
My site is written on PHP and deployed in linux server.
If you have suphp installed it might be e permissions problem - if its installed all the files need to have chmod set to 644 and all thefolders - 755
Please check the folder necessary permissions. Then in index.php file add
ini_set('display_errors', 1);
to display error reports. So that you can find the error.
As stated above, when symlinking to a php file outside of the httpdocs directory Apache/php serves an empty file. However if I change the extension to html the file is served properly as an html document. This leads me to believe that it is not a permissions error but could be something related to the php configuration (could open_basedir be causing this?) or Apache.
Does anyone know what could be causing this behavior?
EDIT: For anyone wondering about this, the problem was cause by the php open_basedir restriction.
Turn on error reporting in PHP and check your PHP error log. 100% guaranteed that you had a fatal scripting or configuration error.
I tested symlinking a PHP script from the webroot / htdocs. Worked just fine.
Made the following files
/some/directory/myphpscript.php (the script)
/some/directory/htdocs/symlink.php (webroot)
In the myphpscript.php I added a hello world script (<?php echo 'Hello world'; ?>). The symlink was created from command line using the follow command when standing in /some/directory/htdocs/:
ln -s ../myphpscript.php symlink.php
Make sure
User running Apache can access the file
The symlink is correct. If your use relative paths, it must be relative to the webroot (e.g. ../../path/to/script.php). Test the link by opening the file (e.g. nano symlink.php).
Check out the Apache error.log for error messages.