I had php 5.3 installed with apache 2.2
I just added php 5.57 x64 with apache 2.4 x64
both setups seem to be working fine in parallel when pulling php pages through browsers
can't run php pages/scripts from command line using the new php 5.57 executable
(I cd to the directory c:\php55 then run the command: php -f c:\... path to template in htdocs)
same php pages/scripts run just fine with 5.3 php executable using same exact command
same php pages/scripts run just fine through browsers using the new php 5.57 executable (configured on port 8080)
I'm on windows 2008 r2
any idea folks?
You should use absolute path. For example
c:\php55\php.exe c:\htdosc\script.php
Also check waht php executable file is in folder c:\php55 May be it in c:\php55\bin
Related
On my server (Redhat 7.5) I don't have internet access so I installed httpd, PHP and MySQL with its binaries.
So first I installed httpd server which installed on
/usr/local/apache2
After that, I installed PHP and MySQL which is running without any error.
I have put my PHP code in the following folder
/usr/local/apache2/htdocs
when I try to run HTML it's running properly but with PHP I try to execute PHP its show code instead of executing the code I tried to load from my PHP module in my httpd.conf file but I didn't find PHP module in my /usr/local/apache2/module folder
Please help me I am stuck with this problem.
I have a system build with Laravel 5.5 and it needs PHP version 7.
I have deployed the project to site ground server, updated PHP version using PHP version but when I ran php -v command via putty it is showing me PHP version 5. I don't know what going on.
I shall be thankful if someone tell me that what is the proper way of updating PHP version?
I have also tried AddHandler application/x-httpd-php70s .php in my .htaccess files but got nothing fruitful
You can change the PHP CLI version through SSH. After connecting through SSH type cd ~ and then find .bash_profile file. Open the .bash_profile file with nano or vi which you would like to use and enter this line:
alias php=/usr/local/php72/bin/php-cli
and save the file. After that run command:
source .bash_profile
And your PHP CLI version has been changed. To confirm the PHP version type php -v and it will show you the version which you just changed.
P.S: In my case, I want to change the PHP CLI version to PHP 7.2 so I use php72 in alias php=/usr/local/php72/bin/php-cli. You can change it to any other version which you need.
So there's no problem if you see PHP5 using command line and PHP7 using php file with phpinfo();. Your hosting provider allows you to choose from several PHP version. You can select PHP7 e.g. using .htaccess but it doesn't have to change PHP CLI version. So when you set PHP7 in .htaccess file it serves your website using PHP7, but CLI is still v5.
By the way, this type of question should be asked on superuser I think.
I run MAMP on my Mac at home, but on my work machine (Win7) I just started using MAMP for Windows so that I'm running the same (relatively speaking) software between the two machines. I was running some commands from the command line yesterday and noticed that the script was throwing errors because the mbstring extension wasn't loaded. I did some digging and am left scratching my head now...
In the browser, everything works fine. When I check the phpinfo, it's loading the configuration file just fine and mbstring is enabled. When I switch to the command line though, mbstring isn't in the list of modules (php -m). Also, when I do a php --ini, it tells me that no configuration file was loaded. I've added the correct PHP version to my PATH and running php -v gives me the version I expect, so I'm not really sure why PHP on the command line is acting differently from PHP in the browser.
Has anyone run into this before? How do I make PHP on the command line load the same configuration file that the browser is using?
Command line php (CLI) is a different executable to CGI PHP. It also uses typically a different php.ini file. You can however specify the location of the php.ini you would like to load when launching php cli:
php -c <path to your php.ini>
Have a look here.
This example assumes you use C:\MAMP\ as installation directory.
As you need configuration as used in Windows MAMP you will need to supply it as argument to php.
Open command prompt.
To execute test.php with script located in C:\MAMP\htdocs\ by using PHP5.6.0 from MAMP:
C:\MAMP\bin\php\php5.6.0\php.exe -c "C:\MAMP\conf\php5.6.0\php.ini" "C:\MAMP\htdocs\test.php"
As you can notice last argument is the script to be executed ("C:\MAMP\htdocs\test.php").
To execute phpinfo from command line:
C:\MAMP\bin\php\php5.6.0\php.exe -c "C:\MAMP\conf\php5.6.0\php.ini" -r phpinfo();
There should be line from phpinfo output which acknowledges that you're using configuration from C:\MAMP\conf\php5.6.0\php.ini.
Loaded Configuration File => C:\MAMP\conf\php5.6.0\php.ini
To begin, I am not using MAMP or any LAMP.
I have PHPStorm and I want to add my php installation as an interpreter. When I choose the correct folder: "/usr/local/php5" or "/usr/local/php5/bin", PHPStorm gives me an error: PHP version: not installed.
However, both via the browser or the command line (php -i), both of my php installations are the same and the php.ini location for both is located at:
/usr/local/php5/lib
Why is PHPStorm not recognizing my PHP installation ? What am I missing ?
Edit1:
Run the following command in the terminal and use the output path as the path of your interpreter.
which php
Environment:
Server: Ubuntu Server 12.04 x64
Web Server: Apache 2
PHP: 5.3.10-1ubuntu3.8
Oracle: Instant Client 11.2
Problem:
I have a script that I am setting up as a cron job, but when it runs it produces
PHP Fatal error; Call to undefined function oci_connect() in /var/www/reports/inc/config.php on line 25
If I run this script or any other script using oci_connect or oci_pconnect through Apache, they work fine. I just migrated to a new machine and the script ran fine on the previous machine, but I cannot think of what I am missing.
Permissions on the script are the same as the config file and I have tried running as www-data, my user account, and root (all provide the same error).
You have to specifie the user custom profile file (.bash_profile or .profile) before launching the script
0 7 * * * . $HOME/.bash_profile; php -e -c /etc/php.ini /var/www/html/script_avec_oci.php
When you use PHP from the shell or crontab, you're using the CLI version, not the webserver version, and they usually have separate php.ini files. Edit /etc/php5/cli/php.ini and enable the OCI extension.