Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

0 votes
2 answers
10737 views
An exception occurred in the driver: SQLSTATE[HY000] [2002] Connection refused - docker - symfony
My code (symfony 5.4) fails to persist data to the database. Here's my setup:- **docker-compose.yaml** ``` ... #MySQL Service db: image: mysql:5.7.22 container_name: db restart: unless-stopped tty: true ports: - "3316:3306" environment: MYSQL_DATABASE: pink MYSQL_ROOT_PASSWORD: password SERVICE_TAGS...
My code (symfony 5.4) fails to persist data to the database. Here's my setup:- **docker-compose.yaml**
...
#MySQL Service
  db:
    image: mysql:5.7.22
    container_name: db
    restart: unless-stopped
    tty: true
    ports:
      - "3316:3306"
    environment:
      MYSQL_DATABASE: pink
      MYSQL_ROOT_PASSWORD: password
      SERVICE_TAGS: dev
      SERVICE_NAME: mysql
    volumes:
      - dbdata:/var/lib/mysql
      - ./docker/mysql/my.cnf:/etc/mysql/my.cnf
    networks:
      - app-network
...
**.env**
DATABASE_URL="mysql://root:password@db:3316/pink"
**ProductController.php**
#[Route('/product/create', name: 'product_create')]
    public function createProduct(ManagerRegistry $doctrine): Response
    {
        $entityManager = $doctrine->getManager();

        $product = new Product();
        $product->setName('Keyboard');
        $product->setPrice(1999);
        $product->setDescription('Ergonomic and stylish!');

        // tell Doctrine you want to (eventually) save the Product (no queries yet)
        $entityManager->persist($product);

        // actually executes the queries (i.e. the INSERT query)
        $entityManager->flush();

        return new Response('Saved new product with id '.$product->getId());

    }
The database (docker) container is up and running fine. Here's a test, with success:-
mysql --host=127.0.0.1 --user=root --password=password pink --port=3316 --ssl-mode=disabled
In my .env file I've replaced the string 127.0.0.1 with my docker container name as above: db . Any ideas please?
cookie (232 rep)
Apr 21, 2022, 02:51 PM • Last activity: Apr 14, 2023, 01:52 PM
2 votes
1 answers
2326 views
An exception occurred in the driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution
The following command results in the above error; symfony console doctrine:migrations:execute --up 'DoctrineMigrations\Version20220513151605' Lot's of questions on it but I cant find any that match my scenario (localhost apache vhost, mysql, symfony). All searches appear to point to a faulty DSN str...
The following command results in the above error; symfony console doctrine:migrations:execute --up 'DoctrineMigrations\Version20220513151605' Lot's of questions on it but I cant find any that match my scenario (localhost apache vhost, mysql, symfony). All searches appear to point to a faulty DSN string. What I've tried thus far... **.env.local**
DATABASE_URL="mysql://root:password@127.0.0.1:3306/mi_db?serverVersion=5.7.22-log"
DATABASE_URL="mysql://root:password@localhost:3306/mi_db?serverVersion=5.7.22-log"
with no joy? help
cookie (232 rep)
May 13, 2022, 03:57 PM • Last activity: May 13, 2022, 05:42 PM
1 votes
1 answers
181 views
Apache virtualhost configuration issue
I'm developing a symfony application and in trying to remove index.php from the url, I used the following virtualhost configuration: ServerAdmin webmaster@localhost DocumentRoot "/var/www/html/experiments-1/public" ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined...
I'm developing a symfony application and in trying to remove index.php from the url, I used the following virtualhost configuration: ServerAdmin webmaster@localhost DocumentRoot "/var/www/html/experiments-1/public" ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined The localtion of the site is confirmed as **/var/www/html/experiments-1/public/index.php**. But when I visit *http://localhost:81/* I just get the default symfony page. I would appreciate some insight into what I'm missing or doing wrong.
sisko (341 rep)
Nov 11, 2021, 06:54 PM • Last activity: Nov 15, 2021, 09:55 PM
0 votes
1 answers
1628 views
Host symfony app on plesk obsidian
Anyone was able to successfully run symfony application on the plesk environment already? I'm new to management of plesk, until now i was configuring vhosts by my self, with use Apache / Nginx. I just moved most of my Wordpress Websites to the plesk without an issue, i was able to run also Laravel 5...
Anyone was able to successfully run symfony application on the plesk environment already? I'm new to management of plesk, until now i was configuring vhosts by my self, with use Apache / Nginx. I just moved most of my Wordpress Websites to the plesk without an issue, i was able to run also Laravel 5.7 Project, without a single problem. But somehow symfony project is causing me some troubles. I've read about that symfony 4 requires PHP 7.1. I've tried to run it on every single possible PHP version from 7.0 to 7.4 (fpm / cgi). I am using Plesk 18 Obsidian. I just unpacked the project files in the home directory of my domain inside of folder named Symfony and made an symbolic link to the PUBLIC folder as httpdocs, but it doesn't worked, it always show 403 page. Edit: I also tried to unpack it directly in httpdocs folder, and in the hosting settings change root directory to /httpdocs/public, but then it keeps asking me about username in password, like it was pasword protected area.
Sharminte (1 rep)
Feb 10, 2020, 06:27 PM • Last activity: Nov 20, 2020, 08:28 AM
0 votes
1 answers
137 views
Trying to get a Symfony version number in my Bash script using a regular expression
When I call `bin/console --version` in a Symfony project from my terminal, I get `Symfony 4.4.3 (env: dev, debug: true)` I like to do a match to see that verifies that the result of the command does in fact match the expected pattern. I've got this pattern: https://regex101.com/r/n2hBR8/1 I've tried...
When I call bin/console --version in a Symfony project from my terminal, I get Symfony 4.4.3 (env: dev, debug: true) I like to do a match to see that verifies that the result of the command does in fact match the expected pattern. I've got this pattern: https://regex101.com/r/n2hBR8/1 I've tried several things in my Bash script, but I can't get it to work: #symfonyVersionRegex="Symfony\s\d{1}.*" #symfonyVersionRegex="^Symfony\s\d{1}.*$" symfonyVersionRegex="^Symfony\s\d.*$" symfonyVersionRaw=bin/console --version if [[ symfonyVersionRaw =~ $symfonyVersionRegex ]]; then echo Version number found else echo Version number NOT found fi When I echo the symfonyVersionRaw I get the expected version string, so that works but no matter what I try, I always get a negative result ("Version number NOT found").
William Berg (1 rep)
Aug 18, 2020, 12:40 PM • Last activity: Aug 18, 2020, 08:42 PM
0 votes
0 answers
1926 views
Doctrine OCI8 charset behavior between php-cli and php-fpm
My Oracle database is in `ISO8859-1` (not by choice). I'm struggling with segfault from `php-fpm` for a couple of days now. To dig out the source of it I've set two parallel environnements with the following `ENV` variable: NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P15 Php version: 5.6.12 ### php-cli The...
My Oracle database is in ISO8859-1 (not by choice). I'm struggling with segfault from php-fpm for a couple of days now. To dig out the source of it I've set two parallel environnements with the following ENV variable: NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P15 Php version: 5.6.12 ### php-cli The development server is started with: php -S localhost:8081 web/app_dev.php ### php-fpm Pool configuration extract: [www] env[NLS_LANG] = AMERICAN_AMERICA.WE8ISO8859P15 listen = 127.0.0.1:9000 ### Doctrine dbal charset: null Now, I'm requesting a JSON api with special characters: - with php-cli json_encode errors Malformed UTF-8 characters, possibly incorrectly encoded (seems to be a valid error, data is not in utf8) - with php-fpm everything works but special characters are replaced (é becomes e) Why? By trying to fix the php-cli, which seems more stable (lots of random 502 errors with php-fpm) I have two options: - Tweaking JsonResponse.php to encode everything from ISO8859-1 to UTF-8 (ugly) - Setting the client charset to UTF8 The second solution seems to be the one and the doctrine configuration is now: charset: UTF8 - php-cli now works as expected and everything is wonderful! - php-fpm fails with Oracle related errors: > [2015-08-25 13:56:54] php.DEBUG: oci_connect(): OCIEnvNlsCreate() > failed. There is something wrong with your system - please check that > LD_LIBRARY_PATH includes the directory with Oracle Instant Client > libraries > > [2015-08-25 13:56:54] php.DEBUG: oci_connect(): Error while trying to retrieve text for error ORA-12715 Where ORA-12715 is "invalid character set specified".LD_LIBRARY_PATH is not the issue here. What is going wrong here? Is php-fpm correct about those errors? How may I fix this to get the same behavior between php-cli and php-fpm?
soyuka (237 rep)
Aug 25, 2015, 12:05 PM • Last activity: Sep 28, 2016, 11:07 PM
0 votes
2 answers
925 views
Linux Debian Jessie sudo command keeps asking for password
I have recently configured a Symfony 3 site which involved me to set up some permissions on the `/var` folder. I had to do the following: $ HTTPDUSER=`ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1` $ sudo setfacl -R -m u:"$HTTPDUSER":r...
I have recently configured a Symfony 3 site which involved me to set up some permissions on the /var folder. I had to do the following: $ HTTPDUSER=ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1 $ sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:whoami:rwX var $ sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:whoami:rwX var This added the necessary permissions, but now I get the following message every time I use the sudo command. We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great responsibility. [sudo] password for user: This usually is sent only the first time a user uses sudo.  Also, I used to be able to put my password in for sudo once and it would expire after some time (and then I would have to re-enter it again).  Now I get both the massage and prompt for password every time. Is there a way to fix this?
Dblock247 (101 rep)
Jun 26, 2016, 10:51 PM • Last activity: Jun 28, 2016, 05:14 PM
5 votes
2 answers
1478 views
apache and php Segmentation fault
I have recently migrated to Archlinux. I installed Apache, php and mysql according to [the Arch Linux LAMP wiki page][1]. Now I have setup a virtual host for my new [Symfony][2] project. For every request I make, I get this error: [notice] child pid 10859 exit signal Segmentation fault (11) Can some...
I have recently migrated to Archlinux. I installed Apache, php and mysql according to the Arch Linux LAMP wiki page . Now I have setup a virtual host for my new Symfony project. For every request I make, I get this error: [notice] child pid 10859 exit signal Segmentation fault (11) Can someone please help me with this?
Omid Kamangar (233 rep)
Jun 21, 2012, 05:29 PM • Last activity: May 16, 2016, 01:29 AM
1 votes
2 answers
258 views
Dotdeb says PHP 5.3.18 is the latest
I'm using Debian 6 . Now I don't understand why it says PHP 5.3.18 is the latest when 5.3.2 has been around for 2 years? I need at least PHP 5.3.2 for my symfony project. Thanks.
I'm using Debian 6 . Now I don't understand why it says PHP 5.3.18 is the latest when 5.3.2 has been around for 2 years? I need at least PHP 5.3.2 for my symfony project. Thanks.
Marin (135 rep)
Nov 6, 2012, 05:34 AM • Last activity: Nov 6, 2012, 02:35 PM
Showing page 1 of 9 total questions