It's my first webpage and everything was ok until I had to set up server and install PHP to star coding the back end part.
I installed MySQL 1.4, Visual Studio 2015, VC14, Apache 2.4 and PHP 7.1.
MySQL is running as well as Apache. I was able to open localhost:8080 with the message "It works" but when I try localhost:8080/test.php it opens a 404 page not found.
The error log in Apache folder says:
[php7:error] [pid 3276:tid 956] [client ::1:65240] script 'C:/Apache24/htdocs/test.php' not found or unable to stat
The test.php file is on Apache24/htdocs.
I've already tried so many options, installed and deinstalled versions of PHP, Visual Studio, and nothing. Thank you for helping me.
Here is the httpd file which I edited:
I added those 4 line at the beginning:
AddHandler application/x-httpd-php .php AddType
application/x-httpd-php .php .html LoadModule php7_module
"c:/php7/php7apache2_4.dll" PHPIniDir "c:/php7"
Definde the SeverRoot:
Define SRVROOT "c:/Apache24" ServerRoot "c:/Apache24"
Changed the Listen port
Listen 8080
List item
Changed the ServerName localhost: ServerName localhost:8080
DocumentRoot
DocumentRoot "c:/Apache24/htdocs"
"c:/Apache24/htdocs">
put your test.php at folder XAMPP/htdocs. XAMMP Panel, turn on Apache and MySQL. Then open your browser and type localhost/test.php
Related
I have a CentOS server and I am trying to configure apache with php-fpm. I have a virtualhost in a conf file. When checking the status of http and php-fpm all is fine but when trying to access the website in the browser,
I have errors based on the filesmatch part of my conf file :
<FilesMatch \.php$>
SetHandler "proxy:unix:/var/run/php-fpm.sock|fcgi://localhost/path/to/docroot"
</FilesMatch>
=> [proxy_fcgi:error] AH01071: Got error 'Primary script unknown'
In the browser : File not found
<FilesMatch \.php$>
SetHandler "proxy:unix:/var/run/php-fpm.sock|fcgi://localhost/"
</FilesMatch>
=> [proxy_fcgi:error] AH01071: Got error 'Unable to open primary script:
//path/to/docroot/index.php (No such file or directory)'
In the browser: No input file specified
The /path/to/docroot also has apache permission, what could be the issue? any help is appreciated.
Thanks
The problem was the open_basedir and docroot settings in the php.ini. I modified the www.conf file inside php-fpm.d folder to add the two settings :
php_admin_value['open_basedir'] = /path/to/base_dir
php_admin_value['doc_root'] = /path/to/doc_root
and then everything worked.
Thanks!
The setup is CentOS 7, Apache 2.4.6, php-fpm 5.6 and 7.3 (via remi repo).
I recently converted my default phpmod setup to php-fpm and got PHP 5.4.16 working just fine. Now I'm trying to enable PHP 7.3 as an option per Virtual Host. I got php73-php-fpm installed and running then looked at the Apache side.
My /etc/httpd/conf.d/php.conf includes the following directive:
<FilesMatch \.php$>
# SetHandler application/x-httpd-php
SetHandler "proxy:fcgi://127.0.0.1:9000"
</FilesMatch>
That works fine for all hosts. Then I added this <FilesMatch> directive inside one Virtual Host .conf file:
<VirtualHost *:80>
ServerName www.sittingduck.co.nz
ServerAlias sittingduck.co.nz
DocumentRoot /var/www/sittingduck.co.nz/public_html
ErrorLog /var/log/httpd/sittingduck.co.nz.error.log
CustomLog /var/log/httpd/sittingduck.co.nz.requests.log combined
<FilesMatch \.php$>
SetHandler "proxy:fcgi://127.0.0.1:9073"
</FilesMatch>
</VirtualHost>
When I restart the httpd server, the following shows up in the ErrorLog specified above.
[proxy:error] [pid 17061] (111)Connection refused: AH00957: FCGI: attempt to connect to 127.0.0.1:9073 (*) failed
[proxy_fcgi:error] [pid 17061] [client 54.36.148.97:33788] AH01079: failed to make connection to backend: 127.0.0.1
After verifying that both php-fpm servers were indeed running...
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 16794/php-fpm: mast
tcp 0 0 127.0.0.1:9073 0.0.0.0:* LISTEN 17510/php-fpm: mast
...I next tried switching over the main php.conf to the 9073 port. When I do that, all sites work and I can confirm (using a phpinfo page on the site above) that I am running on PHP 7.3.
What am I missing here? The Virtual Host configs are definitely loaded after php.conf, as the error would suggest, and the fpm is definitely in working order, and the port clearly is accessible.
I feel like there's some rule or caveat to the way I have the directives defined. Any help would be appreciated.
The problem was http versus https. My configuration file was defining *:80 but I was unthinkingly viewing the https version of the test page. The *:443 Virtual Host was in a separate configuration file that had been added after installation by the certbot tool. A manual edit of this extra file resolved the problem.
I'm still not quite sure about why the errors in the log at the start and then not later, but possibly this was due to specific pages being requested over http and/or https at different times.
I am trying to set up PHP to work with Apache using Apache Module DLL. The following code is added to c:\Apache24\conf\httpd.conf file:
LoadModule php5_module C:/PHP/php5apache2_4.dll
<IfModule php5_module>
DirectoryIndex index.html index.php
AddHandler application/x-httpd-php .php
PHPIniDir "C:/PHP"
</IfModule>
Then I browse http://localhost in a browser and it shows a page saying "It Works!"
Then again I test browse a PHP page info.php which just calls phpinfo() and it shows quite a bit of info about PHP installation.
Now, the case is that I found two default files such as php.ini-production and php.ini-development and I copy any one of them and save it as php.ini in
"C:/PHP",restarts the Apache server and again test browse info.php,then this time the page is blank even without any error message.
What might be the issue and how should I try to solve it?
My software specification is outlined below:
OS: Windows 7
PHP: 5.6.29
Apache: 2.4.23-win32-VC14
Thanks in advance!
I would like to host Wordpress and Magento PHP sites on a IBM/Lotus Domino Server with plans to integrate with Lotus Notes databases.
I have installed PHP 5.3.29, MySQL 5.6.21.1, phpMyAdmin 4.2.10.1
I am NOT running IIS or Apache.
I am running IBM Domino Enterprise Server 9.01 with HTTP Server task.
I have created the URL-->Directory mapping doc in the Domino Directory:
Incoming URL String: /*.php
Target server directory: c:\php\php-cgi.exe /*.php
Access Level: Execute
I have created a directory 'php' in the Domino HTML folder (c:\domino\data\domino\html\php)
I created a info.php file that displays phpinfo():
<?php phpinfo(); ?>
I am able to bring up http://domain.com/php/info.php perfectly. !!
I am able to run phpMyAdmin and create MySQL db's.
I am able to install and configure Wordpress.
HOWEVER I must add index.php to any URLs that only include the directory.
For example /wp/wp-admin/index.php works.
But /wp/wp-admin/ or /wp/wp-admin return status 403 and error:
Unable to process request, directory browsing is not allowed
SO Here is my question:
How can I get the Domino HTTP service to look for index.php in addition to index.htm & index.html when a URL is only of the directory? If there is a file named index.html in the Domino HTML directory, you need only use the directory name. How to add index.php to the list of files to look for if only a directory is in the URL? Is there some configuration file where I can add index.php to the list?
Please note that I am not using Apache so the .htaccess file has no effect (correct me if I am wrong) in the Domino HTTP environment.
Thanks in advance.
I was able to host a Wordpress site on a Domino 9 server running the optional IBM HTTP Server (IHS). All running on Windows Server 2008 R2.
First, Domino 9 Server must be installed with the option 'IBM HTTP Server' -- you have to do a Custom installation to see the choice. This installs IBM HTTP Server (IHS) which is a version of Apache that integrates with Domino HTTP.
IHS is installed in the Domino directory 'ihs'. The ihs\conf\domino.conf file needs to be edited -- most of it is OK as is. The file domino.conf is used instead of httpd.conf which would normally be used to run IHS without the Domino HTTP connection.
Add domino\ihs\bin\ httpd.exe to your Firewall rules since it will now be receiving the HTTP requests and proxying them to the Domino server on a different port. This setup will allow the installation of TLS encryption certificates, for example.
Make edits to domino.conf:
Uncomment line:
Listen 0.0.0.0:80
Comment out SetHandler domino-handler :
<IfModule mod_domino.c>
...
#<LocationMatch /*>
#SetHandler domino-handler
#</LocationMatch>
</IfModule>
Append the following at the end of domino.conf:
LoadModule dir_module modules/mod_dir.so
DirectoryIndex index.html index.htm index.php
Win32DisableAcceptEx
LoadModule php5_module "C:\php\php5apache2_2.dll"
<IfModule php5_module>
AddType application/x-httpd-php .php
PHPIniDir c:/php/
</IfModule>
NameVirtualHost *:80
#default vhost for Domino HTTP:
<VirtualHost *:80>
ServerName "${DOMINO_SERVER_NAME}"
DocumentRoot "${DOMINO_DOCUMENT_ROOT}"
<IfModule mod_domino.c>
<LocationMatch /*>
SetHandler domino-handler
</LocationMatch>
</IfModule>
</VirtualHost>
# vhost for wordpress.domain.com
<VirtualHost *:80>
ServerName wordpress.domain.com
DocumentRoot "${DOMINO_DOCUMENT_ROOT}/wp"
</VirtualHost>
Secondly, to install PHP5 on IHS, we have to use the thread safe version -- I had previously installed the non-thread safe (nts) versions configured for 'Other CGI' which did not allow for a php module that could be loaded by the IHS (Apache) server.
PHP 5.3.29 VC9 x86 Thread Safe (2014-Aug-15 20:02:15)
Installer [38.38MB] http://windows.php.net/downloads/releases/php-5.3.29-Win32-VC9-x86.msi
I used the PHP installer program - install PHP in C:\PHP, choose Apache 2.2.x Module during web server setup.
I copied the Wordpress files into the Domino html directory domino\data\domino\html\wp .
Finally, to run IHS on Domino, edit notes.ini and add:
HTTPIHSEnabled=1
Restart the HTTP task on the Domino server. Pay attention to console to make sure there are no errors with domino.conf file.
The above configuration will send ALL HTTP requests on port 80 to the Domino HTTP task as normal with the exception of wordpress.domain.com which will continue to be handled by the IHS server instead of the Domino server.
The Virtual Host doc in the Domino directory for wordpress.domain.com is not needed, and the URL-->Directory mapping doc in the Domino Directory I originally added is now no longer needed (and now there is no c:\php\php-cgi.exe file).
Note that Domino does no logging of any IHS virtual hosts that are not handled by Domino.
According to the book "IBM HTTP Server on z/OS: Migrating from Domino-powered to Apache-powered" (p.42, bottom) there exists a Welcome directive in Domino, which should do the same as DirectoryIndex in Apache.
This should do the trick:
Welcome index.php index.html index.htm
although I do not know where to put that... but maybe you already know that.
UPDATE: the following error is coming up in the Apache error logs...
[Sat Dec 08 16:41:39 2012] [error] [client 127.0.0.1]
PHP Fatal error: require_once():
Failed opening required 'Zend/Application.php'
(include_path='/Library/WebServer/Documents/quickstart/library:.:/php/includes:/Users/markmcdonnell/Dropbox/Library/PHP/ZendFramework-1.12.0/library')
in /Library/WebServer/Documents/quickstart/public/index.php on line 18
I'm using Mac OSX 10.8.2 (Mountain Lion) and I'm having problems getting the Zend framework set-up and running (just the basic QuickStart).
I'm using Apache 2.2.22
My localhost files are accessible from /Library/WebServer/Documents
I have PHP 5.3.15 running as well.
I've created a new project via the command line (using the zf.sh file) called 'quickstart' (as per the section on the Zend website recommends) and that is stored here: /Library/WebServer/Documents/quickstart
I've followed both the official Zend website instructions and also an online book about installing Zend: http://www.survivethedeepend.com/zendframeworkbook/en/1.0/creating.a.local.domain.using.apache.virtual.hosts
My php.ini (/private/etc/php.ini) file has been updated to include the path to the library folder inside the ZendFramework directory...
include_path = ".:/php/includes:/Users/<home>/Dropbox/Library/PHP/ZendFramework-1.12.0/library"
I've updated /etc/apache2/httpd.conf so it includes...
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
# Ensure "localhost" is preserved unchanged pointed
# to the default document root for our system.
<VirtualHost *:80>
ServerName localhost
DocumentRoot /Library/WebServer/Documents
</VirtualHost>
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
ServerName quickstart.local
DocumentRoot /Library/WebServer/Documents/quickstart/public
SetEnv APPLICATION_ENV "development"
<Directory /Library/WebServer/Documents/quickstart/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
...I've also updated /etc/hosts so it includes...
127.0.0.1 localhost
127.0.0.1 quickstart.local
I'm restarting Apache using sudo apachectl graceful (I've also used sudo apachectl restart)
So if I try and now access http://localhost/ I see my /Library/WebServer/Documents directory and I can see PHP is running still with no problems. But if I try and access http://quickstart.local/ I just get an empty page?
Can any one advise as to what the problem might be, what I'm missing and what I can do to get the initial 'welcome' page to display.
I'm sure I'm just missing someone small, but it's obviously causing problem enough for the basic page not to show.
Thanks.
Mark
Just for others who may have followed this. The answer by Kamil, above, will work, but opens a security hole outside Apache's security configuration. That's fine as long as you know it and have another layer of security above Apache.
Another way to resolve the problem is to put the ZendFramework somewhere inside the root directory's hierarchy. Like:
DocumentRoot/Library/WebServer/Documents/ZendFramework-1.12.0/library
or
DocumentRoot/Library/WebServer/Documents/quickstart/public/ZendFramework-1.12.0/library
Any path that's inside the root directory of your Apache server.
Maybe a user permissions issue between the Zend files and the Apache process.
Since you can create the project using zf.sh, the Zend files are obviously there. But the fail you get via Apache suggests that the Zend files might not be accessible via the Apache process (that is, the user under which the Apache process runs).
$ chmod 0777 /Users/markmcdonnell/Dropbox/Library/PHP/ZendFramework-1.12.0/library
to test.
You could probably get away with much less expansive permissions - 0644, for example - but I confess I'm terrible at that aspect of it. ;-)