I have set up an IIS 7 to a Windows Server machine. The idea is to access a working php site through a network computer and for the php to be able to be compiled.
Steps i did:
Downloaded PHP 5.6.31 (i have to use the specific version)
Unzip php files in c:\php directory.
Rename php-ini-production to php.ini
Copy the same file to c:\Windows
Create a website in IIS.
Added 2 bindings to website with following data:
-Type: http, host name: test.local, port: 81, ip address: *
-Type; http, host name: blank, port: 81, ip address: the ip address of the
Workstation hosting the IIS
Added at IIS site and new website at Handler mappings the following:
request path: *.php, Module: FastCgiModule, Executable: C:\php\php-cgi.exe
and clicked request permissions and on Mapping tab i checked Invoke handler only if request is mapped to and i selected File or folder
Added at IIS and new website at MIME types the following:
file name extension: .php, MIME type: application/x-httpd-php
At IIS at ISAPI and CGI restrictions i added php-cgi.exe path and clicked Allow extension path to execute.
I installed Visual C++ Redistributable for Visual Studio 2012 Update 4
In php.ini file (the one i renamed above), i uncommended and set values for the below:
-fastcgi.impersonate = 1
-cgi.fix_pathinfo =
-cgi.force_redirect = 0
-extension_dir = 'ext'
From control panel from System->Properties->Advanced system settings->Environmental variables, at the end i added ;c:\php
Restarted iis
Now when on server i run server's ip for example: 10.0.0.1:81/index.php (where index.php is a file inside my website) i get a http Error 500, C:\php\php-cgi.exe - The FastCGI process exited unexpectedly with error code: 0xc0000135
When i run the same from network computer i get just a 500-Internal server error.
When at network computer i try to access the index.php file as a file (network location) i see just the php code and not the compilation.
Any ideas?Thank you in advance
Related
I have web server in my local network (Apache/2.4.10 + PHP 5.6.36 on Raspbian GNU/Linux 8 (jessie) 4.9.35-v7+ on Raspberry Pi) with hostname webserver. Then I'm also using a local webserver (localhost) on my workstation (Win 10 Home 64bit + Apache/2.4.25 + PHP 7.1.4).
After update to Win 10 "April update" (1803) I have this issue: when a PHP script on my localhost (i.e. workstation) tries read some file from webserver via file_get_contents()
$content=file_get_contents("http://webserver/file.php");
I get this error:
php_network_getaddresses: getaddrinfo failed: The requested name is valid, but no data of the requested type was found.
When I change hostname to IP address (http://192.168.1.100/file.php) then it works. Also there is no problem when I put http://webserver/file.php directly in my broswer (on workstation). The problem is only when a script from localhost (workstation) is trying to reach address on webserver with hostname in address.
Before Win 10 April update everything worked fine, so where can be a problem? I have installed all Windows updates but it didn't help...
Check your HOSTS file in C:\windows\system32\drivers\etc\HOSTS
Some Windows updates replace this file with a default, which would explain why you can no longer access the server as there will be no reference to it in the HOSTS file.
I develop a small system using YII2 PHP framework on my local host.
folder path "/var/www/html/MY_SITE"
with "yii php serve" command it work fine for this url - localhost:8080
Then I configured a virtual host with documentRoot "/var/www/html/MY_SITE/web" and host name like "www.my.site.lk"
and configure my host file.
restart httpd service.
then go to url www.my.site.lk.
but site not working.
YII application error.
Invalid Configuration – yii\base\InvalidConfigException
The directory is not writable by the Web process: /var/www/html/RLF_CMS/web/assets
in /var/www/html/RLF_CMS/vendor/yiisoft/yii2/web/AssetManager.php
but still woke this url (localhost:8080).
Please help me...
Give write permision chmod -R 777 to folder runtime and web/assets
In my mac terminal I typed:
vagrant up
vagrant ssh
after which my command prompt is inside vagrant and displays:
vagrant#zero-to-slim:~$
after which I type:
vagrant#zero-to-slim:~$ cd /vagrant
where I have created a php file (called hello.php)
<?php
echo "Hello World from inside vagrant!!";
?>
When I go to firefox and type /var/www I can see the contents of the directory:
(i) a folder named zero-to-slim.dev
(ii) index.html
(iii) hello.php
I want to enter (in my browser) localhost/hello.php and be able to see "Hello World from inside vagrant!!", which is clearly not happening. How do I make that happen? FYI, just typing localhost in firefox displays: "It Works!" I'm not using PuPHET or anything, just LAMP.
Also I think the problem is I have to direct my host OS Apache to look at some shared folder to render .php files. No idea how to do that either (new to LAMP dev)
OSX comes with PHP pre-installed but not configured. You have to do that yourself.
According to Using the bundled PHP on PHP.net:
PHP has come standard with Macs since OS X version 10.0.0. Enabling PHP with the default web server requires uncommenting a few lines in the Apache configuration file httpd.conf whereas the CGI and/or CLI are enabled by default (easily accessible via the Terminal program).
and it goes on to say that you start by uncommenting the lines mentioning php in /private/etc/apache2/httpd.conf, e.g.,
# LoadModule php5_module libexec/httpd/libphp5.so
# AddModule mod_php5.c
and restart Apache.
I recently installed WAMP on Windows and have set up a local MediaWiki installation. After the installation, I tried to to install a new extension. For it to work, I have to run the maintenance script update.php. However, when I go to localhost/maintenance/update.php, I'm getting a 403 error.
Forbidden
You don't have permission to access /maintenance/update.php on this server.
Apache/2.4.9 (Win32) PHP/5.5.12 Server at 127.0.0.1 Port 80
How do I fix this? or is there another way to run the maintenance scripts on WAMP (perhaps with a command line)?
This is not an error, it is desired behaviour for the program, since the .htaccess file for the /maintenance/ directory has this:
Deny from all
This is because the update.php file is not meant to be loaded directly from a web browser. You must read the documentation for MediaWiki updating from a browser to utilize it correctly. You can also run it from the command line
I have been busy setting up my own VPS after being used to cPanel, but I can't seem to find out how to let PHP create an error_log file in the same directory as the script that throws the errors.
I would like this to happen without me having to add a line of code to each .php file. In cPanel this works out of the box somehow.
Example:
Error in: /var/www/webapp1/index.php
Logfile location: /var/www/webapp1/error_log
Error in: /var/www/info/system/test.php
Logfile location: /var/www/info/system/error_log
Basically, I want PHP to store an error_log file in each directory for the scripts in that directory.
Additional information:
Single VPS account
Debian 6.0 (Squeeze) GNU/Linux
Apache 2.2.16
Set the error_log value to the name of the error log you want to appear in the directory, but do not put any slashes. The file will be saved in the directory from which the script is ran, so the same directory.
error_log = "php_error.log"
For this, there is the error_log directive in php.ini like:
error_log string
Where string represents the name of the file where script errors should be logged. The file should be writable by the web server's user. If the special value syslog is used, the errors are sent to the system logger instead. On Unix, this means syslog(3) and on Windows NT it means the event log. The system logger is not supported on Windows 95. See also: syslog(). If this directive is not set, errors are sent to the SAPI error logger. For example, it is an error log in Apache or stderr in CLI.
Edit your php.ini file and uncomment the line with error_log:
error_log = php_errors.log
Save the changes, restart Apache, and be happy.
If you're using Linux, open a terminal and type this to restart:
sudo services apache2 restart
If you have access to WebHost Manager (WHM) you can search for SERVICES and then restart HTTPD or Apache.
If you're using EasyPHP or Vertrigo, you can do that through the program it self.
basically I want php to store an error_log file in each directory for the scripts in that directory
Assuming you're using Apache, you can use Apache's error_log directive in the VirtualHost to accomplish this behaviour. If memory serves me right, PHP itself doesn't decide where it stores its errors.