Viewed   87 times

So I recently change to ubuntu and I am trying to setup my environment again and I manage to install LAMP and phpmyadmin and phpstorm.

But what I can't mange to do is to run the php script from phpStorm when I try to run the program the page gives me a "502 Bad gateway" error and when I go back on phpStorm it tells me that php-cgi was not found.

I have tried to fix the problem but couldn't find any solid answer and I am so confused right now

Also I have successfully added the php interpreter and the xDebug



on linux ubuntu

For PHP5: sudo apt-get install php5-cgi

For PHP7: sudo apt-get install php7.0-cgi

Monday, August 15, 2022

Just place such stub file(s) anywhere in your project (or reference in any other supported way, e.g. as Settings | Languages & Frameworks | PHP | Include path) -- IDE will use it for code completion (and similar) purposes only (so you can exclude them from uploading/VCS etc).

In long term -- you may submit the PR to the already mentioned PhpStorm stubs repository and it may become part of the standard PhpStorm distribution on next release.

Thursday, September 22, 2022

I searched SO with question to these specific server variables and found following statement here:

You are just juggling variables now. SCRIPT_FILENAME is a part of the CGI spec. It will not be available if PATH_INFO is unavailable. As for REQUEST_URI, it's apache's mod_rewrite specific. – LiraNuna

So exporting PATH_INFO variable also populates values from SCRIPT_FILENAME and SCRIPT_PATH environment variables. Please note that SCRIPT_FILENAME is needed still to point php-cgi to php input file. Below is the final script


export SCRIPT_FILENAME=/usr/local/www/owncloud/cron.php
export SCRIPT_PATH=cron.php

Wednesday, October 12, 2022

Try with actual PHPDoc for your getById() where you specify dynamic type (e.g. @return static or @return $this).

That's the most common way of providing such "this class and its' children" typehint.

Another possible option is kind of the same .. but using PHP 7.1 functionality (so no PHPDoc blocks).

Try using self as return type instead of Model. I mean here:

public static function getById(string $id) : ?Model {

use this instead:

public static function getById(string $id) : ?self {

But for this one you should use PhpStorm 2017.2 EAP build as 2017.1.x has issues with that (see https://.com/a/44806801/783119 as an example).

Tuesday, November 8, 2022

PHP CLI is the command-line interface for PHP (e.g. for creating standalone applications)
PHP CGI is the common gateway interface for PHP (e.g. for web applications)

Sunday, September 11, 2022
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :