php and apache http server installation issue - php

I have installed php-5.4.42-Win32-VC9-x86 and apache_2.4.2-x86-no-ssl.msi in my PC.
According to this
Link
I have installed PHP and apache server and configured. I have restarted my computer after configuration.
I created a phpinfo.php file in the website folder. When i try to run this file in the browser(http://localhost/phpinfo.php) i am getting webpage not available error. But when i run the localhost i am getting as "It Works".
Also when i test the configuration i am getting error as "syntax error on line 172 in httpd.conf, cannot load c:/PHP/php5apache2.2_dll into server.The specified procedure could not be found."
I resolved the problem of this error by changing phpapache2.2_dll to phpapache2.4.dll. I hadve both of them in my php folder.
My PC has 32 bit OS.I have also specified the path of PHP in environment variable.
But still when i run my file i am getting webpage not available.
Can any one help me to resolve this problem.

Related

**Update** Php file won't load using Apache as a Service

I have installed apache as a service on my Windows 10. I also have installed PHP and have that configured correctly. I'm making this assumption because I can create a PHP file in the htdocs directory with phpinfo() and get the expected results.
I have a PHP file located in htdoc folder (The same file I can run phpinfo() in) and go to 127.0.0.1/my_php_file.php and I get the error "This site can't be reached"
I have searched the logs for the apache service and there are none there.
Update
Here is the file's contents
<?php
$servername = "test";
?>
And it gives me the error "This site can't be reached"
The only error in the network tab has a status of "Failed" when loading the page

Server 500: This page isn’t working

I am new web server and web hosting. I created a Fedora 28 web server to host my own website, and to learn the ins and outs of web serving. The apache is working, http://<hostname>. I even created a phpinfo() file, which works also; http://<hostname>/info.php. To test my directory access I added an info.php to that as well; http://<hostname>/mywebdir/info.php. However, in the same directory level I have a general index.php file, which is my controller for said project; http://<hostname>/mywebdir/index.php but it gets the "This page isn’t working is currently unable to handle this request.
HTTP ERROR 500".
security context: unconfined_u:object_r:httpd_sys_content_t:s0
I have edited the properties on this file to be executable. What could be blocking this file? Again I am just learning.
Clearing all fatal errors will fix this issue. I forgot to install the pear package manager which threw fatal errors in my project.

Deploying Laravel Over FTP

I am working on deploying a Laravel app to a bluehost server and I am running into some trouble.
Currently, I uploaded all of the Laravel files to the root of the server, then uploaded the contents of the "public" folder to the "public_html" folder. From here I opened the "bootstrap/paths.php" file and changed the public path to
'public' => __DIR__.'/../public_html',
After this, I am still unable to get content to display. Am I missing something? It looks like bluehost is running PHP 5.4.24.
Any help with this would be appreciated.
Thanks!
EDIT: The error log shows
[09-Apr-2014 09:04:02] PHP Fatal error: require() [function.require]: Failed opening required 'DIR/../bootstrap/autoload.php' (include_path='.:/usr/lib64/php:/usr/share/pear') in /home1/regmuel/public_html/index.php on line 21
Could anyone help me figure this error out. I can clearly see what the problem is, I'm just not sure how to go about fixing it.
It looks like __DIR__ isn't getting parsed, are you sure your host isn't running PHP 5.2.* if you run phpinfo() on your host what version does it give?
__DIR__ is only available from PHP 5.3.0 onwards
RMcLeod's answer is perfect, just wanted to add to it something that I ran into with my web host (specifically Bluehost). Even after the version of PHP running on the server was 5.4.40 (found using php -v via an SSH terminal), I was running into the same problem where it was picking up an older version of PHP when interpreting my index.php and wouldn't recognize the DIR constant.
I had to add the line
AddHandler application/x-httpd-php54s .php
to the top of the .htaccess file which is in the same folder as my index.php
Just for context, I was trying to set up my laravel 4.2 app on bluehost and it relies heavily on this constant.

403 Forbidden Error for every directory except Apache DocumentRoot

I installed Apache and php on my local computer. Now i get the "It works!" message when i go to localhost in my browser and i can even see a sample .php info file. Yet i get a forbidden error when i attempt to browse to any other directory and any other php file throws an error. Below is my configuration file, any finger in the right direction is helpful.
http://implicitarts.com/httpd.txt
*was having issues with formatting.
In case anyone is interested, the issue seemed to be file permissions with files 'copied/dragged' into apaches server directory. I resolved my issue by disabling the UAC checks in windows 7.

php files downloading instead of opening

I have a Windows 7 laptop. I downloaded PHP 5.2.8. I downloaded Apache 2.2.
I ran the MSI for PHP install, which i know is not recommended but I tried multiple times the normal route without success.
I have apache running and it shows "Running all apache services". When i did the install i set it up for "localhost".
I checked the CGI checkbox in my control panel.
I placed a simple file, test.php , in C:\inetpub\wwwroot ... but when the file is double-clicked, it tries to download the file instead of opening it as a webpage.
I've been googling this for a couple of hours and cant find a suitable fix. I have cleared my cache, and still no luck.
I also set apache to listen on port 8080 just to be certain nothing else was using port 80 before hand.
Any Ideas??
Thanks!
update -- i was missing the php5apache2.dll ... i placed this in the PHP directory but still the same results. i have also tried browsing to the file location through IE which didnt change anything either unfortunately.
update again, - - DOH! - - didnt realize it was localhost/test.php or what the answer below was. when i do that, i get a server error page.. which is better than before i guess :)
Server Error in Application "DEFAULT WEB SITE"
HTTP Error 500.0 - Internal Server Error
An unknown FastCGI error occured
Module FastCgiModule
Notification ExecuteRequestHandler
Handler PHP
Error Code 0x8007010b
Requested URL http://localhost:80/test.php
Physical Path C:\inetpub\wwwroot\test.php
Logon Method Anonymous
Logon User Anonymous
Most likely causes:
•IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.
•IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.
•IIS was not able to process configuration for the Web site or application.
•The authenticated user does not have permission to use this DLL.
•The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.
when i try to start/run apache, it errors out. so when i run apache test configuration i get the following message:
httpd.exe: Syntax error on line 1 of C:/Apache/conf/httpd.conf: Cannot load C:/php/php5apache2_2.dll into server: The specified module could not be found.
However when i browse to that director, i do see that dll file there!! ugh...
ideas?
If you placed a file called test.php in C:\inetpub\wwwroot, then you would open your browser to http://localhost/test.php to try to execute the file.
The php5apache2.dll file needs to go in your module directory for apache, and you would need to add the appropriate apache config lines such as those below:
LoadModule php5_module "c:/path/to/php5apache2.dll"
AddHandler application/x-httpd-php .php
SetHandler application/x-httpd-php
After making those changes, you will need to restart apache.
Assuming you have PHP installed in Apache properly as mentioned in the other answers, it is possible the .php page is not sending the correct header. I have a .php file that emits a header with Content-Type: text/json, this is commonly used to provide a service for an Ajax client. The .php page should be sending Context-Type: text/html.
To determine if this is indeed the problem you can use wget with the -S option, or use developer tools in your browser. Take a look at this answer: Tool to view response headers
Double clicked? As in within explorer? If so, this won't open the page. You need to browse to the page. If you're within the directory listing for apache double clicking is not necessary.
As for setting up, if you're new your best bet is to use iis, easyphp, xampp, or some other variation
EasyPHP: http://www.easyphp.org/
Xampp: http://www.apachefriends.org/en/xampp.html
They'll get you running without the hassle

Categories