I am new to PHP and have been trying to get a PHP application setup on Windows.
I have installed MySql5.1, Apache2.2 and PHP5.2.14 on Windows Server 2008. I can login into MySql no problem and I can run phpinfo from htdocs in apache and get the php config summary however whenever I copy in my application to htdocs and run it I get a blank page.
I have set my DirectyIndex in httpd to welcome.php but nothing .... any help troubleshooting would be great.
Make sure you turn on all error display in php.ini
error_reporting = E_ALL | E_STRICT
then see if the application still gives you a blank page. If it still does, then it maybe configuration error on apache/php. Since, you are able to display phpinfo i would say the configuration works. perhaps, there's an error on the application.
Related
I used windows 10 as the operating system and I installed xampp it's been a long time and it chews well, until yesterday after an error in mysql.
So I looked for solutions on the internet and I finally solved the error by copying the files from C:\xampp\mysql\backup to C:\xampp\mysql\data.
then the service mysql is well marketed even as Apache.
PhpMyadmin chews well without a problem. phpmyadmin page shows, but my code, will not show.
The problem is: my old projects exist in htdocs only display "This page does not work" and "localhost" in the title head, and nothing loads from my project files.
Note: I used codeigniter as a framework.
Note: I can navigate to a new project but for existing projects beyond that it no longer works.
Thank you P.al
Use Directly like-
http://localhost/projects/form.html
Here your files should be inside C:\XAMPP\htdocs\Projects\yourfile.html
The error in your picture appear an php script error
Edit php.ini for display error and notice in browser
display_errors = on
save the php.ini restart apache and reload page.
I've just installed Apache, MySQL and PHP 7 on an Ubuntu 14.04 machine. I began by installing PHP 5.5, and then upgraded to PHP 7 - although admittedly I didn't test PHP 5.5 before upgrading. Probably should have done that.
I've created a test PHP script (info.php) to see if everything is working:
<?php
phpinfo();
?>
The script executes and displays the phpinfo output as expected when I run it in the Terminal, but when I open it in a browser I get a blank screen. Have checked to make sure I have the right URL etc.
I also get a blank screen if I try the following:
<?php
echo "Hello World";
?>
If I add HTML elements before the PHP code, these are displayed in the browser just fine.
I've turned display_errors to On in php.ini, and checked the Apache error log, which isn't showing anything strange. I can't find a PHP error log in the etc/php/7.0 folder or any of its subfolders.
I have noticed that in the etc/php5 folder I have three subfolders: apache2, cli and mods-available - but in the etc/php/7.0 folder I have no apache2 subfolder - in its place I have a subfolder named fpm.
This is suggesting to me that I simply don't have PHP7 set up as an Apache module, but maybe someone could confirm this for me? I'm not sure how to check this.
Can anyone suggest anything?
Thanks in advance,
Gareth
The problem here turned out to be that I simply hadn't installed mod_php as part of the PHP 7 installation process.
To rectify this I entered the following in the terminal:
sudo apt-get install libapache2-mod-php7.0
Everything appears to be working as expected now.
yesterday i've setted up an Ubuntu 14.04 with php5, Apache2, mysql / mysql-php
Now i try to access my pages - first i've owned all files in my var/ww-directiory, the mainpage of my page worked.
Iǘe logged in in the page (self written cms), nothing working now.Chrome tells me an Internal Server-Error (500). but they are no errors displayed.
I've tried to change the php.ini to display errors, but the changes will be ignored.
With service apache2 stop
i have stopped the server, but the server is running...
What i have to do to see my errors and top stop the server?
In xampp (windows xp / windows 7, booth) the page workes fine. The page is in use on a real server, there it works fine too.
My .htaccess seems to be ignored (routing engine).
If i fill my index.php with "Hello World" (and nothing other) it doesnt work too.
But it seems that php is loading my application correctly, it started the session (seen at the cookies) which is started in other file, which is included from index.php.
An Internal Server Error is probably due to some mistake in your configuration files. That could be either apache2.conf (or any other apache configuration files that get loaded) or php.ini (or any of the additional config files that php loads).
By the way, .htaccess files are disabled by default, and you need to explicitly enable them using apache directive AllowOverride.
Another thing to notice is that, in ubuntu 14.04, you're probably using apache 2.4. There's some slight differences. The first one I've noticed is that site definition files inside sites-available need to end in .conf now.
You can test you config for errors using apachectl configtest (on linux).
I use PHP version 5.3.19, Windows Server 2008 R2 Standard SP 1 and Internet Information Services (IIS) 7.5.7600.16385.
My problem:
I can't change the PHP error log file location.
When I try that and restart the IIS service, my web application cannot be opened:
Browser says 500 - Internal server error.
I tried everything.
I checked the error logs of Windows and the IIS error log.
Nothing! Is this possible?
I was able to change the locations of the PHP session data folder and the PHP upload temp folder, no problem. (I created a folder, C:\myapplication\mycompany\temp, and gave this new folder all the necessary rights, so the IIS IUSR can do everything.)
So: The new locations of the PHP session data folder and PHP upload temporary folder work after restart of the IIS service! That's fine!
But I cannot change the location of the PHP error log file. Why?
It is the same new Windows folder having the ultimate rights.
I tested a little bit with different text files.
I created new and empty log files, tested with the original PHP error log file from C:\Windows\Temp. Nothing. And I really restarted the IIS service after every change of the php.ini file. But in the end: The browser says 500 - Internal server error when browsing the web application.
So, what can I do? I don't understand what's wrong.
You may be setting the error logs in file php.ini.
Try setting it at runtime with something like:
ini_set('display_errors', 'on');
error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE);
ini_set('error_log', "C:\php\error.log");
That way, you should see the error message on screen, it there is one.
Whenever I have an error in my php code, MAMP just returns a 500 error. Is there anyway I can get MAMP to tell me what went wrong like parsing errors and stuff?
Just as you reported, you must have display_errors set to on. This can be done either by changing the conf file or by using .htaccess like so:
<IfModule mod_php5.c>
php_flag display_errors on
</IfModule>
Additionally, you can do this with ini_set() like so:
ini_set('display_errors', 1);
One last thing, you can also check /Applications/MAMP/logs which has three different error log files.
Try opening terminal and run this command:
tail -f /Applications/MAMP/logs/php_error.log
When you want to stop "following" (the -f switch) the log file, just type control+C.
You can also access MAMP errors using the Mac "Console" app to read the php_error.log file.
I find this easiest to access by using spotlight and typing in "error.log".
( it won't find it if you type "php_error.log", you must type "error.log" )
It looks like this :
2022 update:
If we talk about usual MAMP (not PRO version), my research showed that there's no way to enable displaying of PHP errors using GUI. However, all the old approaches with configuration files mentioned in answers to this question and several others still work. But be careful with config names since they have been changing over some versions.
For MAMP PRO users: You can easily enable outputting of PHP errors using GUI:
Switch to Expert view at the top left corner: screenshot
Click on the PHP language: screenshot
And then check the option to screen of the Log errors property: screenshot
Hit Save and restart the servers when MAMP asks you to restart or not.
You're done. PHP now should output error message in the place where error occured.
Also, if you prefer configuring everything by hand, the option with configuration files works here as well.
At the time of writing this answer, the actual version of MAMP (and PRO) was 6.6.2.